]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: support unnumbered operation
authorChristian Franke <chris@opensourcerouting.org>
Sat, 6 May 2017 13:50:47 +0000 (15:50 +0200)
committerChristian Franke <chris@opensourcerouting.org>
Sat, 6 May 2017 13:50:47 +0000 (15:50 +0200)
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
isisd/isis_pdu.c
isisd/isis_zebra.c

index 9e90acf2e009278562923f7b7e1ae8b54e41d6f9..5232666bda42db0b9c98d9004a6f982d6da070a3 100644 (file)
 #define PNBBY 8
 #endif /* PNBBY */
 
-/* Utility mask array. */
-static const u_char maskbit[] = {
-  0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff
-};
-
 /*
  * HELPER FUNCS
  */
@@ -93,69 +88,6 @@ area_match (struct list *left, struct list *right)
   return 0;                    /* mismatch */
 }
 
-/*
- * Check if ip2 is in the ip1's network (function like Prefix.h:prefix_match() )
- * param ip1            the IS interface ip address structure
- * param ip2            the IIH's ip address
- * return  0            the IIH's IP is not in the IS's subnetwork
- *         1            the IIH's IP is in the IS's subnetwork
- */
-static int
-ip_same_subnet (struct prefix_ipv4 *ip1, struct in_addr *ip2)
-{
-  u_char *addr1, *addr2;
-  int shift, offset, offsetloop;
-  int len;
-
-  addr1 = (u_char *) & ip1->prefix.s_addr;
-  addr2 = (u_char *) & ip2->s_addr;
-  len = ip1->prefixlen;
-
-  shift = len % PNBBY;
-  offsetloop = offset = len / PNBBY;
-
-  while (offsetloop--)
-    if (addr1[offsetloop] != addr2[offsetloop])
-      return 0;
-
-  if (shift)
-    if (maskbit[shift] & (addr1[offset] ^ addr2[offset]))
-      return 0;
-
-  return 1;                    /* match  */
-}
-
-/*
- * Compares two set of ip addresses
- * param left     the local interface's ip addresses
- * param right    the iih interface's ip address
- * return         0   no match;
- *                1   match;
- */
-static int
-ip_match (struct list *left, struct list *right)
-{
-  struct prefix_ipv4 *ip1;
-  struct in_addr *ip2;
-  struct listnode *node1, *node2;
-
-  if ((left == NULL) || (right == NULL))
-    return 0;
-  
-  for (ALL_LIST_ELEMENTS_RO (left, node1, ip1))
-  {
-    for (ALL_LIST_ELEMENTS_RO (right, node2, ip2))
-    {
-      if (ip_same_subnet (ip1, ip2))
-       {
-         return 1;             /* match */
-       }
-    }
-
-  }
-  return 0;
-}
-
 /*
  * Checks whether we should accept a PDU of given level 
  */
@@ -517,16 +449,14 @@ process_p2p_hello (struct isis_circuit *circuit)
     }
 
   /*
-   * check if it's own interface ip match iih ip addrs
+   * check if both ends have an IPv4 address
    */
-  if (found & TLVFLAG_IPV4_ADDR)
+  if (circuit->ip_addrs && listcount(circuit->ip_addrs)
+      && tlvs.ipv4_addrs && listcount(tlvs.ipv4_addrs))
     {
-      if (ip_match (circuit->ip_addrs, tlvs.ipv4_addrs))
-       v4_usable = 1;
-      else
-       zlog_warn ("ISIS-Adj: IPv4 addresses present but no overlap "
-                  "in P2P IIH from %s\n", circuit->interface->name);
+      v4_usable = 1;
     }
+
   if (found & TLVFLAG_IPV6_ADDR)
     {
       /* TBA: check that we have a linklocal ourselves? */
@@ -1116,16 +1046,14 @@ process_lan_hello (int level, struct isis_circuit *circuit, const u_char *ssnpa)
     }
 
   /*
-   * check if it's own interface ip match iih ip addrs
+   * check if both ends have an IPv4 address
    */
-  if (found & TLVFLAG_IPV4_ADDR)
+  if (circuit->ip_addrs && listcount(circuit->ip_addrs)
+      && tlvs.ipv4_addrs && listcount(tlvs.ipv4_addrs))
     {
-      if (ip_match (circuit->ip_addrs, tlvs.ipv4_addrs))
-       v4_usable = 1;
-      else
-       zlog_warn ("ISIS-Adj: IPv4 addresses present but no overlap "
-                  "in LAN IIH from %s\n", circuit->interface->name);
+      v4_usable = 1;
     }
+
   if (found & TLVFLAG_IPV6_ADDR)
     {
       /* TBA: check that we have a linklocal ourselves? */
index e7bd99c3e84d073f669805c6055671b398fed948..3b128a689d78e3015aff0be025108132156de7d6 100644 (file)
@@ -300,8 +300,9 @@ isis_zebra_route_add_ipv4 (struct prefix *prefix,
          /* FIXME: can it be ? */
          if (nexthop->ip.s_addr != INADDR_ANY)
            {
-             stream_putc (stream, NEXTHOP_TYPE_IPV4);
+             stream_putc (stream, NEXTHOP_TYPE_IPV4_IFINDEX);
              stream_put_in_addr (stream, &nexthop->ip);
+             stream_putl (stream, nexthop->ifindex);
            }
          else
            {