diff options
author | Steven Barth <steven@midlink.org> | 2014-03-20 10:30:51 +0100 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2014-03-20 10:30:51 +0100 |
commit | a85ccf1aa14d3d860e6ac0e7c56ba4695462afa1 (patch) | |
tree | 9bb5c48111d3d2bd2be249de8276622b1c08aa85 /src/ndp.c | |
parent | 4b23559937ccefd2df7d020219c7962568355a12 (diff) |
Don't segfault when there is no IPv6 support
Diffstat (limited to 'src/ndp.c')
-rw-r--r-- | src/ndp.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -111,6 +111,10 @@ int init_ndp(void) // Open ICMPv6 socket ping_socket = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6); + if (ping_socket < 0) { + syslog(LOG_ERR, "Unable to open raw socket: %s", strerror(errno)); + return -1; + } int val = 2; setsockopt(ping_socket, IPPROTO_RAW, IPV6_CHECKSUM, &val, sizeof(val)); |