mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Handle options other than source link-layer address in router solicitations.
RFC 4861 para 4.1 is a MUST.
This commit is contained in:
24
src/radv.c
24
src/radv.c
@@ -198,21 +198,29 @@ void icmp6_packet(time_t now)
|
|||||||
{
|
{
|
||||||
char *mac = "";
|
char *mac = "";
|
||||||
struct dhcp_bridge *bridge, *alias;
|
struct dhcp_bridge *bridge, *alias;
|
||||||
|
ssize_t rem;
|
||||||
|
unsigned char *p;
|
||||||
|
int opt_sz;
|
||||||
|
|
||||||
#ifdef HAVE_DUMPFILE
|
#ifdef HAVE_DUMPFILE
|
||||||
dump_packet(DUMP_RA, (void *)packet, sz, (union mysockaddr *)&from, NULL, -1);
|
dump_packet(DUMP_RA, (void *)packet, sz, (union mysockaddr *)&from, NULL, -1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* look for link-layer address option for logging */
|
/* look for link-layer address option for logging */
|
||||||
if (sz >= 16 && packet[8] == ICMP6_OPT_SOURCE_MAC && (packet[9] * 8) + 8 <= sz)
|
for (rem = sz - 8, p = &packet[8]; rem >= 2; rem -= opt_sz, p += opt_sz)
|
||||||
{
|
{
|
||||||
if ((packet[9] * 8 - 2) * 3 - 1 >= MAXDNAME) {
|
opt_sz = p[1] * 8;
|
||||||
return;
|
|
||||||
}
|
if (opt_sz == 0 || opt_sz > rem)
|
||||||
print_mac(daemon->namebuff, &packet[10], (packet[9] * 8) - 2);
|
return; /* Bad packet */
|
||||||
mac = daemon->namebuff;
|
|
||||||
|
if (p[0] == ICMP6_OPT_SOURCE_MAC && ((opt_sz - 2) * 3 - 1 < MAXDNAME))
|
||||||
|
{
|
||||||
|
print_mac(daemon->namebuff, &p[2], opt_sz - 2);
|
||||||
|
mac = daemon->namebuff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!option_bool(OPT_QUIET_RA))
|
if (!option_bool(OPT_QUIET_RA))
|
||||||
my_syslog(MS_DHCP | LOG_INFO, "RTR-SOLICIT(%s) %s", interface, mac);
|
my_syslog(MS_DHCP | LOG_INFO, "RTR-SOLICIT(%s) %s", interface, mac);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user