summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2019-05-31 12:27:03 -0400
committerDavid S. Miller <davem@davemloft.net>2019-06-02 21:06:26 -0400
commit35ebfc22fe991cf5a01680a43ee238dfc16fe4c1 (patch)
tree3da0d54f0b605b88cf72e47aea72d1ee35e752c7
parentb9f88982750d5c28b3c55ab8b802ecfa62a0bbd2 (diff)
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>
-rw-r--r--fs/afs/Makefile1
-rw-r--r--fs/afs/cmservice.c24
-rw-r--r--fs/afs/internal.h15
-rw-r--r--fs/afs/netdevices.c48
4 files changed, 1 insertions, 87 deletions
diff --git a/fs/afs/Makefile b/fs/afs/Makefile
index cbf31f6cd177..10359bea7070 100644
--- a/fs/afs/Makefile
+++ b/fs/afs/Makefile
@@ -29,7 +29,6 @@ kafs-y := \
29 server.o \ 29 server.o \
30 server_list.o \ 30 server_list.o \
31 super.o \ 31 super.o \
32 netdevices.o \
33 vlclient.o \ 32 vlclient.o \
34 vl_list.o \ 33 vl_list.o \
35 vl_probe.o \ 34 vl_probe.o \
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 01437cfe5432..a61d2058c468 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -584,9 +584,8 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
584 */ 584 */
585static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work) 585static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
586{ 586{
587 struct afs_interface *ifs;
588 struct afs_call *call = container_of(work, struct afs_call, work); 587 struct afs_call *call = container_of(work, struct afs_call, work);
589 int loop, nifs; 588 int loop;
590 589
591 struct { 590 struct {
592 struct /* InterfaceAddr */ { 591 struct /* InterfaceAddr */ {
@@ -604,19 +603,7 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
604 603
605 _enter(""); 604 _enter("");
606 605
607 nifs = 0;
608 ifs = kcalloc(32, sizeof(*ifs), GFP_KERNEL);
609 if (ifs) {
610 nifs = afs_get_ipv4_interfaces(call->net, ifs, 32, false);
611 if (nifs < 0) {
612 kfree(ifs);
613 ifs = NULL;
614 nifs = 0;
615 }
616 }
617
618 memset(&reply, 0, sizeof(reply)); 606 memset(&reply, 0, sizeof(reply));
619 reply.ia.nifs = htonl(nifs);
620 607
621 reply.ia.uuid[0] = call->net->uuid.time_low; 608 reply.ia.uuid[0] = call->net->uuid.time_low;
622 reply.ia.uuid[1] = htonl(ntohs(call->net->uuid.time_mid)); 609 reply.ia.uuid[1] = htonl(ntohs(call->net->uuid.time_mid));
@@ -626,15 +613,6 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
626 for (loop = 0; loop < 6; loop++) 613 for (loop = 0; loop < 6; loop++)
627 reply.ia.uuid[loop + 5] = htonl((s8) call->net->uuid.node[loop]); 614 reply.ia.uuid[loop + 5] = htonl((s8) call->net->uuid.node[loop]);
628 615
629 if (ifs) {
630 for (loop = 0; loop < nifs; loop++) {
631 reply.ia.ifaddr[loop] = ifs[loop].address.s_addr;
632 reply.ia.netmask[loop] = ifs[loop].netmask.s_addr;
633 reply.ia.mtu[loop] = htonl(ifs[loop].mtu);
634 }
635 kfree(ifs);
636 }
637
638 reply.cap.capcount = htonl(1); 616 reply.cap.capcount = htonl(1);
639 reply.cap.caps[0] = htonl(AFS_CAP_ERROR_TRANSLATION); 617 reply.cap.caps[0] = htonl(AFS_CAP_ERROR_TRANSLATION);
640 afs_send_simple_reply(call, &reply, sizeof(reply)); 618 afs_send_simple_reply(call, &reply, sizeof(reply));
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 2073c1a3ab4b..a22fa3b77b3c 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -725,15 +725,6 @@ struct afs_permits {
725}; 725};
726 726
727/* 727/*
728 * record of one of a system's set of network interfaces
729 */
730struct afs_interface {
731 struct in_addr address; /* IPv4 address bound to interface */
732 struct in_addr netmask; /* netmask applied to address */
733 unsigned mtu; /* MTU of interface */
734};
735
736/*
737 * Error prioritisation and accumulation. 728 * Error prioritisation and accumulation.
738 */ 729 */
739struct afs_error { 730struct afs_error {
@@ -1096,12 +1087,6 @@ extern struct vfsmount *afs_d_automount(struct path *);
1096extern void afs_mntpt_kill_timer(void); 1087extern void afs_mntpt_kill_timer(void);
1097 1088
1098/* 1089/*
1099 * netdevices.c
1100 */
1101extern int afs_get_ipv4_interfaces(struct afs_net *, struct afs_interface *,
1102 size_t, bool);
1103
1104/*
1105 * proc.c 1090 * proc.c
1106 */ 1091 */
1107#ifdef CONFIG_PROC_FS 1092#ifdef CONFIG_PROC_FS
diff --git a/fs/afs/netdevices.c b/fs/afs/netdevices.c
deleted file mode 100644
index 2a009d1939d7..000000000000
--- a/fs/afs/netdevices.c
+++ /dev/null
@@ -1,48 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2/* AFS network device helpers
3 *
4 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
5 */
6
7#include <linux/string.h>
8#include <linux/rtnetlink.h>
9#include <linux/inetdevice.h>
10#include <linux/netdevice.h>
11#include <linux/if_arp.h>
12#include <net/net_namespace.h>
13#include "internal.h"
14
15/*
16 * get a list of this system's interface IPv4 addresses, netmasks and MTUs
17 * - maxbufs must be at least 1
18 * - returns the number of interface records in the buffer
19 */
20int afs_get_ipv4_interfaces(struct afs_net *net, struct afs_interface *bufs,
21 size_t maxbufs, bool wantloopback)
22{
23 struct net_device *dev;
24 struct in_device *idev;
25 int n = 0;
26
27 ASSERT(maxbufs > 0);
28
29 rtnl_lock();
30 for_each_netdev(net->net, dev) {
31 if (dev->type == ARPHRD_LOOPBACK && !wantloopback)
32 continue;
33 idev = __in_dev_get_rtnl(dev);
34 if (!idev)
35 continue;
36 for_primary_ifa(idev) {
37 bufs[n].address.s_addr = ifa->ifa_address;
38 bufs[n].netmask.s_addr = ifa->ifa_mask;
39 bufs[n].mtu = dev->mtu;
40 n++;
41 if (n >= maxbufs)
42 goto out;
43 } endfor_ifa(idev);
44 }
45out:
46 rtnl_unlock();
47 return n;
48}