#define BPF_M_UDP 3
#define BPF_M_UDPLEN 4
-#ifdef ARPHRD_NETROM
-static const struct bpf_insn bpf_bootp_netrom[] = {
+#ifdef ARPHRD_NONE
+static const struct bpf_insn bpf_bootp_none[] = {
/* Set the frame header length to zero. */
BPF_STMT(BPF_LD + BPF_IMM, 0),
BPF_STMT(BPF_ST, BPF_M_FHLEN),
};
-#define BPF_BOOTP_NETROM_LEN __arraycount(bpf_bootp_netrom)
+#define BPF_BOOTP_NONE_LEN __arraycount(bpf_bootp_none)
#endif
static const struct bpf_insn bpf_bootp_ether[] = {
bp = bpf;
/* Check frame header. */
switch(ifp->family) {
-#ifdef ARPHRD_NETROM
- case ARPHRD_NETROM:
- memcpy(bp, bpf_bootp_netrom, sizeof(bpf_bootp_netrom));
- bp += BPF_BOOTP_NETROM_LEN;
+#ifdef ARPHRD_NONE
+ case ARPHRD_NONE:
+ memcpy(bp, bpf_bootp_none, sizeof(bpf_bootp_none));
+ bp += BPF_BOOTP_NONE_LEN;
break;
#endif
case ARPHRD_ETHER:
#include <time.h>
#include <unistd.h>
-#ifndef ARPHRD_NETROM
-# define ARPHRD_NETROM 0
-#endif
-
#include "common.h"
#include "dhcpcd.h"
#include "duid.h"
return len;
/* No UUID? OK, lets make one based on our interface */
- if (ifp->family == ARPHRD_NETROM) {
- logwarnx("%s: is a NET/ROM pseudo interface", ifp->name);
+ if (ifp->hwlen == 0) {
+ logwarnx("%s: does not have hardware address", ifp->name);
TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) {
- if (ifp2->family != ARPHRD_NETROM)
+ if (ifp2->hwlen != 0)
break;
}
if (ifp2) {
struct if_spec spec;
#ifdef AF_LINK
const struct sockaddr_dl *sdl;
-#ifdef SIOCGIFPRIORITY
- struct ifreq ifr;
-#endif
#ifdef IFLR_ACTIVE
struct if_laddrreq iflr = { .flags = IFLR_PREFIX };
int link_fd;
#endif
-
#elif AF_PACKET
const struct sockaddr_ll *sll;
#endif
+#if defined(SIOCGIFPRIORITY) || defined(SIOCGIFHWADDR)
+ struct ifreq ifr;
+#endif
if ((ifs = malloc(sizeof(*ifs))) == NULL) {
logerr(__func__);
memcpy(ifp->hwaddr, sll->sll_addr, ifp->hwlen);
#endif
}
-#ifdef __linux__
- /* PPP addresses on Linux don't have hardware addresses */
- else
- ifp->index = if_nametoindex(ifp->name);
+#ifdef SIOCGIFHWADDR
+ else {
+ memset(&ifr, 0, sizeof(ifr));
+ strlcpy(ifr.ifr_name, ifa->ifa_name,
+ sizeof(ifr.ifr_name));
+ if (ioctl(ctx->pf_inet_fd, SIOCGIFHWADDR, &ifr) == -1)
+ logerr("%s: SIOCGIFHWADDR", ifa->ifa_name);
+ ifp->family = ifr.ifr_hwaddr.sa_family;
+ if (ioctl(ctx->pf_inet_fd, SIOCGIFINDEX, &ifr) == -1)
+ logerr("%s: SIOCGIFINDEX", ifa->ifa_name);
+ ifp->index = (unsigned int)ifr.ifr_ifindex;
+ }
#endif
/* Ensure hardware address is valid. */
ctx->ifac == 0 && !if_hasconf(ctx, ifp->name))
active = IF_INACTIVE;
switch (ifp->family) {
-#ifdef ARPHRD_NETROM
- case ARPHRD_NETROM:
-#endif
case ARPHRD_IEEE1394:
case ARPHRD_INFINIBAND:
#ifdef ARPHRD_LOOPBACK
#endif
#ifdef ARPHRD_PPP
case ARPHRD_PPP:
+#endif
+#ifdef ARPHRD_NONE
+ case ARPHRD_NONE:
#endif
/* We don't warn for supported families */
break;