diff options
-rw-r--r-- | nhrpd/netlink.h | 1 | ||||
-rw-r--r-- | nhrpd/nhrp_multicast.c | 23 | ||||
-rw-r--r-- | nhrpd/nhrp_vty.c | 30 | ||||
-rw-r--r-- | nhrpd/nhrpd.h | 2 |
4 files changed, 42 insertions, 14 deletions
diff --git a/nhrpd/netlink.h b/nhrpd/netlink.h index 74cb81daa..5e971cabf 100644 --- a/nhrpd/netlink.h +++ b/nhrpd/netlink.h @@ -13,6 +13,7 @@ union sockunion; struct interface; extern int netlink_nflog_group; +extern int netlink_mcast_nflog_group; extern int netlink_req_fd; void netlink_init(void); diff --git a/nhrpd/nhrp_multicast.c b/nhrpd/nhrp_multicast.c index 42e3baaee..822a63b5f 100644 --- a/nhrpd/nhrp_multicast.c +++ b/nhrpd/nhrp_multicast.c @@ -30,7 +30,7 @@ DEFINE_MTYPE_STATIC(NHRPD, NHRP_MULTICAST, "NHRP Multicast") -static int netlink_mcast_nflog_group; +int netlink_mcast_nflog_group; static int netlink_mcast_log_fd = -1; static struct thread *netlink_mcast_log_thread; @@ -201,15 +201,7 @@ static void netlink_mcast_log_register(int fd, int group) zbuf_free(zb); } -static int nhrp_multicast_free(struct interface *ifp, - struct nhrp_multicast *mcast) -{ - list_del(&mcast->list_entry); - XFREE(MTYPE_NHRP_MULTICAST, mcast); - return 0; -} - -static void netlink_mcast_set_nflog_group(struct interface *ifp, int nlgroup) +void netlink_mcast_set_nflog_group(int nlgroup) { if (netlink_mcast_log_fd >= 0) { THREAD_OFF(netlink_mcast_log_thread); @@ -232,6 +224,14 @@ static void netlink_mcast_set_nflog_group(struct interface *ifp, int nlgroup) } } +static int nhrp_multicast_free(struct interface *ifp, + struct nhrp_multicast *mcast) +{ + list_del(&mcast->list_entry); + XFREE(MTYPE_NHRP_MULTICAST, mcast); + return 0; +} + int nhrp_multicast_add(struct interface *ifp, afi_t afi, union sockunion *nbma_addr) { @@ -252,9 +252,6 @@ int nhrp_multicast_add(struct interface *ifp, afi_t afi, }; list_add_tail(&mcast->list_entry, &nifp->afi[afi].mcastlist_head); - if (netlink_mcast_log_fd == -1) - netlink_mcast_set_nflog_group(ifp, MCAST_NFLOG_GROUP); - sockunion2str(nbma_addr, buf, sizeof(buf)); debugf(NHRP_DEBUG_COMMON, "Adding multicast entry (%s)", buf); diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c index c16a816a3..48365bafb 100644 --- a/nhrpd/nhrp_vty.c +++ b/nhrpd/nhrp_vty.c @@ -187,6 +187,9 @@ static int nhrp_config_write(struct vty *vty) if (netlink_nflog_group) { vty_out(vty, "nhrp nflog-group %d\n", netlink_nflog_group); } + if (netlink_mcast_nflog_group) + vty_out(vty, "nhrp multicast-nflog-group %d\n", + netlink_mcast_nflog_group); return 0; } @@ -257,6 +260,31 @@ DEFUN(no_nhrp_nflog_group, no_nhrp_nflog_group_cmd, return CMD_SUCCESS; } +DEFUN(nhrp_multicast_nflog_group, nhrp_multicast_nflog_group_cmd, + "nhrp multicast-nflog-group (1-65535)", + NHRP_STR + "Specify NFLOG group number for Multicast Packets\n" + "NFLOG group number\n") +{ + uint32_t nfgroup; + + nfgroup = strtoul(argv[2]->arg, NULL, 10); + netlink_mcast_set_nflog_group(nfgroup); + + return CMD_SUCCESS; +} + +DEFUN(no_nhrp_multicast_nflog_group, no_nhrp_multicast_nflog_group_cmd, + "no nhrp multicast-nflog-group [(1-65535)]", + NO_STR + NHRP_STR + "Specify NFLOG group number\n" + "NFLOG group number\n") +{ + netlink_mcast_set_nflog_group(0); + return CMD_SUCCESS; +} + DEFUN(tunnel_protection, tunnel_protection_cmd, "tunnel protection vici profile PROFILE [fallback-profile FALLBACK]", "NHRP/GRE integration\n" @@ -1234,6 +1262,8 @@ void nhrp_config_init(void) install_element(CONFIG_NODE, &no_nhrp_event_socket_cmd); install_element(CONFIG_NODE, &nhrp_nflog_group_cmd); install_element(CONFIG_NODE, &no_nhrp_nflog_group_cmd); + install_element(CONFIG_NODE, &nhrp_multicast_nflog_group_cmd); + install_element(CONFIG_NODE, &no_nhrp_multicast_nflog_group_cmd); /* interface specific commands */ install_node(&nhrp_interface_node); diff --git a/nhrpd/nhrpd.h b/nhrpd/nhrpd.h index db7828f71..5562916ae 100644 --- a/nhrpd/nhrpd.h +++ b/nhrpd/nhrpd.h @@ -24,7 +24,6 @@ DECLARE_MGROUP(NHRPD); #define NHRP_VTY_PORT 2610 #define NHRP_DEFAULT_CONFIG "nhrpd.conf" -#define MCAST_NFLOG_GROUP 224 extern struct thread_master *master; @@ -367,6 +366,7 @@ void nhrp_multicast_interface_del(struct interface *ifp); void nhrp_multicast_foreach(struct interface *ifp, afi_t afi, void (*cb)(struct nhrp_multicast *, void *), void *ctx); +void netlink_mcast_set_nflog_group(int nlgroup); void nhrp_route_update_nhrp(const struct prefix *p, struct interface *ifp); void nhrp_route_announce(int add, enum nhrp_cache_type type, |