projects
/
project
/
odhcpd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4b23559
)
Don't segfault when there is no IPv6 support
author
Steven Barth
<steven@midlink.org>
Thu, 20 Mar 2014 09:30:51 +0000
(10:30 +0100)
committer
Steven Barth
<steven@midlink.org>
Thu, 20 Mar 2014 09:30:51 +0000
(10:30 +0100)
src/ndp.c
patch
|
blob
|
history
src/router.c
patch
|
blob
|
history
diff --git
a/src/ndp.c
b/src/ndp.c
index
e006c85
..
17ec8b4
100644
(file)
--- a/
src/ndp.c
+++ b/
src/ndp.c
@@
-111,6
+111,10
@@
int init_ndp(void)
// Open ICMPv6 socket
ping_socket = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6);
// 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));
int val = 2;
setsockopt(ping_socket, IPPROTO_RAW, IPV6_CHECKSUM, &val, sizeof(val));
diff --git
a/src/router.c
b/src/router.c
index
3ba552d
..
772d770
100644
(file)
--- a/
src/router.c
+++ b/
src/router.c
@@
-88,6
+88,9
@@
int init_router(void)
int setup_router_interface(struct interface *iface, bool enable)
{
int setup_router_interface(struct interface *iface, bool enable)
{
+ if (!fp_route || router_event.uloop.fd < 0)
+ return -1;
+
struct ipv6_mreq all_nodes = {ALL_IPV6_NODES, iface->ifindex};
struct ipv6_mreq all_routers = {ALL_IPV6_ROUTERS, iface->ifindex};
struct ipv6_mreq all_nodes = {ALL_IPV6_NODES, iface->ifindex};
struct ipv6_mreq all_routers = {ALL_IPV6_ROUTERS, iface->ifindex};