diff options
Diffstat (limited to 'pimd/pim_pim.c')
| -rw-r--r-- | pimd/pim_pim.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 1baa5c38ca..f0f4a7139b 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -26,6 +26,7 @@ #include "network.h" #include "pimd.h" +#include "pim_instance.h" #include "pim_pim.h" #include "pim_time.h" #include "pim_iface.h" @@ -593,13 +594,24 @@ static int pim_msg_send_frame(int fd, char *buf, size_t len, } int pim_msg_send(int fd, pim_addr src, pim_addr dst, uint8_t *pim_msg, - int pim_msg_size, const char *ifname) + int pim_msg_size, struct interface *ifp) { socklen_t tolen; unsigned char buffer[10000]; unsigned char *msg_start; uint8_t ttl; struct pim_msg_header *header; + struct pim_interface *pim_ifp; + + pim_ifp = ifp->info; + + if (pim_ifp->pim_passive_enable) { + if (PIM_DEBUG_PIM_PACKETS) + zlog_debug( + "skip sending PIM message on passive interface %s", + ifp->name); + return 0; + } memset(buffer, 0, 10000); @@ -672,7 +684,7 @@ int pim_msg_send(int fd, pim_addr src, pim_addr dst, uint8_t *pim_msg, if (PIM_DEBUG_PIM_PACKETS) zlog_debug("%s: to %pPA on %s: msg_size=%d checksum=%x", - __func__, &dst, ifname, pim_msg_size, + __func__, &dst, ifp->name, pim_msg_size, header->checksum); if (PIM_DEBUG_PIM_PACKETDUMP_SEND) { @@ -680,7 +692,7 @@ int pim_msg_send(int fd, pim_addr src, pim_addr dst, uint8_t *pim_msg, } pim_msg_send_frame(fd, (char *)buffer, sendlen, (struct sockaddr *)&to, - tolen, ifname); + tolen, ifp->name); return 0; } @@ -725,7 +737,7 @@ static int hello_send(struct interface *ifp, uint16_t holdtime) if (pim_msg_send(pim_ifp->pim_sock_fd, pim_ifp->primary_address, qpim_all_pim_routers_addr, pim_msg, pim_msg_size, - ifp->name)) { + ifp)) { if (PIM_DEBUG_PIM_HELLO) { zlog_debug( "%s: could not send PIM message on interface %s", @@ -754,8 +766,10 @@ int pim_hello_send(struct interface *ifp, uint16_t holdtime) return -1; } - ++pim_ifp->pim_ifstat_hello_sent; - PIM_IF_FLAG_SET_HELLO_SENT(pim_ifp->flags); + if (!pim_ifp->pim_passive_enable) { + ++pim_ifp->pim_ifstat_hello_sent; + PIM_IF_FLAG_SET_HELLO_SENT(pim_ifp->flags); + } return 0; } |
