1 /* AFS network device helpers
3 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
6 #include <linux/string.h>
7 #include <linux/rtnetlink.h>
8 #include <linux/inetdevice.h>
9 #include <linux/netdevice.h>
10 #include <linux/if_arp.h>
13 int afs_get_MAC_address(u8 mac[ETH_ALEN])
15 struct net_device *dev;
19 dev = __dev_getfirstbyhwtype(ARPHRD_ETHER);
21 memcpy(mac, dev->dev_addr, ETH_ALEN);
28 int afs_get_ipv4_interfaces(struct afs_interface *bufs, size_t maxbufs,
31 struct net_device *dev;
32 struct in_device *idev;
36 for (dev = dev_base; dev; dev = dev->next) {
37 if (dev->type == ARPHRD_LOOPBACK && !wantloopback)
39 idev = __in_dev_get_rtnl(dev);
42 for_primary_ifa(idev) {
45 bufs[n].address.s_addr = ifa->ifa_address;
46 bufs[n].netmask.s_addr = ifa->ifa_mask;
47 bufs[n].mtu = dev->mtu;