History

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.

Florian Westphal committed 7 years ago

Commit 35ebfc21 parent b9f88984 files · +1 −87Browse files

Unified · Split

4 files
  1. fs/afs/Makefile +0 −1
  2. fs/afs/cmservice.c +1 −23
  3. fs/afs/internal.h +0 −15
  4. fs/afs/netdevices.c +0 −48
fs/afs/Makefile+0−1
@@ -29,7 +29,6 @@ kafs-y := \ · 28 unmodified lines
2929 server.o \
3030 server_list.o \
3131 super.o \
32− netdevices.o \
3332 vlclient.o \
3433 vl_list.o \
3534 vl_probe.o \
fs/afs/cmservice.c+1−23
@@ -584,9 +584,8 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call) · 583 unmodified lines
584584 */
585585 static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
586586 {
587− struct afs_interface *ifs;
588587 struct afs_call *call = container_of(work, struct afs_call, work);
589− int loop, nifs;
588+ int loop;
590589
591590 struct {
592591 struct /* InterfaceAddr */ {
@@ -604,19 +603,7 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work) · 11 unmodified lines
604603
605604 _enter("");
606605
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−
618606 memset(&reply, 0, sizeof(reply));
619− reply.ia.nifs = htonl(nifs);
620607
621608 reply.ia.uuid[0] = call->net->uuid.time_low;
622609 reply.ia.uuid[1] = htonl(ntohs(call->net->uuid.time_mid));
@@ -626,15 +613,6 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work) · 3 unmodified lines
626613 for (loop = 0; loop < 6; loop++)
627614 reply.ia.uuid[loop + 5] = htonl((s8) call->net->uuid.node[loop]);
628615
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−
638616 reply.cap.capcount = htonl(1);
639617 reply.cap.caps[0] = htonl(AFS_CAP_ERROR_TRANSLATION);
640618 afs_send_simple_reply(call, &reply, sizeof(reply));
fs/afs/internal.h+0−15
@@ -724,15 +724,6 @@ struct afs_permits { · 723 unmodified lines
724724 struct afs_permit permits[]; /* List of permits sorted by key pointer */
725725 };
726726
727−/*
728− * record of one of a system's set of network interfaces
729− */
730−struct 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−
736727 /*
737728 * Error prioritisation and accumulation.
738729 */
@@ -1095,12 +1086,6 @@ extern const struct file_operations afs_mntpt_file_operations; · 356 unmodified lines
10951086 extern struct vfsmount *afs_d_automount(struct path *);
10961087 extern void afs_mntpt_kill_timer(void);
10971088
1098−/*
1099− * netdevices.c
1100− */
1101−extern int afs_get_ipv4_interfaces(struct afs_net *, struct afs_interface *,
1102− size_t, bool);
1103−
11041089 /*
11051090 * proc.c
11061091 */
fs/afs/netdevices.c+0−48
@@ -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− */
20−int 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− }
45−out:
46− rtnl_unlock();
47− return n;
48−}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t