diff options
44 files changed, 473 insertions, 365 deletions
diff --git a/.dockerignore b/.dockerignore index f2fc34583d..d613e18dfc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,3 +5,4 @@ **/*.lo **/*.so **/.libs +docker/alpine/pkgs diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 62d3c2350c..0000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,52 +0,0 @@ -# HOW TO GET YOUR ISSUE ADDRESSED FASTER - -* When reporting a crash provide a backtrace -* When pasting configs, logs, shell output, backtraces, and other large chunks - of text [use Markdown code blocks](https://github.github.com/gfm/#fenced-code-blocks) -* Include the FRR version; if you built from Git, please provide the commit - hash -* Write your issue in English - -### How to submit an issue -Please use this text as a template and replace text in the sections or remove -the entire section if it does not apply to your issue. For example in case of -a question or feature request, just a description with some example is probably -fine. Also remember to use GitHub Flavored Markdown properly, especially if -posting output or code listings. - -### Things you may try first -(put "x" in "[ ]" if you already tried following) -* [ ] Did you check if this is a duplicate issue? -* [ ] Did you test it on the latest FRRouting/frr master branch? - -**Related Issue:** -[fill here if applicable] - -### Description -[Description of the bug or feature] - -### Steps to Reproduce -1. [First Step] -2. [Second Step] -3. [and so on...] - -**Expected behavior:** -[What you expected to happen] - -**Actual behavior:** -[What actually happened] - -### Components -[bgpd, build, doc, isisd, ospfd, etc.] - -### Versions -* OS: [name] [version] -* Kernel: [Linux/BSD] [version] -* FRR: [version] - -### Attachments -[Attach if applicable. For example log-files, log-lines. etc. etc.] - -You're also welcomed to provide us with any other data you think may be useful. - -Thanks! diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..1209f52e14 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,43 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: triage +assignees: '' + +--- + +- When reporting a crash, provide a backtrace +- When pasting configs, logs, shell output, backtraces, and other large chunks of text use Markdown code blocks +- Include the FRR version; if you built from Git, please provide the commit hash +- Write your issue in English + +--------------- + +**Describe the bug** +A clear and concise description of what the bug is. + +(put "x" in "[ ]" if you already tried following) +[ ] Did you check if this is a duplicate issue? +[ ] Did you test it on the latest FRRouting/frr master branch? + + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Versions** + - OS Kernel: [e.g. Linux, OpenBSD, etc] [version] + - FRR Version [version] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE/pr.md index 9f44f712b1..9f44f712b1 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE/pr.md @@ -51,8 +51,9 @@ lists: | Users & Operators | frog@lists.frrouting.org | | Announcements | announce@lists.frrouting.org | -For chat, we currently use [Slack](https://frrouting.slack.com). Please email -the mailing list to request an invite as we do not issue automatic invites. +For chat, we currently use [Slack](https://frrouting.slack.com). You can join +by clicking the "Slack" link under the +[Participate](https://frrouting.org/#participate) section of our website. Contributing diff --git a/alpine/APKBUILD.in b/alpine/APKBUILD.in index 969b85f524..0f56a427dd 100644 --- a/alpine/APKBUILD.in +++ b/alpine/APKBUILD.in @@ -9,13 +9,13 @@ license="GPL-2.0" depends="json-c c-ares ipsec-tools iproute2 python py-ipaddr bash" makedepends="ncurses-dev net-snmp-dev gawk texinfo perl acct autoconf automake bash - binutils binutils-libs bison bsd-compat-headers build-base + binutils bison bsd-compat-headers build-base c-ares c-ares-dev ca-certificates cryptsetup-libs curl device-mapper-libs expat fakeroot flex fortify-headers gdbm git gmp isl json-c-dev kmod lddtree libacl libatomic libattr libblkid libburn libbz2 libc-dev libcap libcurl libedit libffi libgcc libgomp libisoburn libisofs libltdl libressl libssh2 - libstdc++ libtool libuuid linux-headers lzip lzo m4 make mkinitfs mpc1 + libstdc++ libtool libuuid libyang-dev linux-headers lzip lzo m4 make mkinitfs mpc1 mpfr3 mtools musl-dev ncurses-libs ncurses-terminfo ncurses-terminfo-base patch pax-utils pcre perl pkgconf python2 python2-dev readline readline-dev sqlite-libs squashfs-tools sudo tar texinfo xorriso xz-libs @@ -23,7 +23,7 @@ makedepends="ncurses-dev net-snmp-dev gawk texinfo perl checkdepends="pytest py-setuptools" install="$pkgname.pre-install $pkgname.pre-deinstall $pkgname.post-deinstall" subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg" -source="$pkgname-$pkgver.tar.gz docker-start daemons" +source="$pkgname-$pkgver.tar.gz" builddir="$srcdir"/$pkgname-$pkgver @@ -60,8 +60,7 @@ package() { cd "$builddir" make DESTDIR="$pkgdir" install - install -Dm755 "$srcdir"/docker-start "$pkgdir"$_sbindir - install -Dm644 "$srcdir"/daemons "$pkgdir"$_sysconfdir + install -Dm644 "$builddir"/tools/etc/frr/daemons "$pkgdir"$_sysconfdir install -d "$pkgdir"/etc/init.d ln -s ${_sbindir}/frr "$pkgdir"/etc/init.d/frr } diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 3575ba7a00..e9645824f2 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -1180,6 +1180,9 @@ const char *bs_to_string(const struct bfd_session *bs) if (bs->key.ifname[0]) pos += snprintf(buf + pos, sizeof(buf) - pos, " ifname:%s", bs->key.ifname); + + (void)pos; + return buf; } diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c index b44d13f132..8d80b9468d 100644 --- a/bfdd/ptm_adapter.c +++ b/bfdd/ptm_adapter.c @@ -613,6 +613,8 @@ static int bfdd_interface_update(int cmd, struct zclient *zc, bfdd_sessions_disable_interface(ifp); + if_set_index(ifp, IFINDEX_INTERNAL); + return 0; } diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index d211f1afff..4c4659ad54 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1488,6 +1488,97 @@ static void vpn_policy_routemap_update(struct bgp *bgp, const char *rmap_name) } } +/* This API is used during router-id change, reflect VPNs + * auto RD and RT values and readvertise routes to VPN table. + */ +void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw) +{ + afi_t afi; + int debug; + char *vname; + const char *export_name; + char buf[RD_ADDRSTRLEN]; + struct bgp *bgp_import; + struct listnode *node; + struct ecommunity *ecom; + vpn_policy_direction_t idir, edir; + + if (bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT + && bgp->inst_type != BGP_INSTANCE_TYPE_VRF) + return; + + export_name = bgp->name ? bgp->name : VRF_DEFAULT_NAME; + debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) | + BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF)); + + idir = BGP_VPN_POLICY_DIR_FROMVPN; + edir = BGP_VPN_POLICY_DIR_TOVPN; + + for (afi = 0; afi < AFI_MAX; ++afi) { + if (!vpn_leak_to_vpn_active(bgp, afi, NULL)) + continue; + + if (withdraw) { + vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, + afi, bgp_get_default(), bgp); + if (debug) + zlog_debug("%s: %s after to_vpn vpn_leak_prechange", + __func__, export_name); + + /* Remove import RT from VRFs */ + ecom = bgp->vpn_policy[afi].rtlist[edir]; + for (ALL_LIST_ELEMENTS_RO(bgp->vpn_policy[afi]. + export_vrf, node, vname)) { + bgp_import = bgp_lookup_by_name(vname); + if (!bgp_import) + continue; + + ecommunity_del_val(bgp_import->vpn_policy[afi]. + rtlist[idir], + (struct ecommunity_val *)ecom->val); + + } + } else { + /* New router-id derive auto RD and RT and export + * to VPN + */ + form_auto_rd(bgp->router_id, bgp->vrf_rd_id, + &bgp->vrf_prd_auto); + bgp->vpn_policy[afi].tovpn_rd = bgp->vrf_prd_auto; + prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd, buf, + sizeof(buf)); + bgp->vpn_policy[afi].rtlist[edir] = + ecommunity_str2com(buf, + ECOMMUNITY_ROUTE_TARGET, 0); + + /* Update import_vrf rt_list */ + ecom = bgp->vpn_policy[afi].rtlist[edir]; + for (ALL_LIST_ELEMENTS_RO(bgp->vpn_policy[afi]. + export_vrf, node, vname)) { + bgp_import = bgp_lookup_by_name(vname); + if (!bgp_import) + continue; + if (bgp_import->vpn_policy[afi].rtlist[idir]) + bgp_import->vpn_policy[afi].rtlist[idir] + = ecommunity_merge( + bgp_import->vpn_policy[afi] + .rtlist[idir], ecom); + else + bgp_import->vpn_policy[afi].rtlist[idir] + = ecommunity_dup(ecom); + + } + /* Update routes to VPN */ + vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, + afi, bgp_get_default(), + bgp); + if (debug) + zlog_debug("%s: %s after to_vpn vpn_leak_postchange", + __func__, export_name); + } + } +} + void vpn_policy_routemap_event(const char *rmap_name) { int debug = BGP_DEBUG(vpn, VPN_LEAK_RMAP_EVENT); @@ -1513,11 +1604,15 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, char buf[1000]; struct ecommunity *ecom; bool first_export = false; + int debug; export_name = to_bgp->name ? to_bgp->name : VRF_DEFAULT_NAME; idir = BGP_VPN_POLICY_DIR_FROMVPN; edir = BGP_VPN_POLICY_DIR_TOVPN; + debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) | + BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF)); + /* * Cross-ref both VRFs. Also, note if this is the first time * any VRF is importing from "import_vrf". @@ -1560,6 +1655,23 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, to_bgp->vpn_policy[afi].rtlist[idir] = ecommunity_dup(ecom); SET_FLAG(to_bgp->af_flags[afi][safi], BGP_CONFIG_VRF_TO_VRF_IMPORT); + if (debug) { + const char *from_name; + + from_name = from_bgp->name ? from_bgp->name : + VRF_DEFAULT_NAME; + zlog_debug("%s from %s to %s first_export %u import-rt %s export-rt %s", + __func__, from_name, export_name, first_export, + to_bgp->vpn_policy[afi].rtlist[idir] ? + (ecommunity_ecom2str(to_bgp->vpn_policy[afi]. + rtlist[idir], + ECOMMUNITY_FORMAT_ROUTE_MAP, 0)) : " ", + to_bgp->vpn_policy[afi].rtlist[edir] ? + (ecommunity_ecom2str(to_bgp->vpn_policy[afi]. + rtlist[edir], + ECOMMUNITY_FORMAT_ROUTE_MAP, 0)) : " "); + } + /* Does "import_vrf" first need to export its routes or that * is already done and we just need to import those routes * from the global table? @@ -1578,12 +1690,16 @@ void vrf_unimport_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, char *vname; struct ecommunity *ecom; struct listnode *node; + int debug; export_name = to_bgp->name ? to_bgp->name : VRF_DEFAULT_NAME; tmp_name = from_bgp->name ? from_bgp->name : VRF_DEFAULT_NAME; idir = BGP_VPN_POLICY_DIR_FROMVPN; edir = BGP_VPN_POLICY_DIR_TOVPN; + debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) | + BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF)); + /* Were we importing from "import_vrf"? */ for (ALL_LIST_ELEMENTS_RO(to_bgp->vpn_policy[afi].import_vrf, node, vname)) { @@ -1601,6 +1717,9 @@ void vrf_unimport_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, if (!vname) return; + if (debug) + zlog_debug("%s from %s to %s", __func__, tmp_name, export_name); + /* Remove "import_vrf" from our import list. */ listnode_delete(to_bgp->vpn_policy[afi].import_vrf, vname); XFREE(MTYPE_TMP, vname); diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 2ef9570aac..1526a8111e 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -264,5 +264,6 @@ extern void vpn_policy_routemap_event(const char *rmap_name); extern vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey); extern void vpn_leak_postchange_all(void); +extern void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw); #endif /* _QUAGGA_BGP_MPLSVPN_H */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index eca632dd44..ad9d22a7a5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -10225,40 +10225,20 @@ ravg_tally (unsigned long count, unsigned long oldavg, unsigned long newval) } #endif -static int bgp_table_stats_walker(struct thread *t) +static void bgp_table_stats_rn(struct bgp_node *rn, struct bgp_node *top, + struct bgp_table_stats *ts, unsigned int space) { - struct bgp_node *rn; - struct bgp_node *top; - struct bgp_table_stats *ts = THREAD_ARG(t); - unsigned int space = 0; - - if (!(top = bgp_table_top(ts->table))) - return 0; - - switch (top->p.family) { - case AF_INET: - space = IPV4_MAX_BITLEN; - break; - case AF_INET6: - space = IPV6_MAX_BITLEN; - break; - } - - ts->counts[BGP_STATS_MAXBITLEN] = space; - - for (rn = top; rn; rn = bgp_route_next(rn)) { - struct bgp_path_info *pi; - struct bgp_node *prn = bgp_node_parent_nolock(rn); - unsigned int pinum = 0; + struct bgp_node *prn = bgp_node_parent_nolock(rn); + struct bgp_path_info *pi; - if (rn == top) - continue; + if (rn == top) + return; - if (!bgp_node_has_bgp_path_info_data(rn)) - continue; + if (!bgp_node_has_bgp_path_info_data(rn)) + return; - ts->counts[BGP_STATS_PREFIXES]++; - ts->counts[BGP_STATS_TOTPLEN] += rn->p.prefixlen; + ts->counts[BGP_STATS_PREFIXES]++; + ts->counts[BGP_STATS_TOTPLEN] += rn->p.prefixlen; #if 0 ts->counts[BGP_STATS_AVGPLEN] @@ -10267,49 +10247,43 @@ static int bgp_table_stats_walker(struct thread *t) rn->p.prefixlen); #endif - /* check if the prefix is included by any other announcements */ - while (prn && !bgp_node_has_bgp_path_info_data(prn)) - prn = bgp_node_parent_nolock(prn); + /* check if the prefix is included by any other announcements */ + while (prn && !bgp_node_has_bgp_path_info_data(prn)) + prn = bgp_node_parent_nolock(prn); - if (prn == NULL || prn == top) { - ts->counts[BGP_STATS_UNAGGREGATEABLE]++; - /* announced address space */ - if (space) - ts->total_space += - pow(2.0, space - rn->p.prefixlen); - } else if (bgp_node_has_bgp_path_info_data(prn)) - ts->counts[BGP_STATS_MAX_AGGREGATEABLE]++; + if (prn == NULL || prn == top) { + ts->counts[BGP_STATS_UNAGGREGATEABLE]++; + /* announced address space */ + if (space) + ts->total_space += pow(2.0, space - rn->p.prefixlen); + } else if (bgp_node_has_bgp_path_info_data(prn)) + ts->counts[BGP_STATS_MAX_AGGREGATEABLE]++; - for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) { - pinum++; - ts->counts[BGP_STATS_RIB]++; - - if (pi->attr - && (CHECK_FLAG(pi->attr->flag, - ATTR_FLAG_BIT( - BGP_ATTR_ATOMIC_AGGREGATE)))) - ts->counts[BGP_STATS_AGGREGATES]++; - - /* as-path stats */ - if (pi->attr && pi->attr->aspath) { - unsigned int hops = - aspath_count_hops(pi->attr->aspath); - unsigned int size = - aspath_size(pi->attr->aspath); - as_t highest = aspath_highest(pi->attr->aspath); - - ts->counts[BGP_STATS_ASPATH_COUNT]++; - - if (hops > ts->counts[BGP_STATS_ASPATH_MAXHOPS]) - ts->counts[BGP_STATS_ASPATH_MAXHOPS] = - hops; - - if (size > ts->counts[BGP_STATS_ASPATH_MAXSIZE]) - ts->counts[BGP_STATS_ASPATH_MAXSIZE] = - size; - - ts->counts[BGP_STATS_ASPATH_TOTHOPS] += hops; - ts->counts[BGP_STATS_ASPATH_TOTSIZE] += size; + + for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) { + ts->counts[BGP_STATS_RIB]++; + + if (pi->attr + && (CHECK_FLAG(pi->attr->flag, + ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE)))) + ts->counts[BGP_STATS_AGGREGATES]++; + + /* as-path stats */ + if (pi->attr && pi->attr->aspath) { + unsigned int hops = aspath_count_hops(pi->attr->aspath); + unsigned int size = aspath_size(pi->attr->aspath); + as_t highest = aspath_highest(pi->attr->aspath); + + ts->counts[BGP_STATS_ASPATH_COUNT]++; + + if (hops > ts->counts[BGP_STATS_ASPATH_MAXHOPS]) + ts->counts[BGP_STATS_ASPATH_MAXHOPS] = hops; + + if (size > ts->counts[BGP_STATS_ASPATH_MAXSIZE]) + ts->counts[BGP_STATS_ASPATH_MAXSIZE] = size; + + ts->counts[BGP_STATS_ASPATH_TOTHOPS] += hops; + ts->counts[BGP_STATS_ASPATH_TOTSIZE] += size; #if 0 ts->counts[BGP_STATS_ASPATH_AVGHOPS] = ravg_tally (ts->counts[BGP_STATS_ASPATH_COUNT], @@ -10320,12 +10294,52 @@ static int bgp_table_stats_walker(struct thread *t) ts->counts[BGP_STATS_ASPATH_AVGSIZE], size); #endif - if (highest > ts->counts[BGP_STATS_ASN_HIGHEST]) - ts->counts[BGP_STATS_ASN_HIGHEST] = - highest; - } + if (highest > ts->counts[BGP_STATS_ASN_HIGHEST]) + ts->counts[BGP_STATS_ASN_HIGHEST] = highest; } } +} + +static int bgp_table_stats_walker(struct thread *t) +{ + struct bgp_node *rn, *nrn; + struct bgp_node *top; + struct bgp_table_stats *ts = THREAD_ARG(t); + unsigned int space = 0; + + if (!(top = bgp_table_top(ts->table))) + return 0; + + switch (ts->table->afi) { + case AFI_IP: + space = IPV4_MAX_BITLEN; + break; + case AFI_IP6: + space = IPV6_MAX_BITLEN; + break; + default: + return 0; + } + + ts->counts[BGP_STATS_MAXBITLEN] = space; + + for (rn = top; rn; rn = bgp_route_next(rn)) { + if (ts->table->safi == SAFI_MPLS_VPN) { + struct bgp_table *table; + + table = bgp_node_get_bgp_table_info(rn); + if (!table) + continue; + + top = bgp_table_top(table); + for (nrn = bgp_table_top(table); nrn; + nrn = bgp_route_next(nrn)) + bgp_table_stats_rn(nrn, top, ts, space); + } else { + bgp_table_stats_rn(rn, top, ts, space); + } + } + return 0; } @@ -10774,7 +10788,11 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi, return; } - table = bgp->rib[afi][safi]; + /* labeled-unicast routes live in the unicast table */ + if (safi == SAFI_LABELED_UNICAST) + table = bgp->rib[afi][SAFI_UNICAST]; + else + table = bgp->rib[afi][safi]; output_count = filtered_count = 0; subgrp = peer_subgroup(peer, afi, safi); @@ -11028,10 +11046,6 @@ static int peer_adj_routes(struct vty *vty, struct peer *peer, afi_t afi, if (use_json) json = json_object_new_object(); - /* labeled-unicast routes live in the unicast table */ - if (safi == SAFI_LABELED_UNICAST) - safi = SAFI_UNICAST; - if (!peer || !peer->afc[afi][safi]) { if (use_json) { json_object_string_add( diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5350ebeec7..9004926dee 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -771,19 +771,23 @@ static int bgp_clear_vty(struct vty *vty, const char *name, afi_t afi, /* clear soft inbound */ static void bgp_clear_star_soft_in(struct vty *vty, const char *name) { - bgp_clear_vty(vty, name, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); - bgp_clear_vty(vty, name, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); + afi_t afi; + safi_t safi; + + FOREACH_AFI_SAFI (afi, safi) + bgp_clear_vty(vty, name, afi, safi, clear_all, + BGP_CLEAR_SOFT_IN, NULL); } /* clear soft outbound */ static void bgp_clear_star_soft_out(struct vty *vty, const char *name) { - bgp_clear_vty(vty, name, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); - bgp_clear_vty(vty, name, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); + afi_t afi; + safi_t safi; + + FOREACH_AFI_SAFI (afi, safi) + bgp_clear_vty(vty, name, afi, safi, clear_all, + BGP_CLEAR_SOFT_OUT, NULL); } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 54e8f5f369..298418b113 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -253,6 +253,8 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id) if (is_evpn_enabled()) bgp_evpn_handle_router_id_update(bgp, TRUE); + vpn_handle_router_id_update(bgp, TRUE); + IPV4_ADDR_COPY(&bgp->router_id, id); /* Set all peer's local identifier with this value. */ @@ -270,6 +272,8 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id) if (is_evpn_enabled()) bgp_evpn_handle_router_id_update(bgp, FALSE); + vpn_handle_router_id_update(bgp, FALSE); + return 0; } diff --git a/doc/developer/building-frr-for-centos6.rst b/doc/developer/building-frr-for-centos6.rst index 732959212e..f1ec2ad3ea 100644 --- a/doc/developer/building-frr-for-centos6.rst +++ b/doc/developer/building-frr-for-centos6.rst @@ -43,7 +43,7 @@ Add packages: .. code-block:: shell - sudo yum install git autoconf automake libtool make gawk \ + sudo yum install git autoconf automake libtool make \ readline-devel texinfo net-snmp-devel groff pkgconfig \ json-c-devel pam-devel flex epel-release c-ares-devel diff --git a/doc/developer/building-frr-for-centos7.rst b/doc/developer/building-frr-for-centos7.rst index 89445408bd..ea3c44478c 100644 --- a/doc/developer/building-frr-for-centos7.rst +++ b/doc/developer/building-frr-for-centos7.rst @@ -18,7 +18,7 @@ Add packages: :: - sudo yum install git autoconf automake libtool make gawk \ + sudo yum install git autoconf automake libtool make \ readline-devel texinfo net-snmp-devel groff pkgconfig \ json-c-devel pam-devel bison flex pytest c-ares-devel \ python-devel systemd-devel python-sphinx diff --git a/doc/developer/building-frr-for-debian8.rst b/doc/developer/building-frr-for-debian8.rst index d0f4182bae..9c6e48a6f8 100644 --- a/doc/developer/building-frr-for-debian8.rst +++ b/doc/developer/building-frr-for-debian8.rst @@ -15,7 +15,7 @@ Add packages: :: - sudo apt-get install git autoconf automake libtool make gawk \ + sudo apt-get install git autoconf automake libtool make \ libreadline-dev texinfo libjson-c-dev pkg-config bison flex python-pip \ libc-ares-dev python3-dev python3-sphinx build-essential libsystemd-dev diff --git a/doc/developer/building-frr-for-fedora.rst b/doc/developer/building-frr-for-fedora.rst index 6900aed0e0..204c185f56 100644 --- a/doc/developer/building-frr-for-fedora.rst +++ b/doc/developer/building-frr-for-fedora.rst @@ -11,7 +11,7 @@ Installing Dependencies .. code-block:: console - sudo dnf install git autoconf automake libtool make gawk \ + sudo dnf install git autoconf automake libtool make \ readline-devel texinfo net-snmp-devel groff pkgconfig json-c-devel \ pam-devel pytest bison flex c-ares-devel python3-devel python2-sphinx \ perl-core patch diff --git a/doc/developer/building-frr-for-freebsd10.rst b/doc/developer/building-frr-for-freebsd10.rst index 5d0a7f6cbb..86c44f4d90 100644 --- a/doc/developer/building-frr-for-freebsd10.rst +++ b/doc/developer/building-frr-for-freebsd10.rst @@ -16,7 +16,7 @@ is first package install and asked) :: - pkg install git autoconf automake libtool gmake gawk json-c pkgconf \ + pkg install git autoconf automake libtool gmake json-c pkgconf \ bison flex py27-pytest c-ares python3 py-sphinx Make sure there is no /usr/bin/flex preinstalled (and use the newly diff --git a/doc/developer/building-frr-for-freebsd11.rst b/doc/developer/building-frr-for-freebsd11.rst index c85255e6ee..5e56c8cd7a 100644 --- a/doc/developer/building-frr-for-freebsd11.rst +++ b/doc/developer/building-frr-for-freebsd11.rst @@ -16,7 +16,7 @@ is first package install and asked) .. code-block:: shell - pkg install git autoconf automake libtool gmake gawk json-c pkgconf \ + pkg install git autoconf automake libtool gmake json-c pkgconf \ bison flex py27-pytest c-ares python3 py36-sphinx texinfo Make sure there is no /usr/bin/flex preinstalled (and use the newly diff --git a/doc/developer/building-frr-for-freebsd9.rst b/doc/developer/building-frr-for-freebsd9.rst index 4009f1b8d3..59241d1d13 100644 --- a/doc/developer/building-frr-for-freebsd9.rst +++ b/doc/developer/building-frr-for-freebsd9.rst @@ -16,9 +16,9 @@ is first package install and asked) :: - pkg install -y git autoconf automake libtool gmake gawk \ + pkg install -y git autoconf automake libtool gmake \ pkgconf texinfo json-c bison flex py27-pytest c-ares \ - python3 py-sphinx + python3 py-sphinx libexecinfo Make sure there is no /usr/bin/flex preinstalled (and use the newly installed in /usr/local/bin): (FreeBSD frequently provides a older flex diff --git a/doc/developer/building-frr-for-netbsd6.rst b/doc/developer/building-frr-for-netbsd6.rst index a042077fd0..49091c49b4 100644 --- a/doc/developer/building-frr-for-netbsd6.rst +++ b/doc/developer/building-frr-for-netbsd6.rst @@ -22,7 +22,7 @@ Add packages: :: - sudo pkg_add git autoconf automake libtool gmake gawk openssl \ + sudo pkg_add git autoconf automake libtool gmake openssl \ pkg-config json-c python27 py27-test python35 py-sphinx Install SSL Root Certificates (for git https access): diff --git a/doc/developer/building-frr-for-netbsd7.rst b/doc/developer/building-frr-for-netbsd7.rst index b65891916c..64c462a5c8 100644 --- a/doc/developer/building-frr-for-netbsd7.rst +++ b/doc/developer/building-frr-for-netbsd7.rst @@ -13,7 +13,7 @@ Install required packages :: - sudo pkgin install git autoconf automake libtool gmake gawk openssl \ + sudo pkgin install git autoconf automake libtool gmake openssl \ pkg-config json-c python27 py27-test python35 py-sphinx Install SSL Root Certificates (for git https access): diff --git a/doc/developer/building-frr-for-omnios.rst b/doc/developer/building-frr-for-omnios.rst index 416c89c667..ffc7a078e5 100644 --- a/doc/developer/building-frr-for-omnios.rst +++ b/doc/developer/building-frr-for-omnios.rst @@ -37,7 +37,7 @@ Add packages: library/idnkit/header-idnkit \ system/header \ system/library/math/header-math \ - git libtool gawk pkg-config + git libtool pkg-config Add additional Solaris packages: diff --git a/doc/developer/building-frr-for-openbsd6.rst b/doc/developer/building-frr-for-openbsd6.rst index 0f8d4d0f25..f307cacdfc 100644 --- a/doc/developer/building-frr-for-openbsd6.rst +++ b/doc/developer/building-frr-for-openbsd6.rst @@ -15,7 +15,7 @@ Add packages: :: pkg_add git autoconf-2.69p2 automake-1.15.1 libtool bison - pkg_add gmake gawk dejagnu openssl json-c py-test py-sphinx + pkg_add gmake json-c py-test py-sphinx libexecinfo Select Python2.7 as default (required for pytest) diff --git a/doc/developer/building-frr-for-openwrt.rst b/doc/developer/building-frr-for-openwrt.rst index 8f72ab5d9d..5d8f82f27e 100644 --- a/doc/developer/building-frr-for-openwrt.rst +++ b/doc/developer/building-frr-for-openwrt.rst @@ -9,7 +9,7 @@ For Debian based distributions, run: :: sudo apt-get install git build-essential libssl-dev libncurses5-dev \ - unzip gawk zlib1g-dev subversion mercurial + unzip zlib1g-dev subversion mercurial For other environments, instructions can be found in the `official documentation diff --git a/doc/developer/building-frr-for-ubuntu1404.rst b/doc/developer/building-frr-for-ubuntu1404.rst index 0942f19737..6e2765c1c8 100644 --- a/doc/developer/building-frr-for-ubuntu1404.rst +++ b/doc/developer/building-frr-for-ubuntu1404.rst @@ -11,7 +11,7 @@ Installing Dependencies apt-get update apt-get install \ - git autoconf automake libtool make gawk libreadline-dev texinfo \ + git autoconf automake libtool make libreadline-dev texinfo \ pkg-config libpam0g-dev libjson-c-dev bison flex python-pytest \ libc-ares-dev python3-dev python3-sphinx install-info build-essential \ libsnmp-dev perl diff --git a/doc/developer/building-frr-for-ubuntu1604.rst b/doc/developer/building-frr-for-ubuntu1604.rst index 63cb9aa13a..a9a0a2f733 100644 --- a/doc/developer/building-frr-for-ubuntu1604.rst +++ b/doc/developer/building-frr-for-ubuntu1604.rst @@ -11,7 +11,7 @@ Installing Dependencies apt-get update apt-get install \ - git autoconf automake libtool make gawk libreadline-dev texinfo \ + git autoconf automake libtool make libreadline-dev texinfo \ pkg-config libpam0g-dev libjson-c-dev bison flex python-pytest \ libc-ares-dev python3-dev libsystemd-dev python-ipaddress python3-sphinx \ install-info build-essential libsystemd-dev libsnmp-dev perl diff --git a/doc/developer/building-frr-for-ubuntu1804.rst b/doc/developer/building-frr-for-ubuntu1804.rst index 6f7f0acd11..1320bda577 100644 --- a/doc/developer/building-frr-for-ubuntu1804.rst +++ b/doc/developer/building-frr-for-ubuntu1804.rst @@ -11,7 +11,7 @@ Installing Dependencies sudo apt update sudo apt-get install \ - git autoconf automake libtool make gawk libreadline-dev texinfo \ + git autoconf automake libtool make libreadline-dev texinfo \ pkg-config libpam0g-dev libjson-c-dev bison flex python-pytest \ libc-ares-dev python3-dev libsystemd-dev python-ipaddress python3-sphinx \ install-info build-essential libsystemd-dev libsnmp-dev perl diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index dd29358b07..815983a394 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -1,35 +1,58 @@ -FROM alpine:3.7 as source-builder -ARG commit -RUN apk add --no-cache abuild acct alpine-sdk attr autoconf automake bash \ - binutils binutils-libs bison bsd-compat-headers build-base \ - c-ares c-ares-dev ca-certificates cryptsetup-libs curl \ - device-mapper-libs expat fakeroot flex fortify-headers g++ gcc gdbm \ - git gmp isl json-c json-c-dev kmod lddtree libacl libatomic libattr \ - libblkid libburn libbz2 libc-dev libcap libcurl libedit libffi libgcc \ - libgomp libisoburn libisofs libltdl libressl libssh2 \ - libstdc++ libtool libuuid linux-headers lzip lzo m4 make mkinitfs mpc1 \ - mpfr3 mtools musl-dev ncurses-libs ncurses-terminfo ncurses-terminfo-base \ - patch pax-utils pcre perl pkgconf python2 python2-dev readline \ - readline-dev sqlite-libs squashfs-tools sudo tar texinfo xorriso xz-libs \ - groff gzip bc py-sphinx -ADD . /src -RUN (cd /src && \ - ./bootstrap.sh && \ - ./configure \ +# This stage builds a dist tarball from the source +FROM alpine:edge as source-builder + +RUN mkdir -p /src/alpine +COPY alpine/APKBUILD.in /src/alpine +RUN source /src/alpine/APKBUILD.in \ + && echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ + && apk add \ + --no-cache \ + --update-cache \ + $makedepends \ + gzip + +COPY . /src +ARG PKGVER +RUN cd /src \ + && ./bootstrap.sh \ + && ./configure \ --enable-numeric-version \ - --with-pkg-extra-version=_git$commit && \ - make dist) -FROM alpine:3.7 as alpine-builder -RUN apk add --no-cache abuild alpine-sdk && mkdir -p /pkgs/apk -ADD docker/alpine/alpine-build.sh /usr/bin/ -ADD docker/alpine/builder /etc/sudoers.d -COPY --from=source-builder /src/*.tar.gz /src/alpine/* /src/tools/etc/frr/daemons* /dist/ + --with-pkg-extra-version="_git$PKGVER" \ + && make dist + +# This stage builds an apk from the dist tarball +FROM alpine:edge as alpine-builder +# Don't use nocache here so that abuild can use the cache +RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ + && apk add \ + --update-cache \ + abuild \ + alpine-conf \ + alpine-sdk \ + && setup-apkcache /var/cache/apk \ + && mkdir -p /pkgs/apk \ + && echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +COPY --from=source-builder /src/frr-*.tar.gz /src/alpine/* /dist/ RUN adduser -D -G abuild builder && chown -R builder /dist /pkgs USER builder -RUN /usr/bin/alpine-build.sh -FROM alpine:3.7 +RUN cd /dist \ + && abuild-keygen -a -n \ + && abuild checksum \ + && abuild -r -P /pkgs/apk + +# This stage installs frr from the apk +FROM alpine:edge RUN mkdir -p /pkgs/apk COPY --from=alpine-builder /pkgs/apk/ /pkgs/apk/ -RUN apk add --no-cache tini -RUN apk add --no-cache --allow-untrusted /pkgs/apk/x86_64/*.apk +RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ + && apk add \ + --no-cache \ + --update-cache \ + tini \ + && apk add \ + --no-cache \ + --allow-untrusted /pkgs/apk/*/*.apk \ + && rm -rf /pkgs +COPY docker/alpine/docker-start /usr/lib/frr/docker-start ENTRYPOINT [ "/sbin/tini", "--", "/usr/lib/frr/docker-start" ] diff --git a/docker/alpine/alpine-build.sh b/docker/alpine/alpine-build.sh deleted file mode 100755 index d4c0311122..0000000000 --- a/docker/alpine/alpine-build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e - -cd /dist - -sudo apk --update add alpine-conf -sudo setup-apkcache /var/cache/apk -abuild-keygen -a -n -abuild checksum -abuild -r -P /pkgs/apk diff --git a/docker/alpine/build.sh b/docker/alpine/build.sh index 40ed1194fe..22a36877c0 100755 --- a/docker/alpine/build.sh +++ b/docker/alpine/build.sh @@ -1,17 +1,30 @@ #!/bin/sh set -e -set -v set -x ## -# commit must be converted to decimal +# Package version needs to be decimal ## -c=`git rev-parse --short=10 HEAD` -commit=`printf '%u\n' 0x$c` -docker build -f docker/alpine/Dockerfile \ - --build-arg commit=$commit -t frr:alpine-$c . -id=`docker create frr:alpine-$c` -docker cp ${id}:/pkgs/ docker -docker rm $id -docker rmi frr:alpine-$c +GITREV="$(git rev-parse --short=10 HEAD)" +PKGVER="$(printf '%u\n' 0x$GITREV)" + +docker build \ + --pull \ + --file=docker/alpine/Dockerfile \ + --build-arg="PKGVER=$PKGVER" \ + --tag="frr:alpine-builder-$GITREV" \ + --target=alpine-builder \ + . + +CONTAINER_ID="$(docker create "frr:alpine-builder-$GITREV")" +docker cp "${CONTAINER_ID}:/pkgs/" docker/alpine +docker rm "${CONTAINER_ID}" + +docker build \ + --file=docker/alpine/Dockerfile \ + --build-arg="PKGVER=$PKGVER" \ + --tag="frr:alpine-$GITREV" \ + . + +docker rmi "frr:alpine-builder-$GITREV" diff --git a/docker/alpine/builder b/docker/alpine/builder deleted file mode 100644 index a950b8abaf..0000000000 --- a/docker/alpine/builder +++ /dev/null @@ -1 +0,0 @@ -builder ALL=(ALL) NOPASSWD:ALL diff --git a/alpine/docker-start b/docker/alpine/docker-start index 43854ab142..52cfb664ce 100755 --- a/alpine/docker-start +++ b/docker/alpine/docker-start @@ -6,5 +6,7 @@ set -e # For volume mounts... ## chown -R frr:frr /etc/frr -/etc/init.d/frr start -exec sleep 10000d +/usr/lib/frr/frrinit.sh start + +# Sleep forever +exec tail -f /dev/null diff --git a/lib/zclient.c b/lib/zclient.c index 7b94f1d907..3e26cd9e6c 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -414,6 +414,9 @@ void zclient_send_reg_requests(struct zclient *zclient, vrf_id_t vrf_id) /* We need router-id information. */ zebra_message_send(zclient, ZEBRA_ROUTER_ID_ADD, vrf_id); + /* We need interface information. */ + zebra_message_send(zclient, ZEBRA_INTERFACE_ADD, vrf_id); + /* Set unwanted redistribute route. */ for (afi = AFI_IP; afi < AFI_MAX; afi++) vrf_bitmap_set(zclient->redist[afi][zclient->redist_default], @@ -478,6 +481,8 @@ void zclient_send_dereg_requests(struct zclient *zclient, vrf_id_t vrf_id) /* We need router-id information. */ zebra_message_send(zclient, ZEBRA_ROUTER_ID_DELETE, vrf_id); + zebra_message_send(zclient, ZEBRA_INTERFACE_DELETE, vrf_id); + /* Set unwanted redistribute route. */ for (afi = AFI_IP; afi < AFI_MAX; afi++) vrf_bitmap_unset(zclient->redist[afi][zclient->redist_default], diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c index ccca100db5..b33eaa0478 100644 --- a/nhrpd/nhrp_interface.c +++ b/nhrpd/nhrp_interface.c @@ -327,9 +327,11 @@ int nhrp_interface_delete(int cmd, struct zclient *client, zebra_size_t length, return 0; debugf(NHRP_DEBUG_IF, "if-delete: %s", ifp->name); - if_set_index(ifp, ifp->ifindex); + nhrp_interface_update(ifp); - /* if_delete(ifp); */ + + if_set_index(ifp, IFINDEX_INTERNAL); + return 0; } diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index f058b7adbf..f9140802fb 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -198,7 +198,7 @@ static void pim_show_assert_helper(struct vty *vty, pim_time_uptime(uptime, sizeof(uptime), now - ch->ifassert_creation); pim_time_timer_to_mmss(timer, sizeof(timer), ch->t_ifassert_timer); - vty_out(vty, "%-9s %-15s %-15s %-15s %-6s %-15s %-8s %-5s\n", + vty_out(vty, "%-16s %-15s %-15s %-15s %-6s %-15s %-8s %-5s\n", ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str, pim_ifchannel_ifassert_name(ch->ifassert_state), winner_str, uptime, timer); @@ -214,7 +214,7 @@ static void pim_show_assert(struct pim_instance *pim, struct vty *vty) now = pim_time_monotonic_sec(); vty_out(vty, - "Interface Address Source Group State Winner Uptime Timer\n"); + "Interface Address Source Group State Winner Uptime Timer\n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { pim_ifp = ifp->info; @@ -239,7 +239,7 @@ static void pim_show_assert_internal_helper(struct vty *vty, pim_inet4_dump("<ch_src?>", ch->sg.src, ch_src_str, sizeof(ch_src_str)); pim_inet4_dump("<ch_grp?>", ch->sg.grp, ch_grp_str, sizeof(ch_grp_str)); - vty_out(vty, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s\n", + vty_out(vty, "%-16s %-15s %-15s %-15s %-3s %-3s %-3s %-4s\n", ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str, PIM_IF_FLAG_TEST_COULD_ASSERT(ch->flags) ? "yes" : "no", pim_macro_ch_could_assert_eval(ch) ? "yes" : "no", @@ -261,7 +261,7 @@ static void pim_show_assert_internal(struct pim_instance *pim, struct vty *vty) "eATD: Evaluate AssertTrackingDesired\n\n"); vty_out(vty, - "Interface Address Source Group CA eCA ATD eATD\n"); + "Interface Address Source Group CA eCA ATD eATD\n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { pim_ifp = ifp->info; if (!pim_ifp) @@ -292,7 +292,7 @@ static void pim_show_assert_metric_helper(struct vty *vty, pim_inet4_dump("<ch_grp?>", ch->sg.grp, ch_grp_str, sizeof(ch_grp_str)); pim_inet4_dump("<addr?>", am.ip_address, addr_str, sizeof(addr_str)); - vty_out(vty, "%-9s %-15s %-15s %-15s %-3s %4u %6u %-15s\n", + vty_out(vty, "%-16s %-15s %-15s %-15s %-3s %4u %6u %-15s\n", ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str, am.rpt_bit_flag ? "yes" : "no", am.metric_preference, am.route_metric, addr_str); @@ -305,7 +305,7 @@ static void pim_show_assert_metric(struct pim_instance *pim, struct vty *vty) struct interface *ifp; vty_out(vty, - "Interface Address Source Group RPT Pref Metric Address \n"); + "Interface Address Source Group RPT Pref Metric Address \n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { pim_ifp = ifp->info; @@ -349,7 +349,7 @@ static void pim_show_assert_winner_metric_helper(struct vty *vty, else snprintf(metr_str, sizeof(metr_str), "%6u", am->route_metric); - vty_out(vty, "%-9s %-15s %-15s %-15s %-3s %-4s %-6s %-15s\n", + vty_out(vty, "%-16s %-15s %-15s %-15s %-3s %-4s %-6s %-15s\n", ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str, am->rpt_bit_flag ? "yes" : "no", pref_str, metr_str, addr_str); } @@ -362,7 +362,7 @@ static void pim_show_assert_winner_metric(struct pim_instance *pim, struct interface *ifp; vty_out(vty, - "Interface Address Source Group RPT Pref Metric Address \n"); + "Interface Address Source Group RPT Pref Metric Address \n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { pim_ifp = ifp->info; @@ -462,7 +462,7 @@ static void pim_show_membership(struct pim_instance *pim, struct vty *vty, json, JSON_C_TO_STRING_PRETTY)); } else { vty_out(vty, - "Interface Address Source Group Membership\n"); + "Interface Address Source Group Membership\n"); /* * Example of the json data we are traversing @@ -499,7 +499,7 @@ static void pim_show_membership(struct pim_instance *pim, struct vty *vty, type = json_object_get_type(if_field_val); if (type == json_type_object) { - vty_out(vty, "%-9s ", key); + vty_out(vty, "%-16s ", key); json_object_object_get_ex( val, "address", &json_tmp); @@ -566,7 +566,7 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, json = json_object_new_object(); else vty_out(vty, - "Interface State Address V Querier Query Timer Uptime\n"); + "Interface State Address V Querier Query Timer Uptime\n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { struct pim_interface *pim_ifp; @@ -614,7 +614,7 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, } } else { vty_out(vty, - "%-9s %5s %15s %d %7s %11s %8s\n", + "%-16s %5s %15s %d %7s %11s %8s\n", ifp->name, if_is_up(ifp) ? (igmp->mtrace_only ? "mtrc" @@ -854,7 +854,7 @@ static void igmp_show_interface_join(struct pim_instance *pim, struct vty *vty) now = pim_time_monotonic_sec(); vty_out(vty, - "Interface Address Source Group Socket Uptime \n"); + "Interface Address Source Group Socket Uptime \n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { struct pim_interface *pim_ifp; @@ -888,7 +888,7 @@ static void igmp_show_interface_join(struct pim_instance *pim, struct vty *vty) pim_inet4_dump("<src?>", ij->source_addr, source_str, sizeof(source_str)); - vty_out(vty, "%-9s %-15s %-15s %-15s %6d %8s\n", + vty_out(vty, "%-16s %-15s %-15s %-15s %6d %8s\n", ifp->name, pri_addr_str, source_str, group_str, ij->sock_fd, uptime); } /* for (pim_ifp->igmp_join_list) */ @@ -1421,11 +1421,11 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, json, JSON_C_TO_STRING_PRETTY)); } else { vty_out(vty, - "Interface State Address PIM Nbrs PIM DR FHR IfChannels\n"); + "Interface State Address PIM Nbrs PIM DR FHR IfChannels\n"); json_object_object_foreach(json, key, val) { - vty_out(vty, "%-9s ", key); + vty_out(vty, "%-16s ", key); json_object_object_get_ex(val, "state", &json_tmp); vty_out(vty, "%5s ", json_object_get_string(json_tmp)); @@ -1474,12 +1474,13 @@ static void pim_show_interface_traffic(struct pim_instance *pim, json = json_object_new_object(); else { vty_out(vty, "\n"); - vty_out(vty, "%-12s%-17s%-17s%-17s%-17s%-17s%-17s\n", - "Interface", " HELLO", " JOIN", " PRUNE", - " REGISTER", " REGISTER-STOP", " ASSERT"); - vty_out(vty, "%-10s%-18s%-17s%-17s%-17s%-17s%-17s\n", "", - " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx", - " Rx/Tx", " Rx/Tx"); + vty_out(vty, "%-16s%-17s%-17s%-17s%-17s%-17s%-17s\n", + "Interface", " HELLO", " JOIN", + " PRUNE", " REGISTER", "REGISTER-STOP", + " ASSERT"); + vty_out(vty, "%-16s%-17s%-17s%-17s%-17s%-17s%-17s\n", "", + " Rx/Tx", " Rx/Tx", " Rx/Tx", + " Rx/Tx", " Rx/Tx", " Rx/Tx"); vty_out(vty, "---------------------------------------------------------------------------------------------------------------\n"); } @@ -1519,7 +1520,7 @@ static void pim_show_interface_traffic(struct pim_instance *pim, json_object_object_add(json, ifp->name, json_row); } else { vty_out(vty, - "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u \n", + "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u \n", ifp->name, pim_ifp->pim_ifstat_hello_recv, pim_ifp->pim_ifstat_hello_sent, pim_ifp->pim_ifstat_join_recv, @@ -1555,14 +1556,14 @@ static void pim_show_interface_traffic_single(struct pim_instance *pim, json = json_object_new_object(); else { vty_out(vty, "\n"); - vty_out(vty, "%-12s%-17s%-17s%-17s%-17s%-17s%-17s\n", + vty_out(vty, "%-16s%-17s%-17s%-17s%-17s%-17s%-17s\n", "Interface", " HELLO", " JOIN", " PRUNE", " REGISTER", " REGISTER-STOP", " ASSERT"); - vty_out(vty, "%-10s%-18s%-17s%-17s%-17s%-17s%-17s\n", "", + vty_out(vty, "%-14s%-18s%-17s%-17s%-17s%-17s%-17s\n", "", " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx"); vty_out(vty, - "---------------------------------------------------------------------------------------------------------------\n"); + "---------------------------------------------------------------------------------------------------------------------\n"); } FOR_ALL_INTERFACES (pim->vrf, ifp) { @@ -1605,7 +1606,7 @@ static void pim_show_interface_traffic_single(struct pim_instance *pim, json_object_object_add(json, ifp->name, json_row); } else { vty_out(vty, - "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u \n", + "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u \n", ifp->name, pim_ifp->pim_ifstat_hello_recv, pim_ifp->pim_ifstat_hello_sent, pim_ifp->pim_ifstat_join_recv, @@ -1687,7 +1688,7 @@ static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp, } else json_object_object_add(json_grp, ch_src_str, json_row); } else { - vty_out(vty, "%-9s %-15s %-15s %-15s %-10s %8s %-6s %5s\n", + vty_out(vty, "%-16s %-15s %-15s %-15s %-10s %8s %-6s %5s\n", ch->interface->name, inet_ntoa(ifaddr), ch_src_str, ch_grp_str, pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags), @@ -1709,7 +1710,7 @@ static void pim_show_join(struct pim_instance *pim, struct vty *vty, bool uj) json = json_object_new_object(); else vty_out(vty, - "Interface Address Source Group State Uptime Expire Prune\n"); + "Interface Address Source Group State Uptime Expire Prune\n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { pim_ifp = ifp->info; @@ -1957,7 +1958,7 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, vty_out(vty, "Codes: J -> Pim Join, I -> IGMP Report, S -> Source, * -> Inherited from (*,G)"); vty_out(vty, - "\nInstalled Source Group IIF OIL\n"); + "\nInstalled Source Group IIF OIL\n"); } for (ALL_LIST_ELEMENTS_RO(pim->channel_oil_list, node, c_oil)) { @@ -2040,9 +2041,8 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, c_oil->cc.wrong_if); } } else { - vty_out(vty, "%-9d %-15s %-15s %-7s ", - c_oil->installed, src_str, grp_str, - in_ifname); + vty_out(vty, "%-9d %-15s %-15s %-16s ", + c_oil->installed, src_str, grp_str, in_ifname); } for (oif_vif_index = 0; oif_vif_index < MAXVIFS; @@ -2159,7 +2159,7 @@ static void pim_show_neighbors(struct pim_instance *pim, struct vty *vty, json = json_object_new_object(); } else { vty_out(vty, - "Interface Neighbor Uptime Holdtime DR Pri\n"); + "Interface Neighbor Uptime Holdtime DR Pri\n"); } FOR_ALL_INTERFACES (pim->vrf, ifp) { @@ -2201,7 +2201,7 @@ static void pim_show_neighbors(struct pim_instance *pim, struct vty *vty, neigh_src_str, json_row); } else { - vty_out(vty, "%-9s %15s %8s %8s %6d\n", + vty_out(vty, "%-16s %15s %8s %8s %6d\n", ifp->name, neigh_src_str, uptime, expire, neigh->dr_priority); } @@ -2226,7 +2226,7 @@ static void pim_show_neighbors_secondary(struct pim_instance *pim, struct interface *ifp; vty_out(vty, - "Interface Address Neighbor Secondary \n"); + "Interface Address Neighbor Secondary \n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { struct pim_interface *pim_ifp; @@ -2263,7 +2263,7 @@ static void pim_show_neighbors_secondary(struct pim_instance *pim, prefix2str(p, neigh_sec_str, sizeof(neigh_sec_str)); - vty_out(vty, "%-9s %-15s %-15s %-15s\n", + vty_out(vty, "%-16s %-15s %-15s %-15s\n", ifp->name, inet_ntoa(ifaddr), neigh_src_str, neigh_sec_str); } @@ -2350,7 +2350,7 @@ static void pim_show_upstream(struct pim_instance *pim, struct vty *vty, json = json_object_new_object(); else vty_out(vty, - "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt\n"); + "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt\n"); for (ALL_LIST_ELEMENTS_RO(pim->upstream_list, upnode, up)) { char src_str[INET_ADDRSTRLEN]; @@ -2465,7 +2465,7 @@ static void pim_show_upstream(struct pim_instance *pim, struct vty *vty, json_object_object_add(json_group, src_str, json_row); } else { vty_out(vty, - "%-10s%-15s %-15s %-11s %-8s %-9s %-9s %-9s %6d\n", + "%-16s%-15s %-15s %-11s %-8s %-9s %-9s %-9s %6d\n", up->rpf.source_nexthop.interface ? up->rpf.source_nexthop.interface->name : "Unknown", @@ -2527,7 +2527,7 @@ static void pim_show_join_desired_helper(struct pim_instance *pim, json_object_object_add(json_group, src_str, json_row); } else { - vty_out(vty, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s\n", + vty_out(vty, "%-16s %-15s %-15s %-10s %-5s %-10s %-11s %-6s\n", ch->interface->name, src_str, grp_str, pim_macro_ch_lost_assert(ch) ? "yes" : "no", pim_macro_chisin_joins(ch) ? "yes" : "no", @@ -2553,7 +2553,7 @@ static void pim_show_join_desired(struct pim_instance *pim, struct vty *vty, json = json_object_new_object(); else vty_out(vty, - "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD\n"); + "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD\n"); /* scan per-interface (S,G) state */ FOR_ALL_INTERFACES (pim->vrf, ifp) { @@ -2589,7 +2589,7 @@ static void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, json = json_object_new_object(); else vty_out(vty, - "Source Group RpfIface RibNextHop RpfAddress \n"); + "Source Group RpfIface RibNextHop RpfAddress \n"); for (ALL_LIST_ELEMENTS_RO(pim->upstream_list, upnode, up)) { char src_str[INET_ADDRSTRLEN]; @@ -2632,7 +2632,7 @@ static void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, rpf_addr_str); json_object_object_add(json_group, src_str, json_row); } else { - vty_out(vty, "%-15s %-15s %-8s %-15s %-15s\n", src_str, + vty_out(vty, "%-15s %-15s %-16s %-15s %-15s\n", src_str, grp_str, rpf_ifname, rpf_nexthop_str, rpf_addr_str); } @@ -2726,7 +2726,7 @@ static void pim_show_rpf(struct pim_instance *pim, struct vty *vty, bool uj) show_rpf_refresh_stats(vty, pim, now, json); vty_out(vty, "\n"); vty_out(vty, - "Source Group RpfIface RpfAddress RibNextHop Metric Pref\n"); + "Source Group RpfIface RpfAddress RibNextHop Metric Pref\n"); } for (ALL_LIST_ELEMENTS_RO(pim->upstream_list, up_node, up)) { @@ -2774,7 +2774,7 @@ static void pim_show_rpf(struct pim_instance *pim, struct vty *vty, bool uj) json_object_object_add(json_group, src_str, json_row); } else { - vty_out(vty, "%-15s %-15s %-8s %-15s %-15s %6d %4d\n", + vty_out(vty, "%-15s %-15s %-16s %-15s %-15s %6d %4d\n", src_str, grp_str, rpf_ifname, rpf_addr_str, rib_nexthop_str, rpf->source_nexthop.mrib_route_metric, @@ -2809,7 +2809,7 @@ static int pim_print_pnc_cache_walkcb(struct hash_bucket *bucket, void *arg) ifp = if_lookup_by_index(first_ifindex, pim->vrf_id); vty_out(vty, "%-15s ", inet_ntoa(pnc->rpf.rpf_addr.u.prefix4)); - vty_out(vty, "%-14s ", ifp ? ifp->name : "NULL"); + vty_out(vty, "%-16s ", ifp ? ifp->name : "NULL"); vty_out(vty, "%s ", inet_ntoa(nh_node->gate.ipv4)); vty_out(vty, "\n"); } @@ -2824,8 +2824,8 @@ static void pim_show_nexthop(struct pim_instance *pim, struct vty *vty) cwd.pim = pim; vty_out(vty, "Number of registered addresses: %lu\n", pim->rpf_hash->count); - vty_out(vty, "Address Interface Nexthop\n"); - vty_out(vty, "-------------------------------------------\n"); + vty_out(vty, "Address Interface Nexthop\n"); + vty_out(vty, "---------------------------------------------\n"); hash_walk(pim->rpf_hash, pim_print_pnc_cache_walkcb, &cwd); } @@ -2844,7 +2844,7 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) json = json_object_new_object(); else vty_out(vty, - "Interface Address Group Mode Timer Srcs V Uptime \n"); + "Interface Address Group Mode Timer Srcs V Uptime \n"); /* scan interfaces */ FOR_ALL_INTERFACES (pim->vrf, ifp) { @@ -2924,7 +2924,7 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) } else { vty_out(vty, - "%-9s %-15s %-15s %4s %8s %4d %d %8s\n", + "%-16s %-15s %-15s %4s %8s %4d %d %8s\n", ifp->name, ifaddr_str, group_str, grp->igmp_version == 3 @@ -2956,7 +2956,7 @@ static void igmp_show_group_retransmission(struct pim_instance *pim, struct interface *ifp; vty_out(vty, - "Interface Address Group RetTimer Counter RetSrcs\n"); + "Interface Address Group RetTimer Counter RetSrcs\n"); /* scan interfaces */ FOR_ALL_INTERFACES (pim->vrf, ifp) { @@ -3004,7 +3004,7 @@ static void igmp_show_group_retransmission(struct pim_instance *pim, } } - vty_out(vty, "%-9s %-15s %-15s %-8s %7d %7d\n", + vty_out(vty, "%-16s %-15s %-15s %-8s %7d %7d\n", ifp->name, ifaddr_str, group_str, grp_retr_mmss, grp->group_specific_query_retransmit_count, @@ -3023,7 +3023,7 @@ static void igmp_show_sources(struct pim_instance *pim, struct vty *vty) now = pim_time_monotonic_sec(); vty_out(vty, - "Interface Address Group Source Timer Fwd Uptime \n"); + "Interface Address Group Source Timer Fwd Uptime \n"); /* scan interfaces */ FOR_ALL_INTERFACES (pim->vrf, ifp) { @@ -3075,7 +3075,7 @@ static void igmp_show_sources(struct pim_instance *pim, struct vty *vty) now - src->source_creation); vty_out(vty, - "%-9s %-15s %-15s %-15s %5s %3s %8s\n", + "%-16s %-15s %-15s %-15s %5s %3s %8s\n", ifp->name, ifaddr_str, group_str, source_str, mmss, IGMP_SOURCE_TEST_FORWARDING( @@ -3096,7 +3096,7 @@ static void igmp_show_source_retransmission(struct pim_instance *pim, struct interface *ifp; vty_out(vty, - "Interface Address Group Source Counter\n"); + "Interface Address Group Source Counter\n"); /* scan interfaces */ FOR_ALL_INTERFACES (pim->vrf, ifp) { @@ -3138,7 +3138,7 @@ static void igmp_show_source_retransmission(struct pim_instance *pim, source_str, sizeof(source_str)); vty_out(vty, - "%-9s %-15s %-15s %-15s %7d\n", + "%-16s %-15s %-15s %-15s %7d\n", ifp->name, ifaddr_str, group_str, source_str, src->source_query_retransmit_count); @@ -4378,7 +4378,7 @@ static void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty) vty_out(vty, "\n"); vty_out(vty, - "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut\n"); + "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut\n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { struct pim_interface *pim_ifp; @@ -4403,7 +4403,7 @@ static void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty) ifaddr = pim_ifp->primary_address; - vty_out(vty, "%-12s %-15s %3d %3d %7lu %7lu %10lu %10lu\n", + vty_out(vty, "%-16s %-15s %3d %3d %7lu %7lu %10lu %10lu\n", ifp->name, inet_ntoa(ifaddr), ifp->ifindex, pim_ifp->mroute_vif_index, (unsigned long)vreq.icount, (unsigned long)vreq.ocount, (unsigned long)vreq.ibytes, @@ -4532,7 +4532,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, json = json_object_new_object(); } else { vty_out(vty, - "Source Group Proto Input Output TTL Uptime\n"); + "Source Group Proto Input Output TTL Uptime\n"); } now = pim_time_monotonic_sec(); @@ -4682,7 +4682,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, } vty_out(vty, - "%-15s %-15s %-6s %-10s %-10s %-3d %8s\n", + "%-15s %-15s %-6s %-16s %-16s %-3d %8s\n", src_str, grp_str, proto, in_ifname, out_ifname, ttl, oif_uptime); @@ -4696,7 +4696,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, } if (!uj && !found_oif) { - vty_out(vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s\n", + vty_out(vty, "%-15s %-15s %-6s %-16s %-16s %-3d %8s\n", src_str, grp_str, "none", in_ifname, "none", 0, "--:--:--"); } @@ -4803,7 +4803,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, json_ifp_out); } else { vty_out(vty, - "%-15s %-15s %-6s %-10s %-10s %-3d %8s %s\n", + "%-15s %-15s %-6s %-16s %-16s %-3d %8s %s\n", src_str, grp_str, proto, in_ifname, out_ifname, ttl, oif_uptime, pim->vrf->name); @@ -4818,7 +4818,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, if (!uj && !found_oif) { vty_out(vty, - "%-15s %-15s %-6s %-10s %-10s %-3d %8s %s\n", + "%-15s %-15s %-6s %-16s %-16s %-3d %8s %s\n", src_str, grp_str, proto, in_ifname, "none", 0, "--:--:--", pim->vrf->name); } diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 14ce8d7d9f..0fe4110f60 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -911,7 +911,7 @@ void pim_ifchannel_prune(struct interface *ifp, struct in_addr upstream, if (!ch && !(source_flags & PIM_ENCODE_RPT_BIT)) { if (PIM_DEBUG_TRACE) zlog_debug( - "%s: Received prune with no relevant ifchannel %s(%s) state: %d", + "%s: Received prune with no relevant ifchannel %s%s state: %d", __PRETTY_FUNCTION__, ifp->name, pim_str_sg_dump(sg), source_flags); return; diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 67b1a95f74..bba4031744 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -1030,7 +1030,7 @@ void pim_mroute_update_counters(struct channel_oil *c_oil) sg.grp = c_oil->oil.mfcc_mcastgrp; if (PIM_DEBUG_MROUTE) zlog_debug( - "Channel(%s) is not installed no need to collect data from kernel", + "Channel%s is not installed no need to collect data from kernel", pim_str_sg_dump(&sg)); } return; @@ -1049,7 +1049,7 @@ void pim_mroute_update_counters(struct channel_oil *c_oil) sg.grp = c_oil->oil.mfcc_mcastgrp; zlog_warn( - "ioctl(SIOCGETSGCNT=%lu) failure for (S,G)=(%s): errno=%d: %s", + "ioctl(SIOCGETSGCNT=%lu) failure for (S,G)=%s: errno=%d: %s", (unsigned long)SIOCGETSGCNT, pim_str_sg_dump(&sg), errno, safe_strerror(errno)); diff --git a/pimd/pim_register.c b/pimd/pim_register.c index a4965b8ffe..386ed1d424 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -279,14 +279,13 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr, #define PIM_MSG_REGISTER_BIT_RESERVED_LEN 4 ip_hdr = (struct ip *)(tlv_buf + PIM_MSG_REGISTER_BIT_RESERVED_LEN); - if (!pim_rp_check_is_my_ip_address(pim_ifp->pim, ip_hdr->ip_dst, - dest_addr)) { + if (!pim_rp_check_is_my_ip_address(pim_ifp->pim, dest_addr)) { if (PIM_DEBUG_PIM_REG) { char dest[INET_ADDRSTRLEN]; pim_inet4_dump("<dst?>", dest_addr, dest, sizeof(dest)); zlog_debug( - "%s: Received Register message for %s that I do not own", + "%s: Received Register message for destination address: %s that I do not own", __func__, dest); } return 0; @@ -330,9 +329,8 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr, char src_str[INET_ADDRSTRLEN]; pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str)); - zlog_debug( - "Received Register message(%s) from %s on %s, rp: %d", - pim_str_sg_dump(&sg), src_str, ifp->name, i_am_rp); + zlog_debug("Received Register message%s from %s on %s, rp: %d", + pim_str_sg_dump(&sg), src_str, ifp->name, i_am_rp); } if (i_am_rp diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 7094b93a45..b7db7d0418 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -1091,34 +1091,13 @@ int pim_rp_config_write(struct pim_instance *pim, struct vty *vty, return count; } -int pim_rp_check_is_my_ip_address(struct pim_instance *pim, - struct in_addr group, - struct in_addr dest_addr) +bool pim_rp_check_is_my_ip_address(struct pim_instance *pim, + struct in_addr dest_addr) { - struct rp_info *rp_info; - struct prefix g; - - memset(&g, 0, sizeof(g)); - g.family = AF_INET; - g.prefixlen = 32; - g.u.prefix4 = group; - - rp_info = pim_rp_find_match_group(pim, &g); - /* - * See if we can short-cut some? - * This might not make sense if we ever leave a static RP - * type of configuration. - * Note - Premature optimization might bite our patooeys' here. - */ - if (I_am_RP(pim, group)) { - if (dest_addr.s_addr == rp_info->rp.rpf_addr.u.prefix4.s_addr) - return 1; - } - if (if_lookup_exact_address(&dest_addr, AF_INET, pim->vrf_id)) - return 1; + return true; - return 0; + return false; } void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) @@ -1135,7 +1114,7 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) json = json_object_new_object(); else vty_out(vty, - "RP address group/prefix-list OIF I am RP\n"); + "RP address group/prefix-list OIF I am RP\n"); for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) { if (!pim_rpf_addr_is_inaddr_none(&rp_info->rp)) { @@ -1198,11 +1177,11 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) 48)); if (rp_info->rp.source_nexthop.interface) - vty_out(vty, "%-10s ", + vty_out(vty, "%-16s ", rp_info->rp.source_nexthop .interface->name); else - vty_out(vty, "%-10s ", "(Unknown)"); + vty_out(vty, "%-16s ", "(Unknown)"); if (rp_info->i_am_rp) vty_out(vty, "yes\n"); diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h index 7769864c08..e0f8e16be0 100644 --- a/pimd/pim_rp.h +++ b/pimd/pim_rp.h @@ -55,9 +55,8 @@ int pim_rp_i_am_rp(struct pim_instance *pim, struct in_addr group); void pim_rp_check_on_if_add(struct pim_interface *pim_ifp); void pim_i_am_rp_re_evaluate(struct pim_instance *pim); -int pim_rp_check_is_my_ip_address(struct pim_instance *pim, - struct in_addr group, - struct in_addr dest_addr); +bool pim_rp_check_is_my_ip_address(struct pim_instance *pim, + struct in_addr dest_addr); int pim_rp_set_upstream_addr(struct pim_instance *pim, struct in_addr *up, struct in_addr source, struct in_addr group); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index cb89e30a50..2a0804e10b 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -1682,7 +1682,7 @@ static void pim_upstream_sg_running(void *arg) // No packet can have arrived here if this is the case if (!up->channel_oil->installed) { if (PIM_DEBUG_TRACE) - zlog_debug("%s: %s[%s] is not installed in mroute", + zlog_debug("%s: %s%s is not installed in mroute", __PRETTY_FUNCTION__, up->sg_str, pim->vrf->name); return; diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 78cccd5877..70f099b0d7 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -150,6 +150,8 @@ static int pim_zebra_if_del(int command, struct zclient *zclient, if (!if_is_operative(ifp)) pim_if_addr_del_all(ifp); + if_set_index(ifp, IFINDEX_INTERNAL); + return 0; } @@ -541,45 +543,6 @@ void pim_zebra_upstream_rpf_changed(struct pim_instance *pim, pim_upstream_update_join_desired(pim, up); } -static void scan_upstream_rpf_cache(struct pim_instance *pim) -{ - struct listnode *up_node; - struct listnode *up_nextnode; - struct pim_upstream *up; - - for (ALL_LIST_ELEMENTS(pim->upstream_list, up_node, up_nextnode, up)) { - enum pim_rpf_result rpf_result; - struct pim_rpf old; - struct prefix nht_p; - - if (up->upstream_addr.s_addr == INADDR_ANY) { - if (PIM_DEBUG_TRACE) - zlog_debug( - "%s: RP not configured for Upstream %s", - __PRETTY_FUNCTION__, up->sg_str); - continue; - } - - nht_p.family = AF_INET; - nht_p.prefixlen = IPV4_MAX_BITLEN; - nht_p.u.prefix4.s_addr = up->upstream_addr.s_addr; - pim_resolve_upstream_nh(pim, &nht_p); - - old.source_nexthop.interface = up->rpf.source_nexthop.interface; - old.source_nexthop.nbr = up->rpf.source_nexthop.nbr; - rpf_result = pim_rpf_update(pim, up, &old, 0); - - if (rpf_result == PIM_RPF_FAILURE) - continue; - - if (rpf_result == PIM_RPF_CHANGED) - pim_zebra_upstream_rpf_changed(pim, up, &old); - - } /* for (qpim_upstream_list) */ - - pim_zebra_update_all_interfaces(pim); -} - void pim_scan_individual_oil(struct channel_oil *c_oil, int in_vif_index) { struct in_addr vif_source; @@ -743,9 +706,6 @@ static int on_rpf_cache_refresh(struct thread *t) { struct pim_instance *pim = THREAD_ARG(t); - /* update PIM protocol state */ - scan_upstream_rpf_cache(pim); - /* update kernel multicast forwarding cache (MFC) */ pim_scan_oil(pim); diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 0ffe313c17..6d93a40b91 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -499,7 +499,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) more.src = c_oil->oil.mfcc_origin; more.grp = c_oil->oil.mfcc_mcastgrp; zlog_debug( - "Sending Request for New Channel Oil Information(%s) VIIF %d(%s)", + "Sending Request for New Channel Oil Information%s VIIF %d(%s)", pim_str_sg_dump(&more), c_oil->oil.mfcc_parent, c_oil->pim->vrf->name); } |
