lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 15 Oct 2008 16:55:49 +0100
From:	Pedro Ribeiro <>
To:	David Miller <>
Subject: [PATCH] Fix IPv6 default gateway selection criteria in presence of
 the HIGH/LOW preference option in router advertisements

Problem observed:
               In IPv6, in the presence of multiple routers candidates to
               default gateway in one segment, each sending a different
               value of preference, the Linux hosts connected to the
               segment weren't selecting the right one in all the
               combinations possible of LOW/MEDIUM/HIGH preference.
This patch changes two files:
               Get the "router_pref" bitfield in the right place
               (as RFC4191 says), named the bit left with this fix as
               "home_agent" (RFC3775 say that's his function)

               Corrects the binary logic behind the updating of the
               router preference in the flags of the routing table

               With this two fixes applied, the default route used by
               the system was to consistent with the rules mentioned
               in RFC4191 in case of changes in the value of preference
               in router advertisements

Signed-off-by: Pedro Ribeiro <>

diff -uprN linux-2.6.27/include/linux/icmpv6.h linux-2.6.27fix/include/linux/icmpv6.h
--- linux-2.6.27/include/linux/icmpv6.h	2008-10-09 23:13:53.000000000 +0100
+++ linux-2.6.27fix/include/linux/icmpv6.h	2008-10-14 23:24:31.000000000 +0100
@@ -40,16 +40,18 @@ struct icmp6hdr {
                 struct icmpv6_nd_ra {
 			__u8		hop_limit;
-			__u8		reserved:4,
+			__u8		reserved:3,
+					home_agent:1,
 #elif defined(__BIG_ENDIAN_BITFIELD)
 			__u8		managed:1,
+					home_agent:1,
-					reserved:4;
+					reserved:3;
 #error	"Please fix <asm/byteorder.h>"
diff -uprN linux-2.6.27/net/ipv6/ndisc.c linux-2.6.27fix/net/ipv6/ndisc.c
--- linux-2.6.27/net/ipv6/ndisc.c	2008-10-09 23:13:53.000000000 +0100
+++ linux-2.6.27fix/net/ipv6/ndisc.c	2008-10-14 23:24:31.000000000 +0100
@@ -1199,7 +1199,7 @@ static void ndisc_router_discovery(struc
 		neigh->flags |= NTF_ROUTER;
 	} else if (rt) {
-		rt->rt6i_flags |= (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref);
+		rt->rt6i_flags = (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref);
 	if (rt)

Best regards,

Pedro Ribeiro
IPLNet - Rede de dados e comunicações
Instituto Politécnico de Lisboa (IPL)
Mail: mailto:pribeiro AT
VoIP: sip:pribeiro AT

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists