diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-04 01:18:27 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-04 01:18:27 +0000 |
commit | b12ff12eb3ebaff2815c32a57a644eb2e93e8da8 (patch) | |
tree | ccf97eb4f75842225541b87484b7b04e22205a78 /sbin/dhclient/ethernet.c | |
parent | 7026ca4195738c3917aa0fa16cfed7db4996fd4b (diff) |
8579 lines of KNF, ANSO and zap-junk diff without the resulting binary
changing by a single byte.
partly from theo
Diffstat (limited to 'sbin/dhclient/ethernet.c')
-rw-r--r-- | sbin/dhclient/ethernet.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/sbin/dhclient/ethernet.c b/sbin/dhclient/ethernet.c index 1adface63a8..1e83e7faf02 100644 --- a/sbin/dhclient/ethernet.c +++ b/sbin/dhclient/ethernet.c @@ -48,45 +48,41 @@ /* Assemble an hardware header... */ /* XXX currently only supports ethernet; doesn't check for other types. */ -void assemble_ethernet_header (interface, buf, bufix, to) - struct interface_info *interface; - unsigned char *buf; - int *bufix; - struct hardware *to; +void +assemble_ethernet_header(struct interface_info *interface, unsigned char *buf, + int *bufix, struct hardware *to) { struct ether_header eh; if (to && to -> hlen == 6) /* XXX */ - memcpy (eh.ether_dhost, to -> haddr, sizeof eh.ether_dhost); + memcpy(eh.ether_dhost, to -> haddr, sizeof eh.ether_dhost); else - memset (eh.ether_dhost, 0xff, sizeof (eh.ether_dhost)); - if (interface -> hw_address.hlen == sizeof (eh.ether_shost)) - memcpy (eh.ether_shost, interface -> hw_address.haddr, - sizeof (eh.ether_shost)); + memset(eh.ether_dhost, 0xff, sizeof (eh.ether_dhost)); + if (interface->hw_address.hlen == sizeof(eh.ether_shost)) + memcpy(eh.ether_shost, interface->hw_address.haddr, + sizeof(eh.ether_shost)); else - memset (eh.ether_shost, 0x00, sizeof (eh.ether_shost)); + memset(eh.ether_shost, 0x00, sizeof(eh.ether_shost)); - eh.ether_type = htons (ETHERTYPE_IP); + eh.ether_type = htons(ETHERTYPE_IP); - memcpy (&buf [*bufix], &eh, ETHER_HEADER_SIZE); + memcpy(&buf[*bufix], &eh, ETHER_HEADER_SIZE); *bufix += ETHER_HEADER_SIZE; } /* Decode a hardware header... */ -ssize_t decode_ethernet_header (interface, buf, bufix, from) - struct interface_info *interface; - unsigned char *buf; - int bufix; - struct hardware *from; +ssize_t +decode_ethernet_header(struct interface_info *interface, unsigned char *buf, + int bufix, struct hardware *from) { - struct ether_header eh; + struct ether_header eh; - memcpy (&eh, buf + bufix, ETHER_HEADER_SIZE); + memcpy(&eh, buf + bufix, ETHER_HEADER_SIZE); - memcpy (from -> haddr, eh.ether_shost, sizeof (eh.ether_shost)); - from -> htype = ARPHRD_ETHER; - from -> hlen = sizeof eh.ether_shost; + memcpy(from->haddr, eh.ether_shost, sizeof(eh.ether_shost)); + from->htype = ARPHRD_ETHER; + from->hlen = sizeof eh.ether_shost; - return sizeof eh; + return sizeof eh; } |