summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv4.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-05-16 21:36:16 +0200
committerHans Dedecker <dedeckeh@gmail.com>2018-05-16 21:37:50 +0200
commitd834ae3ca59cf75cd7f26a5201a7223eaa468fbb (patch)
tree960a57d7644decfb82c817a4a31659ecf16388d6 /src/dhcpv4.c
parentf2aa383f9ca085f4e261703d71b9039b487b89bb (diff)
dhcpv4: fix error checking in dhcpv4_setup_interface()
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv4.c')
-rw-r--r--src/dhcpv4.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index b803359..3002c1e 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -113,7 +113,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable)
}
if (setsockopt(iface->dhcpv4_event.uloop.fd, IPPROTO_IP, IP_PKTINFO,
- &val, sizeof(val))) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IP_PKTINFO): %m");
ret = -1;
goto out;
@@ -121,7 +121,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable)
val = IPTOS_PREC_INTERNETCONTROL;
if (setsockopt(iface->dhcpv4_event.uloop.fd, IPPROTO_IP, IP_TOS,
- &val, sizeof(val))) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IP_TOS): %m");
ret = -1;
goto out;
@@ -129,20 +129,21 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable)
val = IP_PMTUDISC_DONT;
if (setsockopt(iface->dhcpv4_event.uloop.fd, IPPROTO_IP, IP_MTU_DISCOVER,
- &val, sizeof(val))) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IP_MTU_DISCOVER): %m");
ret = -1;
goto out;
}
if (setsockopt(iface->dhcpv4_event.uloop.fd, SOL_SOCKET, SO_BINDTODEVICE,
- iface->ifname, strlen(iface->ifname))) {
+ iface->ifname, strlen(iface->ifname)) < 0) {
syslog(LOG_ERR, "setsockopt(SO_BINDTODEVICE): %m");
ret = -1;
goto out;
}
- if (bind(iface->dhcpv4_event.uloop.fd, (struct sockaddr*)&bind_addr, sizeof(bind_addr))) {
+ if (bind(iface->dhcpv4_event.uloop.fd, (struct sockaddr*)&bind_addr,
+ sizeof(bind_addr)) < 0) {
syslog(LOG_ERR, "bind(): %m");
ret = -1;
goto out;