summaryrefslogtreecommitdiffstats
path: root/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-10-25 15:33:02 +0000
committerRoy Marples <roy@marples.name>2016-10-25 15:33:02 +0000
commit609ea901d1cc8388776822b5803ee1c4a7f1baf4 (patch)
tree6591811871241cc9c3462a7ce7a82b03759a0423 /if.c
parent780602be948eb87bd6822940403b0a182d5fd7a4 (diff)
downloaddhcpcd-609ea901d1cc8388776822b5803ee1c4a7f1baf4.tar.xz
Remove address family specific routing and introduce address family
agnostic routing. This makes the platform drivers simpler and reduces some code duplication. Needs a lot of testing.
Diffstat (limited to 'if.c')
-rw-r--r--if.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/if.c b/if.c
index fcfdf3da..ac221f71 100644
--- a/if.c
+++ b/if.c
@@ -82,6 +82,7 @@ if_free(struct interface *ifp)
dhcp6_free(ifp);
ipv6nd_free(ifp);
ipv6_free(ifp);
+ rt_freeif(ifp);
free_options(ifp->options);
free(ifp);
}
@@ -454,9 +455,6 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
break;
}
ifp->hwlen = sdl->sdl_alen;
-#ifndef CLLADDR
-# define CLLADDR(s) (const void *)((s)->sdl_data + (s)->sdl_nlen)
-#endif
memcpy(ifp->hwaddr, CLLADDR(sdl), ifp->hwlen);
#elif AF_PACKET
sll = (const void *)ifa->ifa_addr;
@@ -633,6 +631,18 @@ if_findindex(struct if_head *ifaces, unsigned int idx)
return if_findindexname(ifaces, idx, NULL);
}
+struct interface *
+if_loopback(struct dhcpcd_ctx *ctx)
+{
+ struct interface *ifp;
+
+ TAILQ_FOREACH(ifp, ctx->ifaces, next) {
+ if (ifp->flags & IFF_LOOPBACK)
+ return ifp;
+ }
+ return NULL;
+}
+
int
if_domtu(const struct interface *ifp, short int mtu)
{