pimd: Register with kernel to get unknown multicast packets

Start the process of creating the pimreg vif device so that
we can get the callbacks from the kernel with the multicast packets

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2015-10-19 18:23:16 -07:00 committed by Donald Sharp
parent 7d20b83094
commit b45cefcb44
4 changed files with 9 additions and 6 deletions

View File

@ -2143,7 +2143,7 @@ DEFUN (show_ip_multicast,
qpim_mroute_oif_highest_vif_index,
VTY_NEWLINE);
vty_out(vty, "Maximum highest VifIndex: %d%s",
MAXVIFS - 1,
MAXVIFS - 2,
VTY_NEWLINE);
vty_out(vty, "%s", VTY_NEWLINE);

View File

@ -647,7 +647,7 @@ int pim_if_add_vif(struct interface *ifp)
return -4;
}
if (pim_mroute_add_vif(ifp->ifindex, ifaddr)) {
if (pim_mroute_add_vif(ifp->ifindex, ifaddr, 0)) {
/* pim_mroute_add_vif reported error */
return -5;
}

View File

@ -259,6 +259,7 @@ static void mroute_read_off()
int pim_mroute_socket_enable()
{
int fd;
struct in_addr pimreg = { .s_addr = 0 };
if (PIM_MROUTE_IS_ENABLED)
return -1;
@ -287,6 +288,8 @@ int pim_mroute_socket_enable()
}
qpim_mroute_socket_fd = fd;
pim_mroute_add_vif(MAXVIFS-1, pimreg, VIFF_REGISTER);
qpim_mroute_socket_creation = pim_time_monotonic_sec();
mroute_read_on();
@ -325,7 +328,7 @@ int pim_mroute_socket_disable()
would be used for multicast forwarding, a corresponding multicast
interface must be added to the kernel.
*/
int pim_mroute_add_vif(int vif_index, struct in_addr ifaddr)
int pim_mroute_add_vif(int vif_index, struct in_addr ifaddr, unsigned char flags)
{
struct vifctl vc;
int err;
@ -338,7 +341,7 @@ int pim_mroute_add_vif(int vif_index, struct in_addr ifaddr)
memset(&vc, 0, sizeof(vc));
vc.vifc_vifi = vif_index;
vc.vifc_flags = 0;
vc.vifc_flags = flags;
vc.vifc_threshold = PIM_MROUTE_MIN_TTL;
vc.vifc_rate_limit = 0;
memcpy(&vc.vifc_lcl_addr, &ifaddr, sizeof(vc.vifc_lcl_addr));
@ -349,7 +352,7 @@ int pim_mroute_add_vif(int vif_index, struct in_addr ifaddr)
}
#endif
err = setsockopt(qpim_mroute_socket_fd, IPPROTO_IP, MRT_ADD_VIF, (void*) &vc, sizeof(vc));
err = setsockopt(qpim_mroute_socket_fd, IPPROTO_IP, MRT_ADD_VIF, (void*) &vc, sizeof(vc));
if (err) {
char ifaddr_str[100];
int e = errno;

View File

@ -166,7 +166,7 @@ struct igmpmsg
int pim_mroute_socket_enable(void);
int pim_mroute_socket_disable(void);
int pim_mroute_add_vif(int vif_index, struct in_addr ifaddr);
int pim_mroute_add_vif(int vif_index, struct in_addr ifaddr, unsigned char flags);
int pim_mroute_del_vif(int vif_index);
int pim_mroute_add(struct mfcctl *mc);