summaryrefslogtreecommitdiffstats
path: root/lib/prefix.h
diff options
context:
space:
mode:
authorPradosh Mohapatra <pmohapat@cumulusnetworks.com>2014-01-12 18:30:13 +0000
committerVincent JARDIN <vincent.jardin@6wind.com>2014-02-10 09:37:30 +0100
commit6ee06fa9ed91412cb745668d462031cdbe2642e0 (patch)
tree107e951abc716c2ca15fbcc62bdb0858b35036e8 /lib/prefix.h
parenta83a1e9c2f035d3152451dcfc97ab13b4ac427b9 (diff)
downloadquagga-6ee06fa9ed91412cb745668d462031cdbe2642e0.tar.bz2
quagga-6ee06fa9ed91412cb745668d462031cdbe2642e0.tar.xz
bgpd: bgpd-set-v4-nexthop-for-v6-peering.patch
BGP: While advertising v4 prefixes over a v6 session, set the correct v4 nexthop. ISSUE: For an IPv6 peer, BGPd sets the local router-id as the next-hop's v4 address. This is incorrect as the router-id may not be a valid next-hop to be included in UPDATEs that contain v4 prefixes. PATCH: Set the v4 address in the next-hop field based on the interface that the peering is on (directly connected interface or loopback). Signed-off-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com> Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com> Acked-by: Feng Lu <lu.feng@6wind.com>
Diffstat (limited to 'lib/prefix.h')
-rw-r--r--lib/prefix.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/prefix.h b/lib/prefix.h
index 7f0d3607..8c8992e8 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -196,4 +196,14 @@ extern const char *inet6_ntoa (struct in6_addr);
extern int all_digit (const char *);
+static inline int ipv4_martian (struct in_addr *addr)
+{
+ in_addr_t ip = addr->s_addr;
+
+ if (IPV4_NET0(ip) || IPV4_NET127(ip) || IPV4_CLASS_DE(ip)) {
+ return 1;
+ }
+ return 0;
+}
+
#endif /* _ZEBRA_PREFIX_H */