mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
b4db2b35fc
AFS uses a time based UUID to identify the host itself. This requires getting a timestamp which is currently done through the getnstimeofday() interface that we want to eventually get rid of. Instead of replacing it with a ktime-based interface, simply remove the entire function and use generate_random_uuid() instead, which has a v4 ("completely random") UUID instead of the time-based one. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David Howells <dhowells@redhat.com>
48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
/* AFS network device helpers
|
|
*
|
|
* Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
|
|
*/
|
|
|
|
#include <linux/string.h>
|
|
#include <linux/rtnetlink.h>
|
|
#include <linux/inetdevice.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/if_arp.h>
|
|
#include <net/net_namespace.h>
|
|
#include "internal.h"
|
|
|
|
/*
|
|
* get a list of this system's interface IPv4 addresses, netmasks and MTUs
|
|
* - maxbufs must be at least 1
|
|
* - returns the number of interface records in the buffer
|
|
*/
|
|
int afs_get_ipv4_interfaces(struct afs_interface *bufs, size_t maxbufs,
|
|
bool wantloopback)
|
|
{
|
|
struct net_device *dev;
|
|
struct in_device *idev;
|
|
int n = 0;
|
|
|
|
ASSERT(maxbufs > 0);
|
|
|
|
rtnl_lock();
|
|
for_each_netdev(&init_net, dev) {
|
|
if (dev->type == ARPHRD_LOOPBACK && !wantloopback)
|
|
continue;
|
|
idev = __in_dev_get_rtnl(dev);
|
|
if (!idev)
|
|
continue;
|
|
for_primary_ifa(idev) {
|
|
bufs[n].address.s_addr = ifa->ifa_address;
|
|
bufs[n].netmask.s_addr = ifa->ifa_mask;
|
|
bufs[n].mtu = dev->mtu;
|
|
n++;
|
|
if (n >= maxbufs)
|
|
goto out;
|
|
} endfor_ifa(idev);
|
|
}
|
|
out:
|
|
rtnl_unlock();
|
|
return n;
|
|
}
|