-/* $OpenBSD: bgpctl.c,v 1.278 2022/06/23 12:40:32 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.279 2022/06/27 13:27:38 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
if (sum) {
if (flags & F_PREF_INVALID)
*p++ = 'E';
+ if (flags & F_PREF_OTC_LOOP)
+ *p++ = 'L';
if (flags & F_PREF_ANNOUNCE)
*p++ = 'A';
if (flags & F_PREF_INTERNAL)
else
strlcpy(buf, "external", sizeof(buf));
+ if (flags & F_PREF_INVALID)
+ strlcat(buf, ", invalid", sizeof(buf));
+ if (flags & F_PREF_OTC_LOOP)
+ strlcat(buf, ", otc loop", sizeof(buf));
if (flags & F_PREF_STALE)
strlcat(buf, ", stale", sizeof(buf));
if (flags & F_PREF_ELIGIBLE)
CHECK_FLAGS(flags, ATTR_OPTIONAL|ATTR_TRANSITIVE, ATTR_PARTIAL);
strlcpy(cstr, "Large Communities", sizeof(cstr));
break;
+ case ATTR_OTC:
+ CHECK_FLAGS(flags, ATTR_OPTIONAL|ATTR_TRANSITIVE, ATTR_PARTIAL);
+ strlcpy(cstr, "OTC", sizeof(cstr));
+ break;
default:
/* ignore unknown attributes */
snprintf(cstr, sizeof(cstr), "Unknown Attribute #%u", type);
-/* $OpenBSD: output.c,v 1.22 2022/06/22 14:49:51 claudio Exp $ */
+/* $OpenBSD: output.c,v 1.23 2022/06/27 13:27:38 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
}
if (hascapamp || hascapaap || p->capa.peer.grestart.restart ||
p->capa.peer.refresh || p->capa.peer.enhanced_rr ||
- p->capa.peer.as4byte) {
+ p->capa.peer.as4byte || p->capa.peer.role_ena) {
printf(" Neighbor capabilities:\n");
if (hascapamp)
show_neighbor_capa_mp(&p->capa.peer);
show_neighbor_capa_restart(&p->capa.peer);
if (hascapaap)
show_neighbor_capa_add_path(&p->capa.peer);
+ if (p->capa.peer.role_ena)
+ printf(" Open Policy role %s (local %s)\n",
+ log_policy(p->capa.peer.role),
+ log_policy(p->capa.ann.role));
}
hascapamp = 0;
}
if (hascapamp || hascapaap || p->capa.neg.grestart.restart ||
p->capa.neg.refresh || p->capa.neg.enhanced_rr ||
- p->capa.neg.as4byte) {
+ p->capa.neg.as4byte || p->capa.neg.role_ena) {
printf(" Negotiated capabilities:\n");
if (hascapamp)
show_neighbor_capa_mp(&p->capa.neg);
show_neighbor_capa_restart(&p->capa.neg);
if (hascapaap)
show_neighbor_capa_add_path(&p->capa.neg);
+ if (p->capa.neg.role_ena)
+ printf(" Open Policy role %s (local %s)\n",
+ log_policy(p->capa.neg.role),
+ log_policy(p->capa.ann.role));
}
printf("\n");
case ATTR_LARGE_COMMUNITIES:
show_large_community(data, alen);
break;
+ case ATTR_OTC:
+ if (alen == 4) {
+ memcpy(&as, data, sizeof(as));
+ as = ntohl(as);
+ printf("%s", log_as(as));
+ } else {
+ printf("bad length");
+ }
+ break;
case ATTR_ATOMIC_AGGREGATE:
default:
printf(" len %u", alen);
-/* $OpenBSD: output_json.c,v 1.16 2022/06/22 14:49:51 claudio Exp $ */
+/* $OpenBSD: output_json.c,v 1.17 2022/06/27 13:27:38 claudio Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
json_do_end();
}
+ if (capa->role_ena) {
+ json_do_printf("open_policy_role", "%s%s",
+ log_policy(capa->role),
+ capa->role_ena == 2 ? " enforce" : "");
+ }
+
json_do_end();
}
case ATTR_LARGE_COMMUNITIES:
json_do_large_community(data, alen);
break;
+ case ATTR_OTC:
+ if (alen == 4) {
+ memcpy(&as, data, sizeof(as));
+ as = ntohl(as);
+ json_do_uint("as", as);
+ } else
+ json_do_printf("error", "bad length");
+ break;
case ATTR_ATOMIC_AGGREGATE:
default:
if (alen)