]> git.puffer.fish Git - mirror/frr.git/commitdiff
[zebra] Bug #351: Don't redistribute routes to ipv4 link-local prefixes
authorPaul Jakma <paul.jakma@sun.com>
Tue, 10 Apr 2007 19:24:45 +0000 (19:24 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Tue, 10 Apr 2007 19:24:45 +0000 (19:24 +0000)
2007-04-07 Paul Jakma <paul.jakma@sun.com>

* lib/prefix.h: Add define to match IPv4 Link-Local addresses
* zebra/redistribute.c: (zebra_check_addr) Don't redistribute routes
  to IPv4 link-local prefixes, fixes bug #351.
* zebra/redistribute.h: Export zebra_check_addr.
* zebra/router-id.c: (router_id_bad_address) re-use zebra_check_addr
  rather than implementing similar logic.

lib/ChangeLog
lib/prefix.h
zebra/ChangeLog
zebra/redistribute.c
zebra/redistribute.h
zebra/router-id.c

index 99b82b1f3f26d7631e5da62499126f047803b4b1..c58fef297a9c7a4fe26b7208f6b2edca2b99872c 100644 (file)
@@ -1,3 +1,7 @@
+2007-04-07 Paul Jakma <paul.jakma@sun.com>
+
+       * prefix.h: Add define to match IPv4 Link-Local addresses
+
 2007-03-20 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * log.c: (mes_lookup) Make the function more robust: check for
index f2a2adfa77dad4fba18cb560ab4b5059cf15ef23..9cfc15563e844c89bc53efbd68f03d385bb82399 100644 (file)
@@ -111,6 +111,7 @@ struct prefix_rd
 
 #define IPV4_NET0(a)    ((((u_int32_t) (a)) & 0xff000000) == 0x00000000)
 #define IPV4_NET127(a)  ((((u_int32_t) (a)) & 0xff000000) == 0x7f000000)
+#define IPV4_LINKLOCAL(a) ((((u_int32_t) (a)) & 0xffff0000) == 0xa9fe0000)
 
 /* Max bit/byte length of IPv6 address. */
 #define IPV6_MAX_BYTELEN    16
index 97dcd5f5ae1758b1fcd93278176cc0626872c704..602de50dbade429afe593ddd8d8efc38b5cd432b 100644 (file)
@@ -1,3 +1,11 @@
+2007-04-07 Paul Jakma <paul.jakma@sun.com>
+
+       * redistribute.c: (zebra_check_addr) Don't redistribute routes
+         to IPv4 link-local prefixes, fixes bug #351.
+       * redistribute.h: Export zebra_check_addr.
+       * router-id.c: (router_id_bad_address) re-use zebra_check_addr
+         rather than implementing similar logic.
+
 2007-03-06 Paul Jakma <paul.jakma@sun.com>
 
        * kernel_socket.c: (ifam_read) Do not update interface metric on
index 677e6f9082e7f460e34132439aa3ddbe804815ac..b7bd5674a83772b96d3f221381cf5c2f9e3e0552 100644 (file)
@@ -40,7 +40,7 @@
 /* master zebra server structure */
 extern struct zebra_t zebrad;
 
-static int
+int
 zebra_check_addr (struct prefix *p)
 {
   if (p->family == AF_INET)
@@ -50,7 +50,9 @@ zebra_check_addr (struct prefix *p)
       addr = p->u.prefix4.s_addr;
       addr = ntohl (addr);
 
-      if (IPV4_NET127 (addr) || IN_CLASSD (addr))
+      if (IPV4_NET127 (addr)
+          || IN_CLASSD (addr)
+          || IPV4_LINKLOCAL(addr))
        return 0;
     }
 #ifdef HAVE_IPV6
index 9e78dfdee812cc7c4a03f2706f125116b30c00b7..9ed99bc5945122ca7f592cc60e324efe270b264f 100644 (file)
@@ -46,5 +46,7 @@ extern void zebra_interface_address_add_update (struct interface *,
 extern void zebra_interface_address_delete_update (struct interface *,
                                                   struct connected *c);
 
+extern int zebra_check_addr (struct prefix *);
+
 #endif /* _ZEBRA_REDISTRIBUTE_H */
 
index c73b65b5d7a377ec955dba0363005a493a7cd6e7..41bab5456bc37e1d6253f897abc6a8c05f66b5b4 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "zebra/zserv.h"
 #include "zebra/router-id.h"
+#include "zebra/redistribute.h"
 
 static struct list rid_all_sorted_list;
 static struct list rid_lo_sorted_list;
@@ -63,18 +64,13 @@ router_id_find_node (struct list *l, struct connected *ifc)
 static int
 router_id_bad_address (struct connected *ifc)
 {
-  struct prefix n;
-
   if (ifc->address->family != AF_INET)
     return 1;
-
-  n.u.prefix4.s_addr = htonl (INADDR_LOOPBACK);
-  n.prefixlen = 8;
-  n.family = AF_INET;
-
-  if (prefix_match (&n, ifc->address))
+  
+  /* non-redistributable addresses shouldn't be used for RIDs either */
+  if (!zebra_check_addr (ifc->address))
     return 1;
-
+  
   return 0;
 }