]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Use a proper namespace for IPv4LL
authorRoy Marples <roy@marples.name>
Tue, 13 Nov 2012 11:44:20 +0000 (11:44 +0000)
committerRoy Marples <roy@marples.name>
Tue, 13 Nov 2012 11:44:20 +0000 (11:44 +0000)
arp.c
dhcpcd.c
ipv4ll.c
ipv4ll.h

diff --git a/arp.c b/arp.c
index 0862ba0239b43d8c68b913532b165995fe28783b..6c35594acd570c6fc33ecc32f29b0eba050630ee 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -86,7 +86,7 @@ handle_arp_failure(struct interface *ifp)
            (ifp->state->new != NULL &&
                ifp->state->new->cookie != htonl(MAGIC_COOKIE)))
        {
-               handle_ipv4ll_failure(ifp);
+               ipv4ll_handle_failure(ifp);
                return;
        }
 
index 638f43e39bdfd4964488380c2e451162b7b6c594..c219a5649f4283e7319b786362ac1abd049ec61c 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1002,9 +1002,9 @@ start_discover(void *arg)
        {
                if (IN_LINKLOCAL(htonl(iface->state->fail.s_addr)))
                        eloop_timeout_add_sec(RATE_LIMIT_INTERVAL,
-                           start_ipv4ll, iface);
+                           ipv4ll_start, iface);
                else
-                       eloop_timeout_add_sec(timeout, start_ipv4ll, iface);
+                       eloop_timeout_add_sec(timeout, ipv4ll_start, iface);
        }
        if (ifo->options & DHCPCD_REQUEST)
                syslog(LOG_INFO, "%s: broadcasting for a lease (requesting %s)",
@@ -1284,7 +1284,7 @@ start_interface(void *arg)
                start_discover(iface);
        else if (iface->state->offer->cookie == 0 &&
            iface->state->options->options & DHCPCD_IPV4LL)
-               start_ipv4ll(iface);
+               ipv4ll_start(iface);
        else
                start_reboot(iface);
 }
index 79e31653409a8927f55e623ff9d9eeac7fd11948..402e158cdf1787d5c4bd7748af58518530ff14dc 100644 (file)
--- a/ipv4ll.c
+++ b/ipv4ll.c
@@ -41,7 +41,7 @@
 #include "net.h"
 
 static struct dhcp_message *
-make_ipv4ll_lease(uint32_t addr)
+ipv4ll_make_lease(uint32_t addr)
 {
        uint32_t u32;
        struct dhcp_message *dhcp;
@@ -67,7 +67,7 @@ make_ipv4ll_lease(uint32_t addr)
 }
 
 static struct dhcp_message *
-find_ipv4ll_lease(uint32_t old_addr)
+ipv4ll_find_lease(uint32_t old_addr)
 {
        uint32_t addr;
 
@@ -79,78 +79,78 @@ find_ipv4ll_lease(uint32_t old_addr)
                    IN_LINKLOCAL(ntohl(addr)))
                        break;
        }
-       return make_ipv4ll_lease(addr);
+       return ipv4ll_make_lease(addr);
 }
 
 void
-start_ipv4ll(void *arg)
+ipv4ll_start(void *arg)
 {
-       struct interface *iface = arg;
+       struct interface *ifp = arg;
        uint32_t addr;
 
-       eloop_timeout_delete(NULL, iface);
-       iface->state->probes = 0;
-       iface->state->claims = 0;
-       if (iface->addr.s_addr) {
-               iface->state->conflicts = 0;
-               if (IN_LINKLOCAL(htonl(iface->addr.s_addr))) {
-                       send_arp_announce(iface);
+       eloop_timeout_delete(NULL, ifp);
+       ifp->state->probes = 0;
+       ifp->state->claims = 0;
+       if (ifp->addr.s_addr) {
+               ifp->state->conflicts = 0;
+               if (IN_LINKLOCAL(htonl(ifp->addr.s_addr))) {
+                       send_arp_announce(ifp);
                        return;
                }
        }
 
-       if (iface->state->offer == NULL)
+       if (ifp->state->offer == NULL)
                addr = 0;
        else {
-               addr = iface->state->offer->yiaddr;
-               free(iface->state->offer);
+               addr = ifp->state->offer->yiaddr;
+               free(ifp->state->offer);
        }
        /* We maybe rebooting an IPv4LL address. */
        if (!IN_LINKLOCAL(htonl(addr))) {
                syslog(LOG_INFO, "%s: probing for an IPv4LL address",
-                   iface->name);
+                   ifp->name);
                addr = 0;
        }
        if (addr == 0)
-               iface->state->offer = find_ipv4ll_lease(addr);
+               ifp->state->offer = ipv4ll_find_lease(addr);
        else
-               iface->state->offer = make_ipv4ll_lease(addr);
-       iface->state->lease.frominfo = 0;
-       send_arp_probe(iface);
+               ifp->state->offer = ipv4ll_make_lease(addr);
+       ifp->state->lease.frominfo = 0;
+       send_arp_probe(ifp);
 }
 
 void
-handle_ipv4ll_failure(void *arg)
+ipv4ll_handle_failure(void *arg)
 {
-       struct interface *iface = arg;
+       struct interface *ifp = arg;
        time_t up;
 
-       if (iface->state->fail.s_addr == iface->addr.s_addr) {
+       if (ifp->state->fail.s_addr == ifp->addr.s_addr) {
                up = uptime();
-               if (iface->state->defend + DEFEND_INTERVAL > up) {
+               if (ifp->state->defend + DEFEND_INTERVAL > up) {
                        syslog(LOG_DEBUG,
                            "%s: IPv4LL %d second defence failed",
-                           iface->name, DEFEND_INTERVAL);
-                       drop_dhcp(iface, "EXPIRE");
-                       iface->state->conflicts = -1;
+                           ifp->name, DEFEND_INTERVAL);
+                       drop_dhcp(ifp, "EXPIRE");
+                       ifp->state->conflicts = -1;
                } else {
                        syslog(LOG_DEBUG, "%s: defended IPv4LL address",
-                           iface->name);
-                       iface->state->defend = up;
+                           ifp->name);
+                       ifp->state->defend = up;
                        return;
                }
        }
 
-       close_sockets(iface);
-       free(iface->state->offer);
-       iface->state->offer = NULL;
-       eloop_timeout_delete(NULL, iface);
-       if (++iface->state->conflicts > MAX_CONFLICTS) {
+       close_sockets(ifp);
+       free(ifp->state->offer);
+       ifp->state->offer = NULL;
+       eloop_timeout_delete(NULL, ifp);
+       if (++ifp->state->conflicts > MAX_CONFLICTS) {
                syslog(LOG_ERR, "%s: failed to acquire an IPv4LL address",
-                   iface->name);
-               iface->state->interval = RATE_LIMIT_INTERVAL / 2;
-               start_discover(iface);
+                   ifp->name);
+               ifp->state->interval = RATE_LIMIT_INTERVAL / 2;
+               start_discover(ifp);
        } else {
-               eloop_timeout_add_sec(PROBE_WAIT, start_ipv4ll, iface);
+               eloop_timeout_add_sec(PROBE_WAIT, ipv4ll_start, ifp);
        }
 }
index a5d8e9ae70744ec947599093d4890cf088290d33..7bdc89a200cf6d2cd0ee5ec5f32e47e4c92e601c 100644 (file)
--- a/ipv4ll.h
+++ b/ipv4ll.h
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2008 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2012 Roy Marples <roy@marples.name>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,7 @@
 #ifndef IPV4LL_H
 #define IPV4LL_H
 
-void start_ipv4ll(void *);
-void handle_ipv4ll_failure(void *);
+void ipv4ll_start(void *);
+void ipv4ll_handle_failure(void *);
+
 #endif