+Allow Linux to use Token Ring again as Linux does not have any more hardware
+specific code. BPF needs a patch for Token Ring support.
Dawin is now reported to work.
cleanmetas now inserts a \ when it finds a ' so we get the proper
values in our .info files when read by a shell.
CFLAGS ?= -O2 -pipe
# Loads of nice flags to ensure our code is good
-# We define _BSD_SOURCE for maximum portability
-CFLAGS += -D_BSD_SOURCE -pedantic -std=c99 \
+CFLAGS += -pedantic -std=c99 \
-Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
-Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
-Wbad-function-cast -Wnested-externs -Wcomment -Winline \
echo '#define VERSION "$(VERSION)"' > version.h
$(dhcpcd_OBJS):
- $(CC) $(CFLAGS) -c $*.c
+ $(CC) -D_BSD_SOURCE $(CFLAGS) -c $*.c
all: $(TARGET)
if ((unsigned) bytes < sizeof (reply.hdr) + 2 * (4 + reply.hdr.ar_hln))
continue;
- ra.c = ar_spa (&reply.hdr);
+ ra.c = (unsigned char *) ar_spa (&reply.hdr);
logger (LOG_ERR, "ARPOP_REPLY received from %s (%s)",
inet_ntoa (ra.a),
ether_ntoa ((struct ether_addr *) ar_sha (&reply.hdr)));
struct ifreq ifr;
interface_t *iface;
unsigned char hwaddr[ETHER_ADDR_LEN];
+ sa_family_t family;
#ifndef __linux__
struct ifaddrs *ifap;
us.sa = p->ifa_addr;
- if (p->ifa_addr->sa_family != AF_LINK || us.sdl->sdl_type != IFT_ETHER)
- {
- logger (LOG_ERR, "not Ethernet");
- freeifaddrs (ifap);
- return NULL;
- }
+ if (p->ifa_addr->sa_family != AF_LINK
+ || (us.sdl->sdl_type != IFT_ETHER))
+ /*
+ && us.sdl->sdl_type != IFT_ISO88025))
+ */
+ {
+ logger (LOG_ERR, "interface is not Ethernet");
+ freeifaddrs (ifap);
+ return NULL;
+ }
memcpy (hwaddr, us.sdl->sdl_data + us.sdl->sdl_nlen, ETHER_ADDR_LEN);
+ family = us.sdl->sdl_type;
break;
}
freeifaddrs (ifap);
close (s);
return NULL;
}
- if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER)
+ if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER &&
+ ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE802_TR)
{
- logger (LOG_ERR, "interface is not Ethernet");
+ logger (LOG_ERR, "interface is not Ethernet or Token Ring");
close (s);
return NULL;
}
memcpy (hwaddr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
+ family = ifr.ifr_hwaddr.sa_family;
#else
ifr.ifr_metric = metric;
if (ioctl (s, SIOCSIFMETRIC, &ifr) < 0)
snprintf (iface->infofile, PATH_MAX, INFOFILE, ifname);
memcpy (&iface->ethernet_address, hwaddr, ETHER_ADDR_LEN);
+ iface->family = family;
iface->arpable = ! (ifr.ifr_flags & (IFF_NOARP | IFF_LOOPBACK));
logger (LOG_INFO, "ethernet address = %s",
{
char name[IF_NAMESIZE];
struct ether_addr ethernet_address;
+ sa_family_t family;
bool arpable;
int fd;
#include <netinet/udp.h>
#include <netinet/if_ether.h>
#include <net/ethernet.h>
+#ifndef __linux__
+#include <net/if_types.h>
+#endif
#include <net/if.h>
#include <errno.h>
#include <fcntl.h>
int retval = -1;
struct iovec iov[2];
- /* We only support ethernet atm */
- struct ether_header hw;
- memset (&hw, 0, sizeof (struct ether_header));
- memset (&hw.ether_dhost, 0xff, ETHER_ADDR_LEN);
- hw.ether_type = htons (type);
+ if (iface->family == IFT_ETHER)
+ {
+ struct ether_header hw;
+ memset (&hw, 0, sizeof (struct ether_header));
+ memset (&hw.ether_dhost, 0xff, ETHER_ADDR_LEN);
+ hw.ether_type = htons (type);
- iov[0].iov_base = &hw;
- iov[0].iov_len = sizeof (struct ether_header);
+ iov[0].iov_base = &hw;
+ iov[0].iov_len = sizeof (struct ether_header);
+ }
+ else
+ {
+ logger (LOG_ERR, "unsupported interace type %d", iface->family);
+ return -1;
+ }
iov[1].iov_base = (unsigned char *) data;
iov[1].iov_len = len;