summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6.c
diff options
context:
space:
mode:
authorHans Dedecker <hans.dedecker@technicolor.com>2013-12-05 13:54:19 +0100
committerHans Dedecker <hans.dedecker@technicolor.com>2013-12-05 13:54:19 +0100
commit0b68cabeb40d6e24a677a9332d3f3db163b5d723 (patch)
treede82280197e4a1c596f429f495a80102ca8eeb1c /src/dhcpv6.c
parent47bcdec8bd3bea91ef0510cdef7702bd559e8369 (diff)
Fix possible SEGFAULT conditions
Diffstat (limited to 'src/dhcpv6.c')
-rw-r--r--src/dhcpv6.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 9515f40..7560a75 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -40,6 +40,11 @@ static struct odhcpd_event dhcpv6_event = {{.fd = -1}, handle_dhcpv6};
int init_dhcpv6(void)
{
int sock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP);
+ if (sock < 0) {
+ syslog(LOG_ERR, "Failed to create DHCPv6 server socket: %s",
+ strerror(errno));
+ return -1;
+ }
// Basic IPv6 configuration
int val = 1;
@@ -91,8 +96,7 @@ int setup_dhcpv6_interface(struct interface *iface, bool enable)
IPV6_ADD_MEMBERSHIP, &server, sizeof(server));
}
- setup_dhcpv6_ia_interface(iface, enable);
- return 0;
+ return setup_dhcpv6_ia_interface(iface, enable);
}