From 92f8f7e3a3a5a42768c18c1f3d4d8f9f98150c61 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Tue, 24 Apr 2012 16:31:17 +0200 Subject: [PATCH 1/4] Small bug in detection of class-A networks. --- lib/ipv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ipv4.c b/lib/ipv4.c index 8488a286..751351ca 100644 --- a/lib/ipv4.c +++ b/lib/ipv4.c @@ -60,7 +60,7 @@ ipv4_class_mask(u32 a) if (a < 0x80000000) m = 0xff000000; - if (a < 0xc0000000) + else if (a < 0xc0000000) m = 0xffff0000; else m = 0xffffff00; From d760229ab897fa1bf1fd0fe7019cc2431d21a1cc Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Wed, 8 Aug 2012 14:10:31 +0200 Subject: [PATCH 2/4] DragonFly support add - thanks to john@marino.st --- configure.in | 4 ++++ sysdep/bsd/sysio.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/configure.in b/configure.in index dd57ab51..54993dfc 100644 --- a/configure.in +++ b/configure.in @@ -142,6 +142,10 @@ else ;; ipv4:freebsd*) sysdesc=bsd ;; + ipv6:dragonfly*) sysdesc=bsd-v6 + ;; + ipv4:dragonfly*) sysdesc=bsd + ;; ipv6:kfreebsd*) sysdesc=bsd-v6 ;; ipv4:kfreebsd*) sysdesc=bsd diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h index f0b5f401..4f91def5 100644 --- a/sysdep/bsd/sysio.h +++ b/sysdep/bsd/sysio.h @@ -6,6 +6,9 @@ * Can be freely distributed and used under the terms of the GNU GPL. */ +#ifdef __DragonFly__ +#define TCP_MD5SIG TCP_SIGNATURE_ENABLE +#endif #ifdef IPV6 static inline void From 8ecbaf9c70b802a1200ad37f2bfd4bc64173c5fe Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 16 Aug 2012 13:09:26 +0200 Subject: [PATCH 3/4] Fixes a bug with neighbor cache and overlapping IP prefixes. When there are overlapping IP prefixes and one disappears, neighbors associated with it was removed even if there is another covering IP prefix. --- nest/neighbor.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/nest/neighbor.c b/nest/neighbor.c index 506d9bde..9dce8119 100644 --- a/nest/neighbor.c +++ b/nest/neighbor.c @@ -114,7 +114,7 @@ neighbor * neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags) { neighbor *n; - int class, scope = -1; ; + int class, scope = -1; unsigned int h = neigh_hash(p, a); struct iface *i; @@ -240,7 +240,21 @@ neigh_down(neighbor *n) n->proto->neigh_notify(n); rem_node(&n->n); if (n->flags & NEF_STICKY) - add_tail(&sticky_neigh_list, &n->n); + { + add_tail(&sticky_neigh_list, &n->n); + + /* Respawn neighbor if there is another matching prefix */ + struct iface *i; + int scope; + + if (!n->iface) + WALK_LIST(i, iface_list) + if ((scope = if_connected(&n->addr, i)) >= 0) + { + neigh_up(n, i, scope); + return; + } + } else sl_free(neigh_slab, n); } From 0343d066dab077d1391640c53198199b16bef993 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 29 Aug 2012 12:42:49 +0200 Subject: [PATCH 4/4] Fixes a bug in primary IP selection. --- sysdep/unix/krt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 2bd1bc44..2128e136 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -113,13 +113,19 @@ kif_request_scan(void) tm_start(kif_scan_timer, 1); } -static inline int -prefer_scope(struct ifa *a, struct ifa *b) -{ return (a->scope > SCOPE_LINK) && (b->scope <= SCOPE_LINK); } - static inline int prefer_addr(struct ifa *a, struct ifa *b) -{ return ipa_compare(a->ip, b->ip) < 0; } +{ + int sa = a->scope > SCOPE_LINK; + int sb = b->scope > SCOPE_LINK; + + if (sa < sb) + return 0; + else if (sa > sb) + return 1; + else + return ipa_compare(a->ip, b->ip) < 0; +} static inline struct ifa * find_preferred_ifa(struct iface *i, ip_addr prefix, ip_addr mask) @@ -130,7 +136,7 @@ find_preferred_ifa(struct iface *i, ip_addr prefix, ip_addr mask) { if (!(a->flags & IA_SECONDARY) && ipa_equal(ipa_and(a->ip, mask), prefix) && - (!b || prefer_scope(a, b) || prefer_addr(a, b))) + (!b || prefer_addr(a, b))) b = a; }