]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BSD: if failed to open PF_ROUTE socket, don't set filters.
authorRoy Marples <roy@marples.name>
Fri, 21 Apr 2017 22:21:59 +0000 (23:21 +0100)
committerRoy Marples <roy@marples.name>
Fri, 21 Apr 2017 22:22:59 +0000 (23:22 +0100)
src/if-bsd.c

index d2f0dc622bc966b62315df316940336b98a96158..addca622f43bf97da027095aa05ca21441102d64 100644 (file)
@@ -153,6 +153,8 @@ if_opensockets_os(struct dhcpcd_ctx *ctx)
 #define SOCK_FLAGS     (SOCK_CLOEXEC | SOCK_NONBLOCK)
        ctx->link_fd = xsocket(PF_ROUTE, SOCK_RAW | SOCK_FLAGS, AF_UNSPEC);
 #undef SOCK_FLAGS
+       if (ctx->link_fd == -1)
+               return -1;
 
 #if defined(RO_MSGFILTER)
        if (setsockopt(ctx->link_fd, PF_ROUTE, RO_MSGFILTER,
@@ -168,7 +170,7 @@ if_opensockets_os(struct dhcpcd_ctx *ctx)
                logerr(__func__);
 #endif
 
-       return ctx->link_fd == -1 ? -1 : 0;
+       return 0;
 }
 
 void