diff options
| -rw-r--r-- | bgpd/bgp_route.c | 6 | ||||
| -rw-r--r-- | bgpd/bgp_routemap.c | 3 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 6 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 1 | ||||
| -rw-r--r-- | bgpd/rfapi/bgp_rfapi_cfg.c | 37 | ||||
| -rw-r--r-- | doc/developer/workflow.rst | 2 | ||||
| -rw-r--r-- | lib/memory.c | 2 | ||||
| -rw-r--r-- | lib/prefix.c | 16 | ||||
| -rw-r--r-- | tools/start-stop-daemon.c | 12 | ||||
| -rw-r--r-- | zebra/zserv.c | 20 |
10 files changed, 40 insertions, 65 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 11223336e0..0a15eb5040 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1173,6 +1173,7 @@ static int bgp_input_modifier(struct peer *peer, struct prefix *p, /* Route map apply. */ if (rmap) { + memset(&info, 0, sizeof(struct bgp_info)); /* Duplicate current value to new strucutre for modification. */ info.peer = peer; info.attr = attr; @@ -1225,6 +1226,7 @@ static int bgp_output_modifier(struct peer *peer, struct prefix *p, if (rmap == NULL) return RMAP_DENY; + memset(&info, 0, sizeof(struct bgp_info)); /* Route map apply. */ /* Duplicate current value to new strucutre for modification. */ info.peer = peer; @@ -1682,6 +1684,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri, struct bgp_info_extra dummy_info_extra; struct attr dummy_attr; + memset(&info, 0, sizeof(struct bgp_info)); info.peer = peer; info.attr = attr; @@ -4363,6 +4366,8 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, /* Apply route-map. */ if (bgp_static->rmap.name) { struct attr attr_tmp = attr; + + memset(&info, 0, sizeof(struct bgp_info)); info.peer = bgp->peer_self; info.attr = &attr_tmp; @@ -6082,6 +6087,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, /* Apply route-map. */ if (red->rmap.name) { + memset(&info, 0, sizeof(struct bgp_info)); info.peer = bgp->peer_self; info.attr = &attr_new; diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 8c92f7ff32..cbacd6b4f2 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -676,6 +676,9 @@ static route_map_result_t route_match_vni(void *rule, struct prefix *prefix, vni = *((vni_t *)rule); bgp_info = (struct bgp_info *)object; + if (bgp_info->extra == NULL) + return RMAP_NOMATCH; + if (vni == label2vni(&bgp_info->extra->label[0])) return RMAP_MATCH; } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index f8903ea568..5bae542f89 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -102,6 +102,7 @@ struct community_list_handler *bgp_clist; unsigned int multipath_num = MULTIPATH_NUM; static void bgp_if_finish(struct bgp *bgp); +static void peer_drop_dynamic_neighbor(struct peer *peer); extern struct zclient *zclient; @@ -3719,10 +3720,10 @@ struct peer *peer_lookup_dynamic_neighbor(struct bgp *bgp, union sockunion *su) return peer; } -void peer_drop_dynamic_neighbor(struct peer *peer) +static void peer_drop_dynamic_neighbor(struct peer *peer) { int dncount = -1; - if (peer->group && peer->group->bgp) { + if (peer->group->bgp) { dncount = peer->group->bgp->dynamic_neighbors_count; if (dncount) peer->group->bgp->dynamic_neighbors_count = --dncount; @@ -3732,7 +3733,6 @@ void peer_drop_dynamic_neighbor(struct peer *peer) peer->group->name, dncount); } - /* If peer is configured at least one address family return 1. */ int peer_active(struct peer *peer) { diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 24d05c2e80..33d65bcb0f 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1462,7 +1462,6 @@ extern struct peer_group *peer_group_lookup_dynamic_neighbor(struct bgp *, struct prefix **); extern struct peer *peer_lookup_dynamic_neighbor(struct bgp *, union sockunion *); -extern void peer_drop_dynamic_neighbor(struct peer *); /* * Peers are incredibly easy to memory leak diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index 3e9722d920..2f93328887 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -1389,43 +1389,6 @@ DEFUN (vnc_export_mode, vty_out(vty, "Changing modes for zebra export not implemented yet\n"); return CMD_WARNING_CONFIG_FAILED; - - oldmode = bgp->rfapi_cfg->flags - & BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_BITS; - bgp->rfapi_cfg->flags &= ~BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_BITS; - switch (argv[4]->arg[0]) { - case 'g': - if (oldmode == BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_RH) { - /* TBD */ - } - bgp->rfapi_cfg->flags |= - BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_GRP; - if (oldmode != BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_GRP) { - /* TBD */ - } - break; - case 'n': - if (oldmode == BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_RH) { - /* TBD */ - } - if (oldmode == BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_GRP) { - /* TBD */ - } - break; - case 'r': - if (oldmode == BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_GRP) { - /* TBD */ - } - bgp->rfapi_cfg->flags |= - BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_RH; - if (oldmode != BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_RH) { - /* TBD */ - } - break; - default: - vty_out(vty, "Invalid mode\n"); - return CMD_WARNING_CONFIG_FAILED; - } } return CMD_SUCCESS; diff --git a/doc/developer/workflow.rst b/doc/developer/workflow.rst index 405539f49d..6e3fb42fb9 100644 --- a/doc/developer/workflow.rst +++ b/doc/developer/workflow.rst @@ -186,7 +186,7 @@ What do I submit my changes against? We've documented where we would like to have the different fixes applied at -https://github.com/FRR/frr/wiki/Where-Do-I-create-a-Pull-Request-against%3F +https://github.com/FRRouting/frr/wiki/Where-Do-I-create-a-Pull-Request-against%3F If you are unsure where your submission goes, look at that document or ask a project maintainer. diff --git a/lib/memory.c b/lib/memory.c index 318c381bf5..e279b17d12 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -81,7 +81,7 @@ void *qrealloc(struct memtype *mt, void *ptr, size_t size) void *qstrdup(struct memtype *mt, const char *str) { - return mt_checkalloc(mt, strdup(str), strlen(str) + 1); + return str ? mt_checkalloc(mt, strdup(str), strlen(str) + 1) : NULL; } void qfree(struct memtype *mt, void *ptr) diff --git a/lib/prefix.c b/lib/prefix.c index ead5444fd0..ed0774e774 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -584,8 +584,8 @@ int prefix_match(const struct prefix *n, const struct prefix *p) } /* Set both prefix's head pointer. */ - np = (const uint8_t *)&n->u.prefix; - pp = (const uint8_t *)&p->u.prefix; + np = n->u.val; + pp = p->u.val; offset = n->prefixlen / PNBBY; shift = n->prefixlen % PNBBY; @@ -609,8 +609,8 @@ int prefix_match_network_statement(const struct prefix *n, const uint8_t *np, *pp; /* Set both prefix's head pointer. */ - np = (const uint8_t *)&n->u.prefix; - pp = (const uint8_t *)&p->u.prefix; + np = n->u.val; + pp = p->u.val; offset = n->prefixlen / PNBBY; shift = n->prefixlen % PNBBY; @@ -742,8 +742,8 @@ int prefix_cmp(const struct prefix *p1, const struct prefix *p2) return 1; return 0; } - pp1 = (const uint8_t *)&p1->u.prefix; - pp2 = (const uint8_t *)&p2->u.prefix; + pp1 = p1->u.val; + pp2 = p2->u.val; if (p1->prefixlen != p2->prefixlen) return 1; @@ -774,8 +774,8 @@ int prefix_common_bits(const struct prefix *p1, const struct prefix *p2) uint8_t xor ; /* Set both prefix's head pointer. */ - const uint8_t *pp1 = (const uint8_t *)&p1->u.prefix; - const uint8_t *pp2 = (const uint8_t *)&p2->u.prefix; + const uint8_t *pp1 = p1->u.val; + const uint8_t *pp2 = p2->u.val; if (p1->family == AF_INET) length = IPV4_MAX_BYTELEN; diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c index 6bf55b7740..8c3fe0c3c5 100644 --- a/tools/start-stop-daemon.c +++ b/tools/start-stop-daemon.c @@ -258,11 +258,11 @@ static void add_namespace(const char *path) nsname = cur; } - if (!memcmp(nsdirname, "ipcns/", strlen("ipcns/"))) + if (!strncmp(nsdirname, "ipcns/", strlen("ipcns/"))) nstype = CLONE_NEWIPC; - else if (!memcmp(nsdirname, "netns/", strlen("netns/"))) + else if (!strncmp(nsdirname, "netns/", strlen("netns/"))) nstype = CLONE_NEWNET; - else if (!memcmp(nsdirname, "utcns/", strlen("utcns/"))) + else if (!strncmp(nsdirname, "utcns/", strlen("utcns/"))) nstype = CLONE_NEWUTS; else badusage("invalid namepspace path"); @@ -1030,8 +1030,10 @@ int main(int argc, char **argv) umask(022); /* set a default for dumb programs */ setpgid(0, 0); /* set the process group */ fd = open("/dev/null", O_RDWR); /* stdin */ - dup(fd); /* stdout */ - dup(fd); /* stderr */ + if (fd >= 0) { + dup(fd); /* stdout */ + dup(fd); /* stderr */ + } } if (nicelevel) { errno = 0; diff --git a/zebra/zserv.c b/zebra/zserv.c index a099cfc057..14e0db40bf 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -318,11 +318,12 @@ static int zserv_read(struct thread *thread) if (already < ZEBRA_HEADER_SIZE) { nb = stream_read_try(client->ibuf_work, sock, ZEBRA_HEADER_SIZE - already); - if ((nb == 0 || nb == -1) && IS_ZEBRA_DEBUG_EVENT) - zlog_debug("connection closed socket [%d]", - sock); - if ((nb == 0 || nb == -1)) + if ((nb == 0 || nb == -1)) { + if (IS_ZEBRA_DEBUG_EVENT) + zlog_debug("connection closed socket [%d]", + sock); goto zread_fail; + } if (nb != (ssize_t)(ZEBRA_HEADER_SIZE - already)) { /* Try again later. */ break; @@ -375,12 +376,13 @@ static int zserv_read(struct thread *thread) if (already < hdr.length) { nb = stream_read_try(client->ibuf_work, sock, hdr.length - already); - if ((nb == 0 || nb == -1) && IS_ZEBRA_DEBUG_EVENT) - zlog_debug( - "connection closed [%d] when reading zebra data", - sock); - if ((nb == 0 || nb == -1)) + if ((nb == 0 || nb == -1)) { + if (IS_ZEBRA_DEBUG_EVENT) + zlog_debug( + "connection closed [%d] when reading zebra data", + sock); goto zread_fail; + } if (nb != (ssize_t)(hdr.length - already)) { /* Try again later. */ break; |
