afs: do not send list of client addresses

David Howells says:
  I'm told that there's not really any point populating the list.
  Current OpenAFS ignores it, as does AuriStor - and IBM AFS 3.6 will
  do the right thing.
  The list is actually useless as it's the client's view of the world,
  not the servers, so if there's any NAT in the way its contents are
  invalid.  Further, it doesn't support IPv6 addresses.

  On that basis, feel free to make it an empty list and remove all the
  interface enumeration.

V1 of this patch reworked the function to use a new helper for the
ifa_list iteration to avoid sparse warnings once the proper __rcu
annotations get added in struct in_device later.

But, in light of the above, just remove afs_get_ipv4_interfaces.

Compile tested only.

Cc: David Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org
Signed-off-by: Florian Westphal <fw@strlen.de>
Tested-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Florian Westphal 2019-05-31 18:27:03 +02:00 committed by David S. Miller
parent b9f8898275
commit 35ebfc22fe
4 changed files with 1 additions and 87 deletions

View File

@ -29,7 +29,6 @@ kafs-y := \
server.o \ server.o \
server_list.o \ server_list.o \
super.o \ super.o \
netdevices.o \
vlclient.o \ vlclient.o \
vl_list.o \ vl_list.o \
vl_probe.o \ vl_probe.o \

View File

@ -584,9 +584,8 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
*/ */
static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work) static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
{ {
struct afs_interface *ifs;
struct afs_call *call = container_of(work, struct afs_call, work); struct afs_call *call = container_of(work, struct afs_call, work);
int loop, nifs; int loop;
struct { struct {
struct /* InterfaceAddr */ { struct /* InterfaceAddr */ {
@ -604,19 +603,7 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
_enter(""); _enter("");
nifs = 0;
ifs = kcalloc(32, sizeof(*ifs), GFP_KERNEL);
if (ifs) {
nifs = afs_get_ipv4_interfaces(call->net, ifs, 32, false);
if (nifs < 0) {
kfree(ifs);
ifs = NULL;
nifs = 0;
}
}
memset(&reply, 0, sizeof(reply)); memset(&reply, 0, sizeof(reply));
reply.ia.nifs = htonl(nifs);
reply.ia.uuid[0] = call->net->uuid.time_low; reply.ia.uuid[0] = call->net->uuid.time_low;
reply.ia.uuid[1] = htonl(ntohs(call->net->uuid.time_mid)); reply.ia.uuid[1] = htonl(ntohs(call->net->uuid.time_mid));
@ -626,15 +613,6 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
for (loop = 0; loop < 6; loop++) for (loop = 0; loop < 6; loop++)
reply.ia.uuid[loop + 5] = htonl((s8) call->net->uuid.node[loop]); reply.ia.uuid[loop + 5] = htonl((s8) call->net->uuid.node[loop]);
if (ifs) {
for (loop = 0; loop < nifs; loop++) {
reply.ia.ifaddr[loop] = ifs[loop].address.s_addr;
reply.ia.netmask[loop] = ifs[loop].netmask.s_addr;
reply.ia.mtu[loop] = htonl(ifs[loop].mtu);
}
kfree(ifs);
}
reply.cap.capcount = htonl(1); reply.cap.capcount = htonl(1);
reply.cap.caps[0] = htonl(AFS_CAP_ERROR_TRANSLATION); reply.cap.caps[0] = htonl(AFS_CAP_ERROR_TRANSLATION);
afs_send_simple_reply(call, &reply, sizeof(reply)); afs_send_simple_reply(call, &reply, sizeof(reply));

View File

@ -724,15 +724,6 @@ struct afs_permits {
struct afs_permit permits[]; /* List of permits sorted by key pointer */ struct afs_permit permits[]; /* List of permits sorted by key pointer */
}; };
/*
* record of one of a system's set of network interfaces
*/
struct afs_interface {
struct in_addr address; /* IPv4 address bound to interface */
struct in_addr netmask; /* netmask applied to address */
unsigned mtu; /* MTU of interface */
};
/* /*
* Error prioritisation and accumulation. * Error prioritisation and accumulation.
*/ */
@ -1095,12 +1086,6 @@ extern const struct file_operations afs_mntpt_file_operations;
extern struct vfsmount *afs_d_automount(struct path *); extern struct vfsmount *afs_d_automount(struct path *);
extern void afs_mntpt_kill_timer(void); extern void afs_mntpt_kill_timer(void);
/*
* netdevices.c
*/
extern int afs_get_ipv4_interfaces(struct afs_net *, struct afs_interface *,
size_t, bool);
/* /*
* proc.c * proc.c
*/ */

View File

@ -1,48 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/* 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_net *net, 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(net->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;
}