diff options
| author | Roy Marples <roy@marples.name> | 2008-03-20 16:47:51 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-03-20 16:47:51 +0000 |
| commit | 8d212424765794740d61d4b4fe5db3f2f6800eb9 (patch) | |
| tree | 5ec4ff1d3eed924448276135fdd2d11504cb78c4 /ipv4ll.c | |
| parent | 74befdac5d0d3c0803cd15c3db85c3ba81064bc8 (diff) | |
| download | dhcpcd-8d212424765794740d61d4b4fe5db3f2f6800eb9.tar.xz | |
Change code style to match the BSDs in the hope the might adpot it instead of dhclient.
Diffstat (limited to 'ipv4ll.c')
| -rw-r--r-- | ipv4ll.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -40,31 +40,32 @@ #define IPV4LL_LEASETIME 20 -int ipv4ll_get_address (interface_t *iface, dhcp_t *dhcp) { +int +ipv4ll_get_address(struct interface *iface, struct dhcp *dhcp) { struct in_addr addr; for (;;) { - addr.s_addr = htonl (LINKLOCAL_ADDR | - (((uint32_t) abs ((int) random ()) - % 0xFD00) + 0x0100)); + addr.s_addr = htonl(LINKLOCAL_ADDR | + (((uint32_t)abs((int)random()) + % 0xFD00) + 0x0100)); errno = 0; - if (! arp_claim (iface, addr)) + if (!arp_claim(iface, addr)) break; /* Our ARP may have been interrupted */ if (errno) - return (-1); + return -1; } dhcp->address.s_addr = addr.s_addr; - dhcp->netmask.s_addr = htonl (LINKLOCAL_MASK); - dhcp->broadcast.s_addr = htonl (LINKLOCAL_BRDC); + dhcp->netmask.s_addr = htonl(LINKLOCAL_MASK); + dhcp->broadcast.s_addr = htonl(LINKLOCAL_BRDC); /* Finally configure some DHCP like lease times */ dhcp->leasetime = IPV4LL_LEASETIME; - dhcp->renewaltime = (dhcp->leasetime * 0.5); - dhcp->rebindtime = (dhcp->leasetime * 0.875); + dhcp->renewaltime = dhcp->leasetime * 0.5; + dhcp->rebindtime = dhcp->leasetime * 0.875; - return (0); + return 0; } #endif |
