[zebra] Bug #351: Don't redistribute routes to ipv4 link-local prefixes

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.
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index 677e6f9..b7bd567 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -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 @@
       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