aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/packet.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-11-07 15:44:46 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-11-07 15:44:46 +0100
commit50089fc61c1dbb3d09c4bee21ab6d2aa44361ff9 (patch)
tree04dcdb3027c118ce5069077ff246f6f05d64c138 /networking/udhcp/packet.c
parent0fd4347cedd1d32341e827c04dd36aaaf2e8040d (diff)
downloadbusybox-w32-50089fc61c1dbb3d09c4bee21ab6d2aa44361ff9.tar.gz
busybox-w32-50089fc61c1dbb3d09c4bee21ab6d2aa44361ff9.tar.bz2
busybox-w32-50089fc61c1dbb3d09c4bee21ab6d2aa44361ff9.zip
udhcpc: trim help text, rename badly-named variable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/packet.c')
-rw-r--r--networking/udhcp/packet.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index bd754f766..33c9585cf 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -182,7 +182,7 @@ int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
182 uint32_t source_nip, int source_port, 182 uint32_t source_nip, int source_port,
183 uint32_t dest_nip, int dest_port) 183 uint32_t dest_nip, int dest_port)
184{ 184{
185 struct sockaddr_in client; 185 struct sockaddr_in sa;
186 unsigned padding; 186 unsigned padding;
187 int fd; 187 int fd;
188 int result = -1; 188 int result = -1;
@@ -195,26 +195,25 @@ int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
195 } 195 }
196 setsockopt_reuseaddr(fd); 196 setsockopt_reuseaddr(fd);
197 197
198 memset(&client, 0, sizeof(client)); 198 memset(&sa, 0, sizeof(sa));
199 client.sin_family = AF_INET; 199 sa.sin_family = AF_INET;
200 client.sin_port = htons(source_port); 200 sa.sin_port = htons(source_port);
201 client.sin_addr.s_addr = source_nip; 201 sa.sin_addr.s_addr = source_nip;
202 if (bind(fd, (struct sockaddr *)&client, sizeof(client)) == -1) { 202 if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
203 msg = "bind(%s)"; 203 msg = "bind(%s)";
204 goto ret_close; 204 goto ret_close;
205 } 205 }
206 206
207 memset(&client, 0, sizeof(client)); 207 memset(&sa, 0, sizeof(sa));
208 client.sin_family = AF_INET; 208 sa.sin_family = AF_INET;
209 client.sin_port = htons(dest_port); 209 sa.sin_port = htons(dest_port);
210 client.sin_addr.s_addr = dest_nip; 210 sa.sin_addr.s_addr = dest_nip;
211 if (connect(fd, (struct sockaddr *)&client, sizeof(client)) == -1) { 211 if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
212 msg = "connect"; 212 msg = "connect";
213 goto ret_close; 213 goto ret_close;
214 } 214 }
215 215
216 udhcp_dump_packet(dhcp_pkt); 216 udhcp_dump_packet(dhcp_pkt);
217
218 padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); 217 padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options);
219 result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding); 218 result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding);
220 msg = "write"; 219 msg = "write";