diff options
| -rw-r--r-- | bgpd/bgp_memory.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 61 | ||||
| -rw-r--r-- | pimd/pim_igmpv3.c | 8 | ||||
| -rw-r--r-- | pimd/pim_rp.c | 32 | ||||
| -rw-r--r-- | python/makefile.py | 45 | ||||
| -rw-r--r-- | tools/etc/frr/support_bundle_commands.conf | 1 | ||||
| -rw-r--r-- | tools/frr-llvm-cg.c | 6 |
7 files changed, 119 insertions, 36 deletions
diff --git a/bgpd/bgp_memory.c b/bgpd/bgp_memory.c index 1dc992fb94..b9f1ba3971 100644 --- a/bgpd/bgp_memory.c +++ b/bgpd/bgp_memory.c @@ -65,7 +65,7 @@ DEFINE_MTYPE(BGPD, AS_LIST, "BGP AS list"); DEFINE_MTYPE(BGPD, AS_FILTER, "BGP AS filter"); DEFINE_MTYPE(BGPD, AS_FILTER_STR, "BGP AS filter str"); -DEFINE_MTYPE(BGPD, COMMUNITY_ALIAS, "community"); +DEFINE_MTYPE(BGPD, COMMUNITY_ALIAS, "community alias"); DEFINE_MTYPE(BGPD, COMMUNITY, "community"); DEFINE_MTYPE(BGPD, COMMUNITY_VAL, "community val"); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 9cfec0fe2f..0a4083e5f6 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1640,49 +1640,72 @@ DEFPY(bgp_community_alias, bgp_community_alias_cmd, "Community (AA:BB or AA:BB:CC)\n" "Alias name\n") { - struct community_alias ca1; - struct community_alias ca2; + struct community_alias ca = {}; struct community_alias *lookup_community; struct community_alias *lookup_alias; + struct community *comm; + struct lcommunity *lcomm; + uint8_t invalid = 0; - if (!community_str2com(community) && !lcommunity_str2com(community)) { + comm = community_str2com(community); + if (!comm) + invalid++; + community_free(&comm); + + lcomm = lcommunity_str2com(community); + if (!lcomm) + invalid++; + lcommunity_free(&lcomm); + + if (invalid > 1) { vty_out(vty, "Invalid community format\n"); return CMD_WARNING; } - memset(&ca1, 0, sizeof(ca1)); - memset(&ca2, 0, sizeof(ca2)); - strlcpy(ca1.community, community, sizeof(ca1.community)); - strlcpy(ca1.alias, alias_name, sizeof(ca1.alias)); + strlcpy(ca.community, community, sizeof(ca.community)); + strlcpy(ca.alias, alias_name, sizeof(ca.alias)); - lookup_community = bgp_ca_community_lookup(&ca1); - lookup_alias = bgp_ca_alias_lookup(&ca1); + lookup_community = bgp_ca_community_lookup(&ca); + lookup_alias = bgp_ca_alias_lookup(&ca); if (no) { - bgp_ca_alias_delete(&ca1); - bgp_ca_community_delete(&ca1); + bgp_ca_alias_delete(&ca); + bgp_ca_community_delete(&ca); } else { if (lookup_alias) { /* Lookup if community hash table has an item * with the same alias name. */ - strlcpy(ca2.community, lookup_alias->community, - sizeof(ca2.community)); - if (bgp_ca_community_lookup(&ca2)) { + strlcpy(ca.community, lookup_alias->community, + sizeof(ca.community)); + if (bgp_ca_community_lookup(&ca)) { vty_out(vty, "community (%s) already has this alias (%s)\n", lookup_alias->community, lookup_alias->alias); return CMD_WARNING; } - bgp_ca_alias_delete(&ca1); + bgp_ca_alias_delete(&ca); } - if (lookup_community) - bgp_ca_community_delete(&ca1); + if (lookup_community) { + /* Lookup if alias hash table has an item + * with the same community. + */ + strlcpy(ca.alias, lookup_community->alias, + sizeof(ca.alias)); + if (bgp_ca_alias_lookup(&ca)) { + vty_out(vty, + "alias (%s) already has this community (%s)\n", + lookup_community->alias, + lookup_community->community); + return CMD_WARNING; + } + bgp_ca_community_delete(&ca); + } - bgp_ca_alias_insert(&ca1); - bgp_ca_community_insert(&ca1); + bgp_ca_alias_insert(&ca); + bgp_ca_community_insert(&ca); } return CMD_SUCCESS; diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 6ba48d6488..6ed5c501b2 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -1890,6 +1890,7 @@ int igmp_v3_recv_report(struct gm_sock *igmp, struct in_addr from, uint8_t *group_record; uint8_t *report_pastend = (uint8_t *)igmp_msg + igmp_msg_len; struct interface *ifp = igmp->interface; + struct pim_interface *pim_ifp = ifp->info; int i; if (igmp->mtrace_only) @@ -1913,6 +1914,13 @@ int igmp_v3_recv_report(struct gm_sock *igmp, struct in_addr from, /* Collecting IGMP Rx stats */ igmp->igmp_stats.report_v3++; + if (pim_ifp->igmp_version == 2) { + zlog_warn( + "Received Version 3 packet but interface: %s is configured for version 2", + ifp->name); + return -1; + } + num_groups = ntohs( *(uint16_t *)(igmp_msg + IGMP_V3_REPORT_NUMGROUPS_OFFSET)); if (num_groups < 1) { diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index fdf4b99c32..3da0a35303 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -274,10 +274,29 @@ struct rp_info *pim_rp_find_match_group(struct pim_instance *pim, route_unlock_node(rn); + /* + * rp's with prefix lists have the group as 224.0.0.0/4 which will + * match anything. So if we have a rp_info that should match a prefix + * list then if we do match then best should be the answer( even + * if it is NULL ) + */ + if (!rp_info || (rp_info && rp_info->plist)) + return best; + + /* + * So we have a non plist rp_info found in the lookup and no plists + * at all to be choosen, return it! + */ if (!best) return rp_info; - if (rp_info->group.prefixlen < best->group.prefixlen) + /* + * If we have a matching non prefix list and a matching prefix + * list we should return the actual rp_info that has the LPM + * If they are equal, use the prefix-list( but let's hope + * the end-operator doesn't do this ) + */ + if (rp_info->group.prefixlen > bp->prefixlen) best = rp_info; return best; @@ -423,7 +442,7 @@ int pim_rp_new(struct pim_instance *pim, pim_addr rp_addr, struct prefix group, struct rp_info *tmp_rp_info; char buffer[BUFSIZ]; struct prefix nht_p; - struct route_node *rn; + struct route_node *rn = NULL; struct pim_upstream *up; bool upstream_updated = false; @@ -601,13 +620,16 @@ int pim_rp_new(struct pim_instance *pim, pim_addr rp_addr, struct prefix group, } listnode_add_sort(pim->rp_list, rp_info); - rn = route_node_get(pim->rp_table, &rp_info->group); - rn->info = rp_info; + + if (!rp_info->plist) { + rn = route_node_get(pim->rp_table, &rp_info->group); + rn->info = rp_info; + } if (PIM_DEBUG_PIM_TRACE) zlog_debug("Allocated: %p for rp_info: %p(%pFX) Lock: %d", rn, rp_info, &rp_info->group, - route_node_get_lock_count(rn)); + rn ? route_node_get_lock_count(rn) : 0); frr_each (rb_pim_upstream, &pim->upstream_head, up) { if (pim_addr_is_any(up->sg.src)) { diff --git a/python/makefile.py b/python/makefile.py index 44658013b3..afc993b5b9 100644 --- a/python/makefile.py +++ b/python/makefile.py @@ -32,7 +32,12 @@ for clippy_file in clippy_scan: assert clippy_file.endswith(".c") xref_targets = [] -for varname in ["bin_PROGRAMS", "sbin_PROGRAMS", "lib_LTLIBRARIES", "module_LTLIBRARIES"]: +for varname in [ + "bin_PROGRAMS", + "sbin_PROGRAMS", + "lib_LTLIBRARIES", + "module_LTLIBRARIES", +]: xref_targets.extend(mv[varname].strip().split()) # check for files using clippy but not listed in clippy_scan @@ -63,6 +68,9 @@ if args.dev_build: ) sys.exit(1) +# this additional-dependency rule is stuck onto all compile targets that +# compile a file which uses clippy-generated input, so it has a dependency to +# make that first. clippydep = Template( """ ${clippybase}.$$(OBJEXT): ${clippybase}_clippy.c @@ -70,6 +78,8 @@ ${clippybase}.lo: ${clippybase}_clippy.c ${clippybase}_clippy.c: $$(CLIPPY_DEPS)""" ) +# this one is used when one .c file is built multiple times with different +# CFLAGS clippyauxdep = Template( """# clippy{ # auxiliary clippy target @@ -88,6 +98,7 @@ while lines: if line.startswith(autoderp): line = line[len(autoderp) :] + # allow rerunning on already-clippified Makefile if line == "# clippy{": while lines: line = lines.pop(0) @@ -113,29 +124,53 @@ while lines: target, dep = m.group(1), m.group(2) + filename = os.path.basename(target) + if "-" in filename: + # dashes in output filename = building same .c with different CFLAGS + am_name, _ = filename.split("-", 1) + am_name = os.path.join(os.path.dirname(target), am_name) + am_name = am_name.replace("/", "_") + extraflags = " $(%s_CFLAGS)" % (am_name,) + else: + # this path isn't really triggered because automake is using a generic + # .c => .o rule unless CFLAGS are customized for a target + extraflags = "" + if target.endswith(".lo") or target.endswith(".o"): if not dep.endswith(".h"): + # LLVM bitcode targets for analysis tools bcdeps.append("%s.bc: %s" % (target, target)) - bcdeps.append("\t$(AM_V_LLVM_BC)$(COMPILE) -emit-llvm -c -o $@ %s" % (dep)) + bcdeps.append( + "\t$(AM_V_LLVM_BC)$(COMPILE)%s -emit-llvm -c -o $@ %s" + % (extraflags, dep) + ) if m.group(2) in clippy_scan: + # again - this is only hit for targets with custom CFLAGS, because + # automake uses a generic .c -> .o rule for standard CFLAGS out_lines.append( clippyauxdep.substitute(target=m.group(1), clippybase=m.group(2)[:-2]) ) out_lines.append(line) +# now, cover all the .c files that don't have special build rules out_lines.append("# clippy{\n# main clippy targets") for clippy_file in clippy_scan: out_lines.append(clippydep.substitute(clippybase=clippy_file[:-2])) +# combine daemon .xref files into frr.xref out_lines.append("") -out_lines.append("xrefs = %s" % (" ".join(["%s.xref" % target for target in xref_targets]))) +out_lines.append( + "xrefs = %s" % (" ".join(["%s.xref" % target for target in xref_targets])) +) out_lines.append("frr.xref: $(xrefs)") out_lines.append("") -#frr.xref: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(lib_LTLIBRARIES) $(module_LTLIBRARIES) -# $(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py -o $@ $^ +# analog but slower way to get the same frr.xref +# frr.xref: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(lib_LTLIBRARIES) $(module_LTLIBRARIES) +# $(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py -o $@ $^ +# LLVM bitcode link targets creating a .bc file for whole daemon or lib out_lines.append("") out_lines.extend(bcdeps) out_lines.append("") diff --git a/tools/etc/frr/support_bundle_commands.conf b/tools/etc/frr/support_bundle_commands.conf index 46e0625d8c..ff2c633ccc 100644 --- a/tools/etc/frr/support_bundle_commands.conf +++ b/tools/etc/frr/support_bundle_commands.conf @@ -160,6 +160,7 @@ show ip igmp groups show ip igmp interface show ip igmp join show ip igmp sources +show ip igmp statistics show ip pim upstream show ip mroute show ip pim join diff --git a/tools/frr-llvm-cg.c b/tools/frr-llvm-cg.c index fbcf9222d2..8ce754fecc 100644 --- a/tools/frr-llvm-cg.c +++ b/tools/frr-llvm-cg.c @@ -561,7 +561,6 @@ static void process_call(struct json_object *js_calls, unsigned n_args = LLVMGetNumArgOperands(instr); bool is_external = LLVMIsDeclaration(called); - enum called_fn called_type = FN_GENERIC; js_call = json_object_new_object(); json_object_array_add(js_calls, js_call); @@ -570,7 +569,6 @@ static void process_call(struct json_object *js_calls, json_object_new_boolean(is_external)); if (!called_name || called_len == 0) { - called_type = FN_NONAME; json_object_object_add(js_call, "type", json_object_new_string("indirect")); @@ -653,8 +651,6 @@ static void process_call(struct json_object *js_calls, } #ifdef FRR_SPECIFIC } else if (!strcmp(called_name, "_install_element")) { - called_type = FN_INSTALL_ELEMENT; - LLVMValueRef param0 = LLVMGetOperand(instr, 0); if (!LLVMIsAConstantInt(param0)) goto out_nonconst; @@ -694,8 +690,6 @@ static void process_call(struct json_object *js_calls, json_object_new_string("install_element")); return; } else if (is_thread_sched(called_name, called_len)) { - called_type = FN_THREAD_ADD; - json_object_object_add(js_call, "type", json_object_new_string("thread_sched")); json_object_object_add( |
