-/* $OpenBSD: bgpd.c,v 1.252 2022/07/23 10:24:00 claudio Exp $ */
+/* $OpenBSD: bgpd.c,v 1.253 2022/07/28 13:11:48 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
ce->id = r->id;
ce->fd = socket(aid2af(r->remote_addr.aid),
- SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, IPPROTO_TCP);
+ SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, IPPROTO_TCP);
if (ce->fd == -1) {
log_warn("rtr %s", r->descr);
free(ce);
}
if (ce == NULL)
fatalx("connect entry not found");
-
+
TAILQ_REMOVE(&connect_queue, ce, entry);
connect_cnt--;
-/* $OpenBSD: bgpd.h,v 1.447 2022/07/28 10:41:18 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.448 2022/07/28 13:11:48 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
uint32_t expire;
int session_id;
in_addr_t remote_port;
- enum rtr_error last_sent_error;
+ enum rtr_error last_sent_error;
enum rtr_error last_recv_error;
char last_sent_msg[REASON_LEN];
char last_recv_msg[REASON_LEN];
void send_nexthop_update(struct kroute_nexthop *);
void send_imsg_session(int, pid_t, void *, uint16_t);
int send_network(int, struct network_config *,
- struct filter_set_head *);
+ struct filter_set_head *);
int bgpd_oknexthop(struct kroute_full *);
void set_pollfd(struct pollfd *, struct imsgbuf *);
int handle_pollfd(struct pollfd *, struct imsgbuf *);
uint16_t pftable_ref(uint16_t);
/* parse.y */
-int cmdline_symset(char *);
+int cmdline_symset(char *);
struct prefixset *find_prefixset(char *, struct prefixset_head *);
struct bgpd_config *parse_config(char *, struct peer_head *,
struct rtr_config_head *);
#define AS_ERR_SOFT -4
u_char *aspath_inflate(void *, uint16_t, uint16_t *);
int nlri_get_prefix(u_char *, uint16_t, struct bgpd_addr *,
- uint8_t *);
+ uint8_t *);
int nlri_get_prefix6(u_char *, uint16_t, struct bgpd_addr *,
- uint8_t *);
+ uint8_t *);
int nlri_get_vpn4(u_char *, uint16_t, struct bgpd_addr *,
- uint8_t *, int);
+ uint8_t *, int);
int nlri_get_vpn6(u_char *, uint16_t, struct bgpd_addr *,
- uint8_t *, int);
+ uint8_t *, int);
int prefix_compare(const struct bgpd_addr *,
const struct bgpd_addr *, int);
void inet4applymask(struct in_addr *, const struct in_addr *, int);
-/* $OpenBSD: control.c,v 1.106 2022/02/04 12:01:12 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.107 2022/07/28 13:11:48 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
mode_t old_umask, mode;
if ((fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
- 0)) == -1) {
+ 0)) == -1) {
log_warn("control_init: socket");
return (-1);
}
-/* $OpenBSD: kroute.c,v 1.283 2022/07/27 17:23:17 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.284 2022/07/28 13:11:48 deraadt Exp $ */
/*
* Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
int kif_compare(struct kif_node *, struct kif_node *);
struct kroute *kroute_find(struct ktable *, const struct bgpd_addr *,
- uint8_t, uint8_t);
+ uint8_t, uint8_t);
struct kroute *kroute_matchgw(struct kroute *, struct bgpd_addr *);
int kroute_insert(struct ktable *, struct kroute_full *);
int kroute_remove(struct ktable *, struct kroute *);
void kroute_clear(struct ktable *);
struct kroute6 *kroute6_find(struct ktable *, const struct bgpd_addr *,
- uint8_t, uint8_t);
+ uint8_t, uint8_t);
struct kroute6 *kroute6_matchgw(struct kroute6 *, struct bgpd_addr *);
int kroute6_remove(struct ktable *, struct kroute6 *);
void kroute6_clear(struct ktable *);
sdon.depend_state = kif->depend_state;
send_imsg_session(IMSG_SESSION_DEPENDON, 0, &sdon, sizeof(sdon));
}
-
+
void
kr_ifinfo(char *ifname)
{
-/* $OpenBSD: logmsg.c,v 1.7 2022/06/28 11:42:41 claudio Exp $ */
+/* $OpenBSD: logmsg.c,v 1.8 2022/07/28 13:11:48 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
suberrname = suberr_header_names[subcode];
break;
case ERR_OPEN:
- if (subcode >= sizeof(suberr_open_names) / sizeof(char *) ||
+ if (subcode >= sizeof(suberr_open_names) / sizeof(char *) ||
suberr_open_names[subcode] == NULL)
uk = 1;
else
-/* $OpenBSD: mrt.c,v 1.107 2022/03/22 10:53:08 claudio Exp $ */
+/* $OpenBSD: mrt.c,v 1.108 2022/07/28 13:11:48 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
/* XXX is this for peer self? */
aid = peer->remote_addr.aid == AID_UNSPEC ? p->pt->aid :
- peer->remote_addr.aid;
+ peer->remote_addr.aid;
switch (aid) {
case AID_INET:
case AID_VPN_IPv4:
-/* $OpenBSD: parse.y,v 1.433 2022/07/21 12:34:19 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.434 2022/07/28 13:11:49 deraadt Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
| STRING
;
-yesno : STRING {
+yesno : STRING {
if (!strcmp($1, "yes"))
$$ = 1;
else if (!strcmp($1, "no"))
| '{' filter_prefix_l '}' { $$ = $2; }
| '{' filter_prefix_l '}' filter_prefix_m
{
- struct filter_prefix_l *p;
+ struct filter_prefix_l *p;
/* merge, both can be lists */
for (p = $2; p != NULL && p->next != NULL; p = p->next)
- ; /* nothing */
+ ; /* nothing */
if (p != NULL)
p->next = $4;
$$ = $2;
*flag = COMMUNITY_NEIGHBOR_AS;
return 0;
} else if (strcmp(s, "local-as") == 0) {
- *flag = COMMUNITY_LOCAL_AS;
+ *flag = COMMUNITY_LOCAL_AS;
return 0;
}
if (large)
if (rb != NULL)
strlcpy(r->rib, rb->name,
- sizeof(r->rib));
+ sizeof(r->rib));
if (p != NULL)
memcpy(&r->peer, &p->p,
-/* $OpenBSD: pfkey.c,v 1.65 2022/06/16 09:51:07 claudio Exp $ */
+/* $OpenBSD: pfkey.c,v 1.66 2022/07/28 13:11:50 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
if (getsockopt(fd, IPPROTO_TCP, TCP_MD5SIG,
&opt, &len) == -1)
fatal("getsockopt TCP_MD5SIG");
- if (!opt) { /* non-md5'd connection! */
+ if (!opt) { /* non-md5'd connection! */
log_peer_warnx(&p->conf,
"connection attempt without md5 signature");
return -1;
-/* $OpenBSD: printconf.c,v 1.156 2022/07/11 17:08:21 claudio Exp $ */
+/* $OpenBSD: printconf.c,v 1.157 2022/07/28 13:11:50 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
printf("%s\tpassive\n", c);
if (p->local_addr_v4.aid)
printf("%s\tlocal-address %s\n", c,
- log_addr(&p->local_addr_v4));
+ log_addr(&p->local_addr_v4));
if (p->local_addr_v6.aid)
printf("%s\tlocal-address %s\n", c,
- log_addr(&p->local_addr_v6));
+ log_addr(&p->local_addr_v6));
if (p->remote_port != BGP_PORT)
printf("%s\tport %hu\n", c, p->remote_port);
if (p->max_prefix) {
printf("%s\tannounce add-path recv yes\n", c);
if (p->capabilities.add_path[0] & CAPA_AP_SEND) {
printf("%s\tannounce add-path send %s", c,
- print_addpath_mode(p->eval.mode));
+ print_addpath_mode(p->eval.mode));
if (p->eval.extrapaths != 0)
printf(" plus %d", p->eval.extrapaths);
if (p->eval.maxpaths != 0)
-/* $OpenBSD: rde.c,v 1.559 2022/07/25 16:37:55 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.560 2022/07/28 13:11:50 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
void rde_dispatch_imsg_peer(struct rde_peer *, void *);
void rde_update_dispatch(struct rde_peer *, struct imsg *);
int rde_update_update(struct rde_peer *, uint32_t,
- struct filterstate *, struct bgpd_addr *, uint8_t);
+ struct filterstate *, struct bgpd_addr *, uint8_t);
void rde_update_withdraw(struct rde_peer *, uint32_t,
- struct bgpd_addr *, uint8_t);
+ struct bgpd_addr *, uint8_t);
int rde_attr_parse(u_char *, uint16_t, struct rde_peer *,
- struct filterstate *, struct mpattr *);
+ struct filterstate *, struct mpattr *);
int rde_attr_add(struct filterstate *, u_char *, uint16_t);
uint8_t rde_attr_missing(struct rde_aspath *, int, uint16_t);
int rde_get_mp_nexthop(u_char *, uint16_t, uint8_t,
- struct filterstate *);
+ struct filterstate *);
void rde_as4byte_fixup(struct rde_peer *, struct rde_aspath *);
void rde_reflector(struct rde_peer *, struct rde_aspath *);
void rde_dump_ctx_new(struct ctl_show_rib_request *, pid_t,
- enum imsg_type);
+ enum imsg_type);
void rde_dump_ctx_throttle(pid_t, int);
void rde_dump_ctx_terminate(pid_t);
void rde_dump_mrt_new(struct mrt *, pid_t, int);
void rde_update6_queue_runner(uint8_t);
struct rde_prefixset *rde_find_prefixset(char *, struct rde_prefixset_head *);
void rde_mark_prefixsets_dirty(struct rde_prefixset_head *,
- struct rde_prefixset_head *);
+ struct rde_prefixset_head *);
uint8_t rde_roa_validity(struct rde_prefixset *,
- struct bgpd_addr *, uint8_t, uint32_t);
+ struct bgpd_addr *, uint8_t, uint32_t);
static void rde_peer_recv_eor(struct rde_peer *, uint8_t);
static void rde_peer_send_eor(struct rde_peer *, uint8_t);
struct route_refresh rr;
/* not strickly needed, the SE checks as well */
- if (peer->capa.enhanced_rr == 0)
+ if (peer->capa.enhanced_rr == 0)
return;
switch (subtype) {
-/* $OpenBSD: rde.h,v 1.260 2022/07/25 16:37:55 claudio Exp $ */
+/* $OpenBSD: rde.h,v 1.261 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and
/* rde.c */
void rde_update_err(struct rde_peer *, uint8_t , uint8_t,
- void *, uint16_t);
+ void *, uint16_t);
void rde_update_log(const char *, uint16_t,
- const struct rde_peer *, const struct bgpd_addr *,
- const struct bgpd_addr *, uint8_t);
+ const struct rde_peer *, const struct bgpd_addr *,
+ const struct bgpd_addr *, uint8_t);
void rde_send_kroute_flush(struct rib *);
void rde_send_kroute(struct rib *, struct prefix *, struct prefix *);
void rde_send_nexthop(struct bgpd_addr *, int);
/* rde_attr.c */
int attr_write(void *, uint16_t, uint8_t, uint8_t, void *,
- uint16_t);
+ uint16_t);
int attr_writebuf(struct ibuf *, uint8_t, uint8_t, void *,
- uint16_t);
+ uint16_t);
void attr_init(uint32_t);
void attr_shutdown(void);
void attr_hash_stats(struct rde_hashstats *);
int attr_optadd(struct rde_aspath *, uint8_t, uint8_t,
- void *, uint16_t);
+ void *, uint16_t);
struct attr *attr_optget(const struct rde_aspath *, uint8_t);
void attr_copy(struct rde_aspath *, const struct rde_aspath *);
int attr_compare(struct rde_aspath *, struct rde_aspath *);
int prefix_eligible(struct prefix *);
struct prefix *prefix_best(struct rib_entry *);
void prefix_evaluate(struct rib_entry *, struct prefix *,
- struct prefix *);
+ struct prefix *);
void prefix_evaluate_nexthop(struct prefix *, enum nexthop_state,
- enum nexthop_state);
+ enum nexthop_state);
/* rde_filter.c */
void rde_apply_set(struct filter_set_head *, struct rde_peer *,
struct prefix *prefix_match(struct rde_peer *, struct bgpd_addr *);
struct prefix *prefix_adjout_match(struct rde_peer *, struct bgpd_addr *);
struct prefix *prefix_adjout_lookup(struct rde_peer *, struct bgpd_addr *,
- int);
+ int);
struct prefix *prefix_adjout_next(struct rde_peer *, struct prefix *);
int prefix_update(struct rib *, struct rde_peer *, uint32_t,
- uint32_t, struct filterstate *, struct bgpd_addr *,
- int, uint8_t);
+ uint32_t, struct filterstate *, struct bgpd_addr *,
+ int, uint8_t);
int prefix_withdraw(struct rib *, struct rde_peer *, uint32_t,
struct bgpd_addr *, int);
void prefix_add_eor(struct rde_peer *, uint8_t);
/* rde_update.c */
void up_init(struct rde_peer *);
void up_generate_updates(struct filter_head *, struct rde_peer *,
- struct prefix *, struct prefix *);
+ struct prefix *, struct prefix *);
void up_generate_addpath(struct filter_head *, struct rde_peer *,
- struct prefix *, struct prefix *);
+ struct prefix *, struct prefix *);
void up_generate_default(struct filter_head *, struct rde_peer *,
- uint8_t);
+ uint8_t);
int up_is_eor(struct rde_peer *, uint8_t);
int up_dump_withdraws(u_char *, int, struct rde_peer *, uint8_t);
int up_dump_mp_unreach(u_char *, int, struct rde_peer *, uint8_t);
-/* $OpenBSD: rde_attr.c,v 1.126 2022/02/06 09:51:19 claudio Exp $ */
+/* $OpenBSD: rde_attr.c,v 1.127 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
static uint32_t aspath_extract_origin(const void *, uint16_t);
static uint16_t aspath_countlength(struct aspath *, uint16_t, int);
static void aspath_countcopy(struct aspath *, uint16_t, uint8_t *,
- uint16_t, int);
+ uint16_t, int);
struct aspath *aspath_lookup(const void *, uint16_t);
struct aspath_table {
*/
u_char *
aspath_override(struct aspath *asp, uint32_t neighbor_as, uint32_t local_as,
- uint16_t *len)
+ uint16_t *len)
{
u_char *p, *seg, *nseg;
uint32_t as;
-/* $OpenBSD: rde_community.c,v 1.6 2022/05/31 09:45:33 claudio Exp $ */
+/* $OpenBSD: rde_community.c,v 1.7 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
{
size_t l;
int count = 0;
-
+
/* use the fact that the array is ordered by type */
switch (type) {
case COMMUNITY_TYPE_BASIC:
-/* $OpenBSD: rde_filter.c,v 1.128 2022/05/31 09:45:33 claudio Exp $ */
+/* $OpenBSD: rde_filter.c,v 1.129 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
case ACTION_SET_AS_OVERRIDE:
if (from == NULL)
break;
- np = aspath_override(state->aspath.aspath,
- from->conf.remote_as, from->conf.local_as, &nl);
+ np = aspath_override(state->aspath.aspath,
+ from->conf.remote_as, from->conf.local_as, &nl);
aspath_put(state->aspath.aspath);
state->aspath.aspath = aspath_get(np, nl);
free(np);
-/* $OpenBSD: rde_peer.c,v 1.19 2022/07/11 17:08:21 claudio Exp $ */
+/* $OpenBSD: rde_peer.c,v 1.20 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
if (rib == NULL)
continue;
rp = prefix_get(rib, peer, p->path_id,
- &addr, prefixlen);
+ &addr, prefixlen);
if (rp) {
asp = prefix_aspath(rp);
if (asp && asp->pftableid)
-/* $OpenBSD: rde_rib.c,v 1.241 2022/07/25 16:37:55 claudio Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.242 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
struct nexthop *, uint8_t, uint8_t);
static void prefix_link(struct prefix *, struct rib_entry *,
- struct pt_entry *, struct rde_peer *, uint32_t, uint32_t,
- struct rde_aspath *, struct rde_community *,
- struct nexthop *, uint8_t, uint8_t);
+ struct pt_entry *, struct rde_peer *, uint32_t, uint32_t,
+ struct rde_aspath *, struct rde_community *,
+ struct nexthop *, uint8_t, uint8_t);
static void prefix_unlink(struct prefix *);
static struct prefix *prefix_alloc(void);
-/* $OpenBSD: rde_sets.c,v 1.11 2022/02/06 09:51:19 claudio Exp $ */
+/* $OpenBSD: rde_sets.c,v 1.12 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2018 Claudio Jeker <claudio@openbsd.org>
return -1;
}
for (new_size = set->max; new_size < set->nmemb + nelms; )
- new_size += (new_size < 4096 ? new_size : 4096);
+ new_size += (new_size < 4096 ? new_size : 4096);
s = reallocarray(set->set, new_size, set->size);
if (s == NULL)
-/* $OpenBSD: session.c,v 1.431 2022/07/18 13:56:41 claudio Exp $ */
+/* $OpenBSD: session.c,v 1.432 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
if (peer_cnt > peer_l_elms) {
if ((newp = reallocarray(peer_l, peer_cnt,
sizeof(struct peer *))) == NULL) {
- /* panic for now */
+ /* panic for now */
log_warn("could not resize peer_l from %u -> %u"
" entries", peer_l_elms, peer_cnt);
fatalx("exiting");
if (mrt_cnt > mrt_l_elms) {
if ((newp = reallocarray(mrt_l, mrt_cnt,
sizeof(struct mrt *))) == NULL) {
- /* panic for now */
+ /* panic for now */
log_warn("could not resize mrt_l from %u -> %u"
" entries", mrt_l_elms, mrt_cnt);
fatalx("exiting");
if (new_cnt > pfd_elms) {
if ((newp = reallocarray(pfd, new_cnt,
sizeof(struct pollfd))) == NULL) {
- /* panic for now */
+ /* panic for now */
log_warn("could not resize pfd from %u -> %u"
" entries", pfd_elms, new_cnt);
fatalx("exiting");
/* BGP open policy, RFC 9234 */
if (p->capa.ann.role_ena) {
errs += session_capa_add(opb, CAPA_ROLE, 1);
- errs += ibuf_add(opb, &p->capa.ann.role, 1);
+ errs += ibuf_add(opb, &p->capa.ann.role, 1);
}
/* graceful restart and End-of-RIB marker, RFC 4724 */
extlen = 1;
}
- /* RFC9020 encoding has 3 extra bytes */
+ /* RFC9020 encoding has 3 extra bytes */
if (optparamlen + 3 * extlen != msglen - MSGSIZE_OPEN_MIN)
goto bad_len;
}
reason_len = *p++;
datalen--;
if (datalen < reason_len) {
- log_peer_warnx(&peer->conf,
- "received truncated shutdown reason");
- return (0);
+ log_peer_warnx(&peer->conf,
+ "received truncated shutdown reason");
+ return (0);
}
if (reason_len > REASON_LEN - 1) {
- log_peer_warnx(&peer->conf,
- "received overly long shutdown reason");
- return (0);
+ log_peer_warnx(&peer->conf,
+ "received overly long shutdown reason");
+ return (0);
}
memcpy(peer->stats.last_reason, p, reason_len);
peer->stats.last_reason[reason_len] = '\0';
-/* $OpenBSD: session.h,v 1.156 2022/06/27 13:26:51 claudio Exp $ */
+/* $OpenBSD: session.h,v 1.157 2022/07/28 13:11:51 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
/* mrt.c */
void mrt_dump_bgp_msg(struct mrt *, void *, uint16_t,
- struct peer *, enum msg_type);
+ struct peer *, enum msg_type);
void mrt_dump_state(struct mrt *, uint16_t, uint16_t,
- struct peer *);
+ struct peer *);
void mrt_done(struct mrt *);
/* pfkey.c */