summaryrefslogtreecommitdiff
path: root/networking/udhcp/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/packet.c')
-rw-r--r--networking/udhcp/packet.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 272e79df1..41cd32135 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -194,17 +194,14 @@ int udhcp_kernel_packet(struct dhcpMessage *payload,
194 if (fd < 0) 194 if (fd < 0)
195 return -1; 195 return -1;
196 196
197 if (setsockopt_reuseaddr(fd) == -1) { 197 setsockopt_reuseaddr(fd);
198 close(fd);
199 return -1;
200 }
201 198
202 memset(&client, 0, sizeof(client)); 199 memset(&client, 0, sizeof(client));
203 client.sin_family = AF_INET; 200 client.sin_family = AF_INET;
204 client.sin_port = htons(source_port); 201 client.sin_port = htons(source_port);
205 client.sin_addr.s_addr = source_ip; 202 client.sin_addr.s_addr = source_ip;
206 203
207 if (bind(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1) { 204 if (bind(fd, (struct sockaddr *)&client, sizeof(client)) == -1) {
208 close(fd); 205 close(fd);
209 return -1; 206 return -1;
210 } 207 }