summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-ndisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-network/sd-ndisc.c')
-rw-r--r--src/libsystemd-network/sd-ndisc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c
index fb4ef55673..8d18707de1 100644
--- a/src/libsystemd-network/sd-ndisc.c
+++ b/src/libsystemd-network/sd-ndisc.c
@@ -517,9 +517,13 @@ static int ndisc_router_advertisment_recv(sd_event_source *s, int fd, uint32_t r
log_ndisc(nd, "Could not receive message from ICMPv6 socket: %m");
return -errno;
- } else if ((size_t)len < sizeof(struct nd_router_advert)) {
+ }
+ if ((size_t) len < sizeof(struct nd_router_advert)) {
+ log_ndisc(nd, "Too small to be a router advertisement: ignoring");
return 0;
- } else if (msg.msg_namelen == 0)
+ }
+
+ if (msg.msg_namelen == 0)
gw = NULL; /* only happens when running the test-suite over a socketpair */
else if (msg.msg_namelen != sizeof(sa.in6)) {
log_ndisc(nd, "Received invalid source address size from ICMPv6 socket: %zu bytes", (size_t)msg.msg_namelen);