summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2010-11-12 16:33:45 +0000
committerRoy Marples <roy@marples.name>2010-11-12 16:33:45 +0000
commit8349d72adfe5e25ca691fdb9ce26263d34fe2753 (patch)
treef566c0fc96d06e8f8d8ab1fb7467da6362faf074 /dhcpcd.c
parent6b5542f1742560983d811c28b68d395c84ea65e0 (diff)
downloaddhcpcd-8349d72adfe5e25ca691fdb9ce26263d34fe2753.tar.xz
Support RTM_CHGADDR in NetBSD-6 for detecting link layer address changes.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 54acd1fa..a0860e39 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1282,6 +1282,41 @@ handle_interface(int action, const char *ifname)
}
void
+handle_hwaddr(const char *ifname, unsigned char *hwaddr, size_t hwlen)
+{
+ struct interface *ifp;
+ struct if_options *ifo;
+
+ for (ifp = ifaces; ifp; ifp = ifp->next)
+ if (strcmp(ifp->name, ifname) == 0 && ifp->hwlen <= hwlen) {
+ ifo = ifp->state->options;
+ if (!(ifo->options &
+ (DHCPCD_INFORM | DHCPCD_STATIC | DHCPCD_CLIENTID))
+ && ifp->state->new != NULL &&
+ ifp->state->new->cookie == htonl(MAGIC_COOKIE))
+ {
+ syslog(LOG_INFO,
+ "%s: expiring for new hardware address",
+ ifp->name);
+ drop_config(ifp, "EXPIRE");
+ }
+ memcpy(ifp->hwaddr, hwaddr, hwlen);
+ ifp->hwlen = hwlen;
+ if (!(ifo->options &
+ (DHCPCD_INFORM | DHCPCD_STATIC | DHCPCD_CLIENTID)))
+ {
+ syslog(LOG_DEBUG, "%s: using hwaddr %s",
+ ifp->name,
+ hwaddr_ntoa(ifp->hwaddr, ifp->hwlen));
+ ifp->state->interval = 0;
+ ifp->state->nakoff = 1;
+ start_interface(ifp);
+ }
+ }
+ free(hwaddr);
+}
+
+void
handle_ifa(int type, const char *ifname,
struct in_addr *addr, struct in_addr *net, struct in_addr *dst)
{