Hi
When we use dnsmasq with RA enabled, it's obvious that prefixes
announced in RA should be routed through the same router that dnsmasq runs.
This patch adds Route Information Option (RFC 4191 ch 2.3) to every
announced prefix.
--
Best regards,
Ilya Ponetaev
D-Link Corp.
diff --git a/src/radv-protocol.h b/src/radv-protocol.h
index e576012..72ccda4 100644
--- a/src/radv-protocol.h
+++ b/src/radv-protocol.h
@@ -50,6 +50,7 @@ struct prefix_opt {
#define ICMP6_OPT_PREFIX 3
#define ICMP6_OPT_MTU 5
#define ICMP6_OPT_ADV_INTERVAL 7
+#define ICMP6_OPT_RT_INFO 24
#define ICMP6_OPT_RDNSS 25
#define ICMP6_OPT_DNSSL 31
diff --git a/src/radv.c b/src/radv.c
index f5b517b..220ab2f 100644
--- a/src/radv.c
+++ b/src/radv.c
@@ -647,7 +647,23 @@ static int add_prefixes(struct in6_addr *local, int prefix,
inet_ntop(AF_INET6, local, daemon->addrbuff, ADDRSTRLEN);
if (!option_bool(OPT_QUIET_RA))
- my_syslog(MS_DHCP | LOG_INFO, "RTR-ADVERT(%s) %s", param->if_name, daemon->addrbuff);
+ my_syslog(MS_DHCP | LOG_INFO, "RTR-ADVERT(%s) %s", param->if_name, daemon->addrbuff);
+
+ /* Send Route Information option (RFC4191, 2.3) */
+ put_opt6_char(ICMP6_OPT_RT_INFO);
+ /* Always send full-sized prefix, so length in units of 8 octets
+ * will be 1 (header) + 2 (128 bits / 64 bit per unit) = 3
+ * */
+ put_opt6_char(3);
+ put_opt6_char(prefix);
+ /* Medium priority for default
+ * */
+ put_opt6_char(0);
+ /* "valid lifetime" seems more reasonable than "preferred"
+ * */
+ put_opt6_long(valid);
+ /* Send full prefix of 128 bit long with zeroed lower bits */
+ put_opt6((void *)local, 16);
}
}
}
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss