0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-03 07:31:54 +00:00

Minor fixme - mkernel

This commit is contained in:
Ondrej Zajicek (work) 2018-03-12 00:26:50 +01:00
parent 33d7612d23
commit e442401e53
2 changed files with 21 additions and 10 deletions

View File

@ -852,6 +852,7 @@ sk_free(resource *r)
current_sock = sk_next(s); current_sock = sk_next(s);
if (s == stored_sock) if (s == stored_sock)
stored_sock = sk_next(s); stored_sock = sk_next(s);
if (NODE_VALID(&s->n))
rem_node(&s->n); rem_node(&s->n);
} }

View File

@ -305,24 +305,34 @@ mkrt_rx_hook(sock *sk, uint len)
{ {
struct mkrt_proto *p = sk->data; struct mkrt_proto *p = sk->data;
struct igmpmsg *msg = (void *) sk->rbuf; struct igmpmsg *msg = (void *) sk->rbuf;
u8 igmp_type = * (u8 *) sk_rx_buffer(sk, &len);
switch (igmp_type) /*
* We need to distinguish kernel upcalls from regular traffic. This can be
* done with field im_mbz, which must-be-zero for upcalls, but it overlaps
* with protocol number in IP header so it is nonzero for regular traffic.
*/
if (msg->im_mbz)
{
/* Regular IGMP messages, just delegate them */
struct mif *mif = mif_find_by_index(p->mif_group, sk->lifindex);
mif_forward_igmp(p->mif_group, mif, sk, len);
return 1;
}
/* Upcalls from kernel, handle then */
switch (msg->im_msgtype)
{ {
case IGMPMSG_NOCACHE: case IGMPMSG_NOCACHE:
mkrt_resolve_mfc(p, ip4_from_in4(msg->im_src), ip4_from_in4(msg->im_dst), msg->im_vif); mkrt_resolve_mfc(p, ip4_from_in4(msg->im_src), ip4_from_in4(msg->im_dst), msg->im_vif);
return 1; break;
case IGMPMSG_WRONGVIF: case IGMPMSG_WRONGVIF:
case IGMPMSG_WHOLEPKT: case IGMPMSG_WHOLEPKT:
/* These should not happen unless some PIM-specific MRT options are enabled */
return 1;
default: default:
// FIXME: Use sk->lifindex or msg->im_vif ? /* These should not happen unless some PIM-specific MRT options are enabled */
mif_forward_igmp(p->mif_group, NULL, sk, len); break;
return 1;
} }
return 1;
} }
static void static void