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
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 \
fs/afs/cmservice.c+1−23
@@ -584,9 +584,8 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call) · 583 unmodified lines
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) · 11 unmodified lines
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) · 3 unmodified lines
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));
fs/afs/internal.h+0−15
@@ -724,15 +724,6 @@ struct afs_permits { · 723 unmodified lines
724 struct afs_permit permits[]; /* List of permits sorted by key pointer */724 struct afs_permit permits[]; /* List of permits sorted by key pointer */
725};725};
726 726
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/*727/*
737 * Error prioritisation and accumulation.728 * Error prioritisation and accumulation.
738 */729 */
@@ -1095,12 +1086,6 @@ extern const struct file_operations afs_mntpt_file_operations; · 356 unmodified lines
1095extern struct vfsmount *afs_d_automount(struct path *);1086extern struct vfsmount *afs_d_automount(struct path *);
1096extern void afs_mntpt_kill_timer(void);1087extern void afs_mntpt_kill_timer(void);
1097 1088
1098/*
1099 * netdevices.c
1100 */
1101extern int afs_get_ipv4_interfaces(struct afs_net *, struct afs_interface *,
1102 size_t, bool);
1103
1104/*1089/*
1105 * proc.c1090 * proc.c
1106 */1091 */
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 */
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}

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