From 5a3395bc01cd4b11309595a6ecdaf32f8279f378 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 18 Nov 2006 19:51:32 +0000 Subject: udhcp: fix indentation and style. Eliminate (group) a lot of smallish *.h files Remove lots of unneeded #includes --- networking/udhcp/clientpacket.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'networking/udhcp/clientpacket.c') diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index 4299c2dbd..15cbda2f5 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c @@ -8,8 +8,6 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include -#include #include #if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION #include @@ -19,19 +17,11 @@ #include #include #endif -#include -#include -#include -#include -#include -#include - +#include "common.h" #include "dhcpd.h" -#include "clientpacket.h" -#include "options.h" #include "dhcpc.h" -#include "common.h" +#include "options.h" /* Create a random xid */ @@ -59,7 +49,7 @@ static void init_packet(struct dhcpMessage *packet, char type) udhcp_init_header(packet, type); memcpy(packet->chaddr, client_config.arp, 6); if (client_config.clientid) - add_option_string(packet->options, client_config.clientid); + add_option_string(packet->options, client_config.clientid); if (client_config.hostname) add_option_string(packet->options, client_config.hostname); if (client_config.fqdn) add_option_string(packet->options, client_config.fqdn); add_option_string(packet->options, client_config.vendorclass); @@ -97,7 +87,7 @@ int send_discover(unsigned long xid, unsigned long requested) add_requests(&packet); bb_info_msg("Sending discover..."); return udhcp_raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST, - SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex); + SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex); } @@ -188,10 +178,12 @@ int get_raw_packet(struct dhcpMessage *payload, int fd) bytes = ntohs(packet.ip.tot_len); /* Make sure its the right packet for us, and that it passes sanity checks */ - if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION || - packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) || - bytes > (int) sizeof(struct udp_dhcp_packet) || - ntohs(packet.udp.len) != (uint16_t) (bytes - sizeof(packet.ip))) { + if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION + || packet.ip.ihl != sizeof(packet.ip) >> 2 + || packet.udp.dest != htons(CLIENT_PORT) + || bytes > (int) sizeof(struct udp_dhcp_packet) + || ntohs(packet.udp.len) != (uint16_t)(bytes - sizeof(packet.ip)) + ) { DEBUG("Unrelated/bogus packet"); return -2; } -- cgit v1.2.3