Fixes #29050.
return -ENOSYS;
}
+static struct in6_addr dummy_link_local = {
+ .s6_addr = {
+ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x12, 0x34, 0x56, 0xff, 0xfe, 0x78, 0x9a, 0xbc,
+ },
+};
+
int icmp6_receive(
int fd,
void *iov_base,
if (ret_timestamp)
triple_timestamp_get(ret_timestamp);
+ if (ret_sender)
+ *ret_sender = dummy_link_local;
+
return 0;
}
sa.in6.sin6_family == AF_INET6) {
addr = sa.in6.sin6_addr;
- if (!in6_addr_is_link_local(&addr))
+ if (!in6_addr_is_link_local(&addr) && !in6_addr_is_null(&addr))
return -EADDRNOTAVAIL;
} else if (msg.msg_namelen > 0)
if (r < 0)
switch (r) {
case -EADDRNOTAVAIL:
- log_ndisc(nd, "Received RA from non-link-local address. Ignoring.");
+ log_ndisc(nd, "Received RA from neither link-local nor null address. Ignoring.");
return 0;
case -EMULTIHOP:
return 0;
}
+ /* The function icmp6_receive() accepts the null source address, but RFC 4861 Section 6.1.2 states
+ * that hosts MUST discard messages with the null source address. */
+ if (in6_addr_is_null(&rt->address))
+ log_ndisc(nd, "Received RA from null address. Ignoring.");
+
(void) event_source_disable(nd->timeout_event_source);
(void) ndisc_handle_datagram(nd, rt);
return 0;
if (r < 0)
switch (r) {
case -EADDRNOTAVAIL:
- log_radv(ra, "Received RS from non-link-local address. Ignoring");
+ log_radv(ra, "Received RS from neither link-local nor null address. Ignoring");
return 0;
case -EMULTIHOP:
return 0;
}
+ /* TODO: if the sender address is null, check that the message does not have the source link-layer
+ * address option. See RFC 4861 Section 6.1.1. */
+
const char *addr = IN6_ADDR_TO_STRING(&src);
r = radv_send(ra, &src, ra->lifetime_usec);
assert_se(rt);
log_info("--");
- assert_se(sd_ndisc_router_get_address(rt, &addr) == -ENODATA);
+ assert_se(sd_ndisc_router_get_address(rt, &addr) >= 0);
+ log_info("Sender: %s", IN6_ADDR_TO_STRING(&addr));
assert_se(sd_ndisc_router_get_timestamp(rt, CLOCK_REALTIME, &t) >= 0);
log_info("Timestamp: %s", FORMAT_TIMESTAMP(t));
return -ENOSYS;
}
+static struct in6_addr dummy_link_local = {
+ .s6_addr = {
+ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x12, 0x34, 0x56, 0xff, 0xfe, 0x78, 0x9a, 0xbc,
+ },
+};
+
int icmp6_receive(
int fd,
void *iov_base,
if (ret_timestamp)
triple_timestamp_get(ret_timestamp);
+ if (ret_sender)
+ *ret_sender = dummy_link_local;
+
return 0;
}