]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Minor fixme - mkernel oz-pim
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Sun, 11 Mar 2018 23:26:50 +0000 (00:26 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Sun, 11 Mar 2018 23:26:50 +0000 (00:26 +0100)
sysdep/unix/io.c
sysdep/unix/mkrt.c

index e4b8cc373afe43e4983022c7ea588cad39f76e9f..f56f69430f77b7b6e9e80150303119b2d5995034 100644 (file)
@@ -852,7 +852,8 @@ sk_free(resource *r)
       current_sock = sk_next(s);
     if (s == stored_sock)
       stored_sock = sk_next(s);
-    rem_node(&s->n);
+    if (NODE_VALID(&s->n))
+      rem_node(&s->n);
   }
 
   if (s->type != SK_SSH && s->type != SK_SSH_ACTIVE)
index d8566254efac182337862d9f5a7e3c369fa09ed0..ad699e412d07d44ea2f40108bb0f4158c8d2aae5 100644 (file)
@@ -305,24 +305,34 @@ mkrt_rx_hook(sock *sk, uint len)
 {
   struct mkrt_proto *p = sk->data;
   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:
     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_WHOLEPKT:
-    /* These should not happen unless some PIM-specific MRT options are enabled */
-    return 1;
-
   default:
-    // FIXME: Use sk->lifindex or msg->im_vif ?
-    mif_forward_igmp(p->mif_group, NULL, sk, len);
-    return 1;
+    /* These should not happen unless some PIM-specific MRT options are enabled */
+    break;
   }
+  return 1;
 }
 
 static void