summaryrefslogtreecommitdiffstats
path: root/src/customdhcpcd/ipv4ll.c
diff options
context:
space:
mode:
authorSebastian Schmelzer2011-12-03 13:31:09 +0100
committerSebastian Schmelzer2011-12-03 13:31:09 +0100
commit1b48532c662470f5dd4090d47e1e2c333e967caf (patch)
tree8c23d3eca5fa088b91887d528138b9e0462382fb /src/customdhcpcd/ipv4ll.c
parentlet cmake find qxt (diff)
downloadfbgui-1b48532c662470f5dd4090d47e1e2c333e967caf.tar.gz
fbgui-1b48532c662470f5dd4090d47e1e2c333e967caf.tar.xz
fbgui-1b48532c662470f5dd4090d47e1e2c333e967caf.zip
codeformating, change to log4cxx
Diffstat (limited to 'src/customdhcpcd/ipv4ll.c')
-rw-r--r--src/customdhcpcd/ipv4ll.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/customdhcpcd/ipv4ll.c b/src/customdhcpcd/ipv4ll.c
index 9742b9a..c8ce8b8 100644
--- a/src/customdhcpcd/ipv4ll.c
+++ b/src/customdhcpcd/ipv4ll.c
@@ -1,4 +1,4 @@
-/*
+/*
* dhcpcd - DHCP client daemon
* Copyright 2006-2008 Roy Marples <roy@marples.name>
* All rights reserved
@@ -35,36 +35,38 @@
#ifdef ENABLE_IPV4LL
#ifndef ENABLE_ARP
- # error IPV4LL requires ARP
+# error IPV4LL requires ARP
#endif
-#define IPV4LL_LEASETIME 20
+#define IPV4LL_LEASETIME 20
-int ipv4ll_get_address (interface_t *iface, dhcp_t *dhcp) {
- struct in_addr addr;
+int ipv4ll_get_address (interface_t *iface, dhcp_t *dhcp)
+{
+ struct in_addr addr;
- for (;;) {
- addr.s_addr = htonl (LINKLOCAL_ADDR |
- (((uint32_t) abs ((int) random ())
- % 0xFD00) + 0x0100));
- errno = 0;
- if (! arp_claim (iface, addr))
- break;
- /* Our ARP may have been interrupted */
- if (errno)
- return (-1);
- }
+ for (;;)
+ {
+ addr.s_addr = htonl (LINKLOCAL_ADDR |
+ (((uint32_t) abs ((int) random ())
+ % 0xFD00) + 0x0100));
+ errno = 0;
+ if (! arp_claim (iface, addr))
+ break;
+ /* Our ARP may have been interrupted */
+ if (errno)
+ return (-1);
+ }
- dhcp->address.s_addr = addr.s_addr;
- dhcp->netmask.s_addr = htonl (LINKLOCAL_MASK);
- dhcp->broadcast.s_addr = htonl (LINKLOCAL_BRDC);
+ dhcp->address.s_addr = addr.s_addr;
+ 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);
+ /* Finally configure some DHCP like lease times */
+ dhcp->leasetime = IPV4LL_LEASETIME;
+ dhcp->renewaltime = (dhcp->leasetime * 0.5);
+ dhcp->rebindtime = (dhcp->leasetime * 0.875);
- return (0);
+ return (0);
}
#endif