1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234 |
- /*
- PIM for Quagga
- Copyright (C) 2008 Everton da Silva Marques
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING; if not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA
-
- $QuaggaId: $Format:%an, %ai, %h$ $
- */
- #include <zebra.h>
- #include "zebra/rib.h"
- #include "log.h"
- #include "prefix.h"
- #include "zclient.h"
- #include "stream.h"
- #include "network.h"
- #include "pimd.h"
- #include "pim_pim.h"
- #include "pim_zebra.h"
- #include "pim_iface.h"
- #include "pim_str.h"
- #include "pim_oil.h"
- #include "pim_rpf.h"
- #include "pim_time.h"
- #include "pim_join.h"
- #include "pim_zlookup.h"
- #include "pim_ifchannel.h"
- #undef PIM_DEBUG_IFADDR_DUMP
- #define PIM_DEBUG_IFADDR_DUMP
- static int fib_lookup_if_vif_index(struct in_addr addr);
- static int del_oif(struct channel_oil *channel_oil,
- struct interface *oif,
- uint32_t proto_mask);
- /* Router-id update message from zebra. */
- static int pim_router_id_update_zebra(int command, struct zclient *zclient,
- zebra_size_t length)
- {
- struct prefix router_id;
- /* FIXME: actually use router_id for anything ? */
- zebra_router_id_update_read(zclient->ibuf, &router_id);
- return 0;
- }
- static int pim_zebra_if_add(int command, struct zclient *zclient,
- zebra_size_t length)
- {
- struct interface *ifp;
- /*
- zebra api adds/dels interfaces using the same call
- interface_add_read below, see comments in lib/zclient.c
- */
- ifp = zebra_interface_add_read(zclient->ibuf);
- if (!ifp)
- return 0;
- if (PIM_DEBUG_ZEBRA) {
- zlog_debug("%s: %s index %d flags %ld metric %d mtu %d operative %d",
- __PRETTY_FUNCTION__,
- ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric,
- ifp->mtu, if_is_operative(ifp));
- }
- if (if_is_operative(ifp))
- pim_if_addr_add_all(ifp);
- return 0;
- }
- static int pim_zebra_if_del(int command, struct zclient *zclient,
- zebra_size_t length)
- {
- struct interface *ifp;
- /*
- zebra api adds/dels interfaces using the same call
- interface_add_read below, see comments in lib/zclient.c
- */
- ifp = zebra_interface_add_read(zclient->ibuf);
- if (!ifp)
- return 0;
- if (PIM_DEBUG_ZEBRA) {
- zlog_debug("%s: %s index %d flags %ld metric %d mtu %d operative %d",
- __PRETTY_FUNCTION__,
- ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric,
- ifp->mtu, if_is_operative(ifp));
- }
- if (!if_is_operative(ifp))
- pim_if_addr_del_all(ifp);
- return 0;
- }
- static int pim_zebra_if_state_up(int command, struct zclient *zclient,
- zebra_size_t length)
- {
- struct interface *ifp;
- /*
- zebra api notifies interface up/down events by using the same call
- interface_add_read below, see comments in lib/zclient.c
- */
- ifp = zebra_interface_state_read(zclient->ibuf);
- if (!ifp)
- return 0;
- zlog_info("INTERFACE UP: %s", ifp->name);
- if (PIM_DEBUG_ZEBRA) {
- zlog_debug("%s: %s index %d flags %ld metric %d mtu %d operative %d",
- __PRETTY_FUNCTION__,
- ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric,
- ifp->mtu, if_is_operative(ifp));
- }
- if (if_is_operative(ifp)) {
- /*
- pim_if_addr_add_all() suffices for bringing up both IGMP and PIM
- */
- pim_if_addr_add_all(ifp);
- }
- return 0;
- }
- static int pim_zebra_if_state_down(int command, struct zclient *zclient,
- zebra_size_t length)
- {
- struct interface *ifp;
- /*
- zebra api notifies interface up/down events by using the same call
- interface_add_read below, see comments in lib/zclient.c
- */
- ifp = zebra_interface_state_read(zclient->ibuf);
- if (!ifp)
- return 0;
- zlog_info("INTERFACE DOWN: %s", ifp->name);
- if (PIM_DEBUG_ZEBRA) {
- zlog_debug("%s: %s index %d flags %ld metric %d mtu %d operative %d",
- __PRETTY_FUNCTION__,
- ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric,
- ifp->mtu, if_is_operative(ifp));
- }
- if (!if_is_operative(ifp)) {
- /*
- pim_if_addr_del_all() suffices for shutting down IGMP,
- but not for shutting down PIM
- */
- pim_if_addr_del_all(ifp);
- /*
- pim_sock_delete() closes the socket, stops read and timer threads,
- and kills all neighbors.
- */
- if (ifp->info) {
- pim_sock_delete(ifp, "link down");
- }
- }
- return 0;
- }
- #ifdef PIM_DEBUG_IFADDR_DUMP
- static void dump_if_address(struct interface *ifp)
- {
- struct connected *ifc;
- struct listnode *node;
- zlog_debug("%s %s: interface %s addresses:",
- __FILE__, __PRETTY_FUNCTION__,
- ifp->name);
-
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
- struct prefix *p = ifc->address;
-
- if (p->family != AF_INET)
- continue;
-
- zlog_debug("%s %s: interface %s address %s",
- __FILE__, __PRETTY_FUNCTION__,
- ifp->name,
- inet_ntoa(p->u.prefix4));
- }
- }
- #endif
- static int pim_zebra_if_address_add(int command, struct zclient *zclient,
- zebra_size_t length)
- {
- struct connected *c;
- struct prefix *p;
- zassert(command == ZEBRA_INTERFACE_ADDRESS_ADD);
- /*
- zebra api notifies address adds/dels events by using the same call
- interface_add_read below, see comments in lib/zclient.c
- zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD, ...)
- will add address to interface list by calling
- connected_add_by_prefix()
- */
- c = zebra_interface_address_read(command, zclient->ibuf);
- if (!c)
- return 0;
- p = c->address;
- if (p->family != AF_INET)
- return 0;
-
- if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(p, buf, BUFSIZ);
- zlog_debug("%s: %s connected IP address %s flags %u",
- __PRETTY_FUNCTION__,
- c->ifp->name, buf, c->flags);
-
- #ifdef PIM_DEBUG_IFADDR_DUMP
- dump_if_address(c->ifp);
- #endif
- }
- pim_if_addr_add(c);
- return 0;
- }
- static int pim_zebra_if_address_del(int command, struct zclient *client,
- zebra_size_t length)
- {
- struct connected *c;
- struct prefix *p;
- zassert(command == ZEBRA_INTERFACE_ADDRESS_DELETE);
- /*
- zebra api notifies address adds/dels events by using the same call
- interface_add_read below, see comments in lib/zclient.c
- zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE, ...)
- will remove address from interface list by calling
- connected_delete_by_prefix()
- */
- c = zebra_interface_address_read(command, client->ibuf);
- if (!c)
- return 0;
-
- p = c->address;
- if (p->family != AF_INET)
- return 0;
-
- if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(p, buf, BUFSIZ);
- zlog_debug("%s: %s disconnected IP address %s flags %u",
- __PRETTY_FUNCTION__,
- c->ifp->name, buf, c->flags);
-
- #ifdef PIM_DEBUG_IFADDR_DUMP
- dump_if_address(c->ifp);
- #endif
- }
-
- pim_if_addr_del(c);
-
- return 0;
- }
- static void scan_upstream_rpf_cache()
- {
- struct listnode *up_node;
- struct listnode *up_nextnode;
- struct pim_upstream *up;
- for (ALL_LIST_ELEMENTS(qpim_upstream_list, up_node, up_nextnode, up)) {
- struct in_addr old_rpf_addr;
- enum pim_rpf_result rpf_result;
- rpf_result = pim_rpf_update(up, &old_rpf_addr);
- if (rpf_result == PIM_RPF_FAILURE)
- continue;
- if (rpf_result == PIM_RPF_CHANGED) {
-
- if (up->join_state == PIM_UPSTREAM_JOINED) {
-
- /*
- RFC 4601: 4.5.7. Sending (S,G) Join/Prune Messages
-
- Transitions from Joined State
-
- RPF'(S,G) changes not due to an Assert
-
- The upstream (S,G) state machine remains in Joined
- state. Send Join(S,G) to the new upstream neighbor, which is
- the new value of RPF'(S,G). Send Prune(S,G) to the old
- upstream neighbor, which is the old value of RPF'(S,G). Set
- the Join Timer (JT) to expire after t_periodic seconds.
- */
-
- /* send Prune(S,G) to the old upstream neighbor */
- pim_joinprune_send(up->rpf.source_nexthop.interface,
- old_rpf_addr,
- up->source_addr,
- up->group_addr,
- 0 /* prune */);
-
- /* send Join(S,G) to the current upstream neighbor */
- pim_joinprune_send(up->rpf.source_nexthop.interface,
- up->rpf.rpf_addr,
- up->source_addr,
- up->group_addr,
- 1 /* join */);
- pim_upstream_join_timer_restart(up);
- } /* up->join_state == PIM_UPSTREAM_JOINED */
- /* FIXME can join_desired actually be changed by pim_rpf_update()
- returning PIM_RPF_CHANGED ? */
- pim_upstream_update_join_desired(up);
- } /* PIM_RPF_CHANGED */
- } /* for (qpim_upstream_list) */
-
- }
- void pim_scan_oil()
- {
- struct listnode *node;
- struct listnode *nextnode;
- struct channel_oil *c_oil;
- qpim_scan_oil_last = pim_time_monotonic_sec();
- ++qpim_scan_oil_events;
- for (ALL_LIST_ELEMENTS(qpim_channel_oil_list, node, nextnode, c_oil)) {
- int old_vif_index;
- int input_iface_vif_index = fib_lookup_if_vif_index(c_oil->oil.mfcc_origin);
- if (input_iface_vif_index < 1) {
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- zlog_warn("%s %s: could not find input interface for (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str);
- continue;
- }
- if (input_iface_vif_index == c_oil->oil.mfcc_parent) {
- /* RPF unchanged */
- continue;
- }
- if (PIM_DEBUG_ZEBRA) {
- struct interface *old_iif = pim_if_find_by_vif_index(c_oil->oil.mfcc_parent);
- struct interface *new_iif = pim_if_find_by_vif_index(input_iface_vif_index);
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- zlog_debug("%s %s: (S,G)=(%s,%s) input interface changed from %s vif_index=%d to %s vif_index=%d",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str,
- old_iif ? old_iif->name : "<old_iif?>", c_oil->oil.mfcc_parent,
- new_iif ? new_iif->name : "<new_iif?>", input_iface_vif_index);
- }
- /* new iif loops to existing oif ? */
- if (c_oil->oil.mfcc_ttls[input_iface_vif_index]) {
- struct interface *new_iif = pim_if_find_by_vif_index(input_iface_vif_index);
- if (PIM_DEBUG_ZEBRA) {
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- zlog_debug("%s %s: (S,G)=(%s,%s) new iif loops to existing oif: %s vif_index=%d",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str,
- new_iif ? new_iif->name : "<new_iif?>", input_iface_vif_index);
- }
- del_oif(c_oil, new_iif, PIM_OIF_FLAG_PROTO_ANY);
- }
- /* update iif vif_index */
- old_vif_index = c_oil->oil.mfcc_parent;
- c_oil->oil.mfcc_parent = input_iface_vif_index;
- /* update kernel multicast forwarding cache (MFC) */
- if (pim_mroute_add(&c_oil->oil)) {
- /* just log warning */
- struct interface *old_iif = pim_if_find_by_vif_index(old_vif_index);
- struct interface *new_iif = pim_if_find_by_vif_index(input_iface_vif_index);
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- zlog_warn("%s %s: (S,G)=(%s,%s) failure updating input interface from %s vif_index=%d to %s vif_index=%d",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str,
- old_iif ? old_iif->name : "<old_iif?>", c_oil->oil.mfcc_parent,
- new_iif ? new_iif->name : "<new_iif?>", input_iface_vif_index);
- continue;
- }
- } /* for (qpim_channel_oil_list) */
- }
- static int on_rpf_cache_refresh(struct thread *t)
- {
- zassert(t);
- zassert(qpim_rpf_cache_refresher);
- qpim_rpf_cache_refresher = 0;
- /* update PIM protocol state */
- scan_upstream_rpf_cache();
- /* update kernel multicast forwarding cache (MFC) */
- pim_scan_oil();
- qpim_rpf_cache_refresh_last = pim_time_monotonic_sec();
- ++qpim_rpf_cache_refresh_events;
- return 0;
- }
- static void sched_rpf_cache_refresh()
- {
- ++qpim_rpf_cache_refresh_requests;
- if (qpim_rpf_cache_refresher) {
- /* Refresh timer is already running */
- return;
- }
- /* Start refresh timer */
- if (PIM_DEBUG_ZEBRA) {
- zlog_debug("%s: triggering %ld msec timer",
- __PRETTY_FUNCTION__,
- qpim_rpf_cache_refresh_delay_msec);
- }
- THREAD_TIMER_MSEC_ON(master, qpim_rpf_cache_refresher,
- on_rpf_cache_refresh,
- 0, qpim_rpf_cache_refresh_delay_msec);
- }
- static int redist_read_ipv4_route(int command, struct zclient *zclient,
- zebra_size_t length)
- {
- struct stream *s;
- struct zapi_ipv4 api;
- unsigned long ifindex;
- struct in_addr nexthop;
- struct prefix_ipv4 p;
- int min_len = 4;
- if (length < min_len) {
- zlog_warn("%s %s: short buffer: length=%d min=%d",
- __FILE__, __PRETTY_FUNCTION__,
- length, min_len);
- return -1;
- }
- s = zclient->ibuf;
- ifindex = 0;
- nexthop.s_addr = 0;
- /* Type, flags, message. */
- api.type = stream_getc(s);
- api.flags = stream_getc(s);
- api.message = stream_getc(s);
- /* IPv4 prefix length. */
- memset(&p, 0, sizeof(struct prefix_ipv4));
- p.family = AF_INET;
- p.prefixlen = stream_getc(s);
- min_len +=
- PSIZE(p.prefixlen) +
- CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP) ? 5 : 0 +
- CHECK_FLAG(api.message, ZAPI_MESSAGE_IFINDEX) ? 5 : 0 +
- CHECK_FLAG(api.message, ZAPI_MESSAGE_DISTANCE) ? 1 : 0 +
- CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC) ? 4 : 0;
- if (PIM_DEBUG_ZEBRA) {
- zlog_debug("%s %s: length=%d min_len=%d flags=%s%s%s%s",
- __FILE__, __PRETTY_FUNCTION__,
- length, min_len,
- CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP) ? "nh" : "",
- CHECK_FLAG(api.message, ZAPI_MESSAGE_IFINDEX) ? " ifi" : "",
- CHECK_FLAG(api.message, ZAPI_MESSAGE_DISTANCE) ? " dist" : "",
- CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC) ? " metr" : "");
- }
- if (length < min_len) {
- zlog_warn("%s %s: short buffer: length=%d min_len=%d flags=%s%s%s%s",
- __FILE__, __PRETTY_FUNCTION__,
- length, min_len,
- CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP) ? "nh" : "",
- CHECK_FLAG(api.message, ZAPI_MESSAGE_IFINDEX) ? " ifi" : "",
- CHECK_FLAG(api.message, ZAPI_MESSAGE_DISTANCE) ? " dist" : "",
- CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC) ? " metr" : "");
- return -1;
- }
- /* IPv4 prefix. */
- stream_get(&p.prefix, s, PSIZE(p.prefixlen));
- /* Nexthop, ifindex, distance, metric. */
- if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) {
- api.nexthop_num = stream_getc(s);
- nexthop.s_addr = stream_get_ipv4(s);
- }
- if (CHECK_FLAG(api.message, ZAPI_MESSAGE_IFINDEX)) {
- api.ifindex_num = stream_getc(s);
- ifindex = stream_getl(s);
- }
- api.distance = CHECK_FLAG(api.message, ZAPI_MESSAGE_DISTANCE) ?
- stream_getc(s) :
- 0;
- api.metric = CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC) ?
- stream_getl(s) :
- 0;
- switch (command) {
- case ZEBRA_IPV4_ROUTE_ADD:
- if (PIM_DEBUG_ZEBRA) {
- char buf[2][INET_ADDRSTRLEN];
- zlog_debug("%s: add %s %s/%d "
- "nexthop %s ifindex %ld metric%s %u distance%s %u",
- __PRETTY_FUNCTION__,
- zebra_route_string(api.type),
- inet_ntop(AF_INET, &p.prefix, buf[0], sizeof(buf[0])),
- p.prefixlen,
- inet_ntop(AF_INET, &nexthop, buf[1], sizeof(buf[1])),
- ifindex,
- CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC) ? "-recv" : "-miss",
- api.metric,
- CHECK_FLAG(api.message, ZAPI_MESSAGE_DISTANCE) ? "-recv" : "-miss",
- api.distance);
- }
- break;
- case ZEBRA_IPV4_ROUTE_DELETE:
- if (PIM_DEBUG_ZEBRA) {
- char buf[2][INET_ADDRSTRLEN];
- zlog_debug("%s: delete %s %s/%d "
- "nexthop %s ifindex %ld metric%s %u distance%s %u",
- __PRETTY_FUNCTION__,
- zebra_route_string(api.type),
- inet_ntop(AF_INET, &p.prefix, buf[0], sizeof(buf[0])),
- p.prefixlen,
- inet_ntop(AF_INET, &nexthop, buf[1], sizeof(buf[1])),
- ifindex,
- CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC) ? "-recv" : "-miss",
- api.metric,
- CHECK_FLAG(api.message, ZAPI_MESSAGE_DISTANCE) ? "-recv" : "-miss",
- api.distance);
- }
- break;
- default:
- zlog_warn("%s: unknown command=%d", __PRETTY_FUNCTION__, command);
- return -1;
- }
- sched_rpf_cache_refresh();
- return 0;
- }
- void pim_zebra_init()
- {
- struct zclient *zclient;
- int i;
- #ifdef HAVE_TCP_ZEBRA
- zlog_notice("zclient update contacting ZEBRA daemon at socket TCP %s,%d", "127.0.0.1", ZEBRA_PORT);
- #else
- zlog_notice("zclient update contacting ZEBRA daemon at socket UNIX %s", ZEBRA_SERV_PATH);
- #endif
- /* Socket for receiving updates from Zebra daemon */
- zclient = zclient_new();
- zclient->router_id_update = pim_router_id_update_zebra;
- zclient->interface_add = pim_zebra_if_add;
- zclient->interface_delete = pim_zebra_if_del;
- zclient->interface_up = pim_zebra_if_state_up;
- zclient->interface_down = pim_zebra_if_state_down;
- zclient->interface_address_add = pim_zebra_if_address_add;
- zclient->interface_address_delete = pim_zebra_if_address_del;
- zclient->ipv4_route_add = redist_read_ipv4_route;
- zclient->ipv4_route_delete = redist_read_ipv4_route;
- zclient_init(zclient, ZEBRA_ROUTE_PIM);
- zlog_info("zclient_init cleared redistribution request");
- zassert(zclient->redist_default == ZEBRA_ROUTE_PIM);
- /* Request all redistribution */
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (i == zclient->redist_default)
- continue;
- zclient->redist[i] = 1;
- zlog_info("%s: requesting redistribution for %s (%i)",
- __PRETTY_FUNCTION__, zebra_route_string(i), i);
- }
- /* Request default information */
- zclient->default_information = 1;
- zlog_info("%s: requesting default information redistribution",
- __PRETTY_FUNCTION__);
- zlog_notice("%s: zclient update socket initialized",
- __PRETTY_FUNCTION__);
- zassert(!qpim_zclient_lookup);
- qpim_zclient_lookup = zclient_lookup_new();
- zassert(qpim_zclient_lookup);
- }
- void igmp_anysource_forward_start(struct igmp_group *group)
- {
- /* Any source (*,G) is forwarded only if mode is EXCLUDE {empty} */
- zassert(group->group_filtermode_isexcl);
- zassert(listcount(group->group_source_list) < 1);
- if (PIM_DEBUG_IGMP_TRACE) {
- zlog_debug("%s %s: UNIMPLEMENTED",
- __FILE__, __PRETTY_FUNCTION__);
- }
- }
- void igmp_anysource_forward_stop(struct igmp_group *group)
- {
- /* Any source (*,G) is forwarded only if mode is EXCLUDE {empty} */
- zassert((!group->group_filtermode_isexcl) || (listcount(group->group_source_list) > 0));
- if (PIM_DEBUG_IGMP_TRACE) {
- zlog_debug("%s %s: UNIMPLEMENTED",
- __FILE__, __PRETTY_FUNCTION__);
- }
- }
- static int fib_lookup_if_vif_index(struct in_addr addr)
- {
- struct pim_zlookup_nexthop nexthop_tab[PIM_NEXTHOP_IFINDEX_TAB_SIZE];
- int num_ifindex;
- int vif_index;
- int first_ifindex;
- num_ifindex = zclient_lookup_nexthop(qpim_zclient_lookup, nexthop_tab,
- PIM_NEXTHOP_IFINDEX_TAB_SIZE, addr,
- PIM_NEXTHOP_LOOKUP_MAX);
- if (num_ifindex < 1) {
- char addr_str[100];
- pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
- zlog_warn("%s %s: could not find nexthop ifindex for address %s",
- __FILE__, __PRETTY_FUNCTION__,
- addr_str);
- return -1;
- }
-
- first_ifindex = nexthop_tab[0].ifindex;
-
- if (num_ifindex > 1) {
- char addr_str[100];
- pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
- zlog_debug("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)",
- __FILE__, __PRETTY_FUNCTION__,
- num_ifindex, addr_str, first_ifindex);
- /* debug warning only, do not return */
- }
-
- if (PIM_DEBUG_ZEBRA) {
- char addr_str[100];
- pim_inet4_dump("<ifaddr?>", addr, addr_str, sizeof(addr_str));
- zlog_debug("%s %s: found nexthop ifindex=%d (interface %s) for address %s",
- __FILE__, __PRETTY_FUNCTION__,
- first_ifindex, ifindex2ifname(first_ifindex), addr_str);
- }
- vif_index = pim_if_find_vifindex_by_ifindex(first_ifindex);
- if (vif_index < 1) {
- char addr_str[100];
- pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
- zlog_warn("%s %s: low vif_index=%d < 1 nexthop for address %s",
- __FILE__, __PRETTY_FUNCTION__,
- vif_index, addr_str);
- return -2;
- }
- zassert(qpim_mroute_oif_highest_vif_index < MAXVIFS);
- if (vif_index > qpim_mroute_oif_highest_vif_index) {
- char addr_str[100];
- pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
- zlog_warn("%s %s: high vif_index=%d > highest_vif_index=%d nexthop for address %s",
- __FILE__, __PRETTY_FUNCTION__,
- vif_index, qpim_mroute_oif_highest_vif_index, addr_str);
- zlog_warn("%s %s: pim disabled on interface %s vif_index=%d ?",
- __FILE__, __PRETTY_FUNCTION__,
- ifindex2ifname(vif_index),
- vif_index);
- return -3;
- }
- return vif_index;
- }
- static int add_oif(struct channel_oil *channel_oil,
- struct interface *oif,
- uint32_t proto_mask)
- {
- struct pim_interface *pim_ifp;
- int old_ttl;
- zassert(channel_oil);
- pim_ifp = oif->info;
- if (PIM_DEBUG_MROUTE) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str,
- proto_mask, oif->name, pim_ifp->mroute_vif_index);
- }
- if (pim_ifp->mroute_vif_index < 1) {
- zlog_warn("%s %s: interface %s vif_index=%d < 1",
- __FILE__, __PRETTY_FUNCTION__,
- oif->name, pim_ifp->mroute_vif_index);
- return -1;
- }
- #ifdef PIM_ENFORCE_LOOPFREE_MFC
- /*
- Prevent creating MFC entry with OIF=IIF.
- This is a protection against implementation mistakes.
- PIM protocol implicitely ensures loopfree multicast topology.
- IGMP must be protected against adding looped MFC entries created
- by both source and receiver attached to the same interface. See
- TODO T22.
- */
- if (pim_ifp->mroute_vif_index == channel_oil->oil.mfcc_parent) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: refusing protocol mask %u request for IIF=OIF=%s (vif_index=%d) for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- proto_mask, oif->name, pim_ifp->mroute_vif_index,
- source_str, group_str);
- return -2;
- }
- #endif
- zassert(qpim_mroute_oif_highest_vif_index < MAXVIFS);
- zassert(pim_ifp->mroute_vif_index <= qpim_mroute_oif_highest_vif_index);
- /* Prevent single protocol from subscribing same interface to
- channel (S,G) multiple times */
- if (channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: existing protocol mask %u requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- proto_mask, oif->name, pim_ifp->mroute_vif_index,
- channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index],
- source_str, group_str);
- return -3;
- }
- /* Allow other protocol to request subscription of same interface to
- channel (S,G) multiple times, by silently ignoring further
- requests */
- if (channel_oil->oif_flags[pim_ifp->mroute_vif_index] & PIM_OIF_FLAG_PROTO_ANY) {
- /* Check the OIF really exists before returning, and only log
- warning otherwise */
- if (channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] < 1) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: new protocol mask %u requested nonexistent OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- proto_mask, oif->name, pim_ifp->mroute_vif_index,
- channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index],
- source_str, group_str);
- }
- return 0;
- }
- old_ttl = channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index];
- if (old_ttl > 0) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: interface %s (vif_index=%d) is existing output for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- oif->name, pim_ifp->mroute_vif_index,
- source_str, group_str);
- return -4;
- }
- channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = PIM_MROUTE_MIN_TTL;
- if (pim_mroute_add(&channel_oil->oil)) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: could not add output interface %s (vif_index=%d) for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- oif->name, pim_ifp->mroute_vif_index,
- source_str, group_str);
- channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = old_ttl;
- return -5;
- }
- channel_oil->oif_creation[pim_ifp->mroute_vif_index] = pim_time_monotonic_sec();
- ++channel_oil->oil_size;
- channel_oil->oif_flags[pim_ifp->mroute_vif_index] |= proto_mask;
- if (PIM_DEBUG_MROUTE) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d: DONE",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str,
- proto_mask, oif->name, pim_ifp->mroute_vif_index);
- }
- return 0;
- }
- static int del_oif(struct channel_oil *channel_oil,
- struct interface *oif,
- uint32_t proto_mask)
- {
- struct pim_interface *pim_ifp;
- int old_ttl;
- zassert(channel_oil);
- pim_ifp = oif->info;
- zassert(pim_ifp->mroute_vif_index >= 1);
- zassert(qpim_mroute_oif_highest_vif_index < MAXVIFS);
- zassert(pim_ifp->mroute_vif_index <= qpim_mroute_oif_highest_vif_index);
- if (PIM_DEBUG_MROUTE) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str,
- proto_mask, oif->name, pim_ifp->mroute_vif_index);
- }
- /* Prevent single protocol from unsubscribing same interface from
- channel (S,G) multiple times */
- if (!(channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask)) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: nonexistent protocol mask %u removed OIF %s (vif_index=%d, min_ttl=%d) from channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- proto_mask, oif->name, pim_ifp->mroute_vif_index,
- channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index],
- source_str, group_str);
- return -2;
- }
- /* Mark that protocol is no longer interested in this OIF */
- channel_oil->oif_flags[pim_ifp->mroute_vif_index] &= ~proto_mask;
- /* Allow multiple protocols to unsubscribe same interface from
- channel (S,G) multiple times, by silently ignoring requests while
- there is at least one protocol interested in the channel */
- if (channel_oil->oif_flags[pim_ifp->mroute_vif_index] & PIM_OIF_FLAG_PROTO_ANY) {
- /* Check the OIF keeps existing before returning, and only log
- warning otherwise */
- if (channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] < 1) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: protocol mask %u removing nonexistent OIF %s (vif_index=%d, min_ttl=%d) from channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- proto_mask, oif->name, pim_ifp->mroute_vif_index,
- channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index],
- source_str, group_str);
- }
- return 0;
- }
- old_ttl = channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index];
- if (old_ttl < 1) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: interface %s (vif_index=%d) is not output for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- oif->name, pim_ifp->mroute_vif_index,
- source_str, group_str);
- return -3;
- }
- channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = 0;
- if (pim_mroute_add(&channel_oil->oil)) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: could not remove output interface %s (vif_index=%d) from channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- oif->name, pim_ifp->mroute_vif_index,
- source_str, group_str);
-
- channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = old_ttl;
- return -4;
- }
- --channel_oil->oil_size;
- if (channel_oil->oil_size < 1) {
- if (pim_mroute_del(&channel_oil->oil)) {
- /* just log a warning in case of failure */
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_warn("%s %s: failure removing OIL for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str);
- }
- }
- if (PIM_DEBUG_MROUTE) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d: DONE",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str,
- proto_mask, oif->name, pim_ifp->mroute_vif_index);
- }
- return 0;
- }
- void igmp_source_forward_start(struct igmp_source *source)
- {
- struct igmp_group *group;
- if (PIM_DEBUG_IGMP_TRACE) {
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", source->source_addr, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", source->source_group->group_addr, group_str, sizeof(group_str));
- zlog_debug("%s: (S,G)=(%s,%s) igmp_sock=%d oif=%s fwd=%d",
- __PRETTY_FUNCTION__,
- source_str, group_str,
- source->source_group->group_igmp_sock->fd,
- source->source_group->group_igmp_sock->interface->name,
- IGMP_SOURCE_TEST_FORWARDING(source->source_flags));
- }
- /* Prevent IGMP interface from installing multicast route multiple
- times */
- if (IGMP_SOURCE_TEST_FORWARDING(source->source_flags)) {
- return;
- }
- group = source->source_group;
- if (!source->source_channel_oil) {
- struct pim_interface *pim_oif;
- int input_iface_vif_index = fib_lookup_if_vif_index(source->source_addr);
- if (input_iface_vif_index < 1) {
- char source_str[100];
- pim_inet4_dump("<source?>", source->source_addr, source_str, sizeof(source_str));
- zlog_warn("%s %s: could not find input interface for source %s",
- __FILE__, __PRETTY_FUNCTION__,
- source_str);
- return;
- }
- /*
- Protect IGMP against adding looped MFC entries created by both
- source and receiver attached to the same interface. See TODO
- T22.
- */
- pim_oif = source->source_group->group_igmp_sock->interface->info;
- if (!pim_oif) {
- zlog_warn("%s: multicast not enabled on oif=%s ?",
- __PRETTY_FUNCTION__,
- source->source_group->group_igmp_sock->interface->name);
- return;
- }
- if (pim_oif->mroute_vif_index < 1) {
- zlog_warn("%s %s: oif=%s vif_index=%d < 1",
- __FILE__, __PRETTY_FUNCTION__,
- source->source_group->group_igmp_sock->interface->name,
- pim_oif->mroute_vif_index);
- return;
- }
- if (input_iface_vif_index == pim_oif->mroute_vif_index) {
- /* ignore request for looped MFC entry */
- if (PIM_DEBUG_IGMP_TRACE) {
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", source->source_addr, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", source->source_group->group_addr, group_str, sizeof(group_str));
- zlog_debug("%s: ignoring request for looped MFC entry (S,G)=(%s,%s): igmp_sock=%d oif=%s vif_index=%d",
- __PRETTY_FUNCTION__,
- source_str, group_str,
- source->source_group->group_igmp_sock->fd,
- source->source_group->group_igmp_sock->interface->name,
- input_iface_vif_index);
- }
- return;
- }
- source->source_channel_oil = pim_channel_oil_add(group->group_addr,
- source->source_addr,
- input_iface_vif_index);
- if (!source->source_channel_oil) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", group->group_addr, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", source->source_addr, source_str, sizeof(source_str));
- zlog_warn("%s %s: could not create OIL for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str);
- return;
- }
- }
- if (add_oif(source->source_channel_oil,
- group->group_igmp_sock->interface,
- PIM_OIF_FLAG_PROTO_IGMP)) {
- return;
- }
- /*
- Feed IGMPv3-gathered local membership information into PIM
- per-interface (S,G) state.
- */
- pim_ifchannel_local_membership_add(group->group_igmp_sock->interface,
- source->source_addr, group->group_addr);
- IGMP_SOURCE_DO_FORWARDING(source->source_flags);
- }
- void igmp_source_forward_stop(struct igmp_source *source)
- {
- struct igmp_group *group;
- if (PIM_DEBUG_IGMP_TRACE) {
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", source->source_addr, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", source->source_group->group_addr, group_str, sizeof(group_str));
- zlog_debug("%s: (S,G)=(%s,%s) igmp_sock=%d oif=%s fwd=%d",
- __PRETTY_FUNCTION__,
- source_str, group_str,
- source->source_group->group_igmp_sock->fd,
- source->source_group->group_igmp_sock->interface->name,
- IGMP_SOURCE_TEST_FORWARDING(source->source_flags));
- }
- /* Prevent IGMP interface from removing multicast route multiple
- times */
- if (!IGMP_SOURCE_TEST_FORWARDING(source->source_flags)) {
- return;
- }
- group = source->source_group;
- if (del_oif(source->source_channel_oil,
- group->group_igmp_sock->interface,
- PIM_OIF_FLAG_PROTO_IGMP)) {
- return;
- }
- /*
- Feed IGMPv3-gathered local membership information into PIM
- per-interface (S,G) state.
- */
- pim_ifchannel_local_membership_del(group->group_igmp_sock->interface,
- source->source_addr, group->group_addr);
- IGMP_SOURCE_DONT_FORWARDING(source->source_flags);
- }
- void pim_forward_start(struct pim_ifchannel *ch)
- {
- struct pim_upstream *up = ch->upstream;
- if (PIM_DEBUG_PIM_TRACE) {
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", ch->source_addr, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", ch->group_addr, group_str, sizeof(group_str));
- zlog_debug("%s: (S,G)=(%s,%s) oif=%s",
- __PRETTY_FUNCTION__,
- source_str, group_str, ch->interface->name);
- }
- if (!up->channel_oil) {
- int input_iface_vif_index = fib_lookup_if_vif_index(up->source_addr);
- if (input_iface_vif_index < 1) {
- char source_str[100];
- pim_inet4_dump("<source?>", up->source_addr, source_str, sizeof(source_str));
- zlog_warn("%s %s: could not find input interface for source %s",
- __FILE__, __PRETTY_FUNCTION__,
- source_str);
- return;
- }
- up->channel_oil = pim_channel_oil_add(up->group_addr, up->source_addr,
- input_iface_vif_index);
- if (!up->channel_oil) {
- char group_str[100];
- char source_str[100];
- pim_inet4_dump("<group?>", up->group_addr, group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", up->source_addr, source_str, sizeof(source_str));
- zlog_warn("%s %s: could not create OIL for channel (S,G)=(%s,%s)",
- __FILE__, __PRETTY_FUNCTION__,
- source_str, group_str);
- return;
- }
- }
- add_oif(up->channel_oil,
- ch->interface,
- PIM_OIF_FLAG_PROTO_PIM);
- }
- void pim_forward_stop(struct pim_ifchannel *ch)
- {
- struct pim_upstream *up = ch->upstream;
- if (PIM_DEBUG_PIM_TRACE) {
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", ch->source_addr, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", ch->group_addr, group_str, sizeof(group_str));
- zlog_debug("%s: (S,G)=(%s,%s) oif=%s",
- __PRETTY_FUNCTION__,
- source_str, group_str, ch->interface->name);
- }
- if (!up->channel_oil) {
- char source_str[100];
- char group_str[100];
- pim_inet4_dump("<source?>", ch->source_addr, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", ch->group_addr, group_str, sizeof(group_str));
- zlog_warn("%s: (S,G)=(%s,%s) oif=%s missing channel OIL",
- __PRETTY_FUNCTION__,
- source_str, group_str, ch->interface->name);
- return;
- }
- del_oif(up->channel_oil,
- ch->interface,
- PIM_OIF_FLAG_PROTO_PIM);
- }
|