From 50089fc61c1dbb3d09c4bee21ab6d2aa44361ff9 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 7 Nov 2011 15:44:46 +0100 Subject: udhcpc: trim help text, rename badly-named variable Signed-off-by: Denys Vlasenko --- networking/udhcp/dhcpc.c | 6 +++--- networking/udhcp/packet.c | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'networking') diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index f202ecf..3a4ef9e 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -1055,7 +1055,7 @@ static void client_background(void) //usage:#endif //usage:#define udhcpc_trivial_usage //usage: "[-fbnq"IF_UDHCP_VERBOSE("v")"oCRB] [-i IFACE] [-r IP] [-s PROG] [-p PIDFILE]\n" -//usage: " [-H HOSTNAME] [-V VENDOR] [-x OPT:VAL]... [-O OPT]..." IF_FEATURE_UDHCP_PORT(" [-P N]") +//usage: " [-V VENDOR] [-x OPT:VAL]... [-O OPT]..." IF_FEATURE_UDHCP_PORT(" [-P N]") //usage:#define udhcpc_full_usage "\n" //usage: IF_LONG_OPTS( //usage: "\n -i,--interface IFACE Interface to use (default eth0)" @@ -1132,8 +1132,8 @@ static void client_background(void) //usage: ) //usage: ) //usage: "\nSignals:" -//usage: "\n USR1 Renew current lease" -//usage: "\n USR2 Release current lease" +//usage: "\n USR1 Renew lease" +//usage: "\n USR2 Release lease" int udhcpc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index bd754f7..33c9585 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, uint32_t source_nip, int source_port, uint32_t dest_nip, int dest_port) { - struct sockaddr_in client; + struct sockaddr_in sa; unsigned padding; int fd; int result = -1; @@ -195,26 +195,25 @@ int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, } setsockopt_reuseaddr(fd); - memset(&client, 0, sizeof(client)); - client.sin_family = AF_INET; - client.sin_port = htons(source_port); - client.sin_addr.s_addr = source_nip; - if (bind(fd, (struct sockaddr *)&client, sizeof(client)) == -1) { + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_port = htons(source_port); + sa.sin_addr.s_addr = source_nip; + if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { msg = "bind(%s)"; goto ret_close; } - memset(&client, 0, sizeof(client)); - client.sin_family = AF_INET; - client.sin_port = htons(dest_port); - client.sin_addr.s_addr = dest_nip; - if (connect(fd, (struct sockaddr *)&client, sizeof(client)) == -1) { + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_port = htons(dest_port); + sa.sin_addr.s_addr = dest_nip; + if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { msg = "connect"; goto ret_close; } udhcp_dump_packet(dhcp_pkt); - padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding); msg = "write"; -- cgit v1.1