1 From foo@baz Thu Jun 15 11:13:01 CEST 2017
2 From: Ralf Baechle <ralf@linux-mips.org>
3 Date: Tue, 23 May 2017 21:53:37 -0400
4 Subject: NET: Fix /proc/net/arp for AX.25
6 From: Ralf Baechle <ralf@linux-mips.org>
9 [ Upstream commit 4872e57c812dd312bf8193b5933fa60585cda42f ]
11 When sending ARP requests over AX.25 links the hwaddress in the neighbour
12 cache are not getting initialized. For such an incomplete arp entry
13 ax2asc2 will generate an empty string resulting in /proc/net/arp output
17 IP address HW type Flags HW address Mask Device
18 192.168.122.1 0x1 0x2 52:54:00:00:5d:5f * ens3
19 172.20.1.99 0x3 0x0 * bpq0
21 The missing field will confuse the procfs parsing of arp(8) resulting in
22 incorrect output for the device such as the following:
25 Address HWtype HWaddress Flags Mask Iface
26 gateway ether 52:54:00:00:5d:5f C ens3
27 172.20.1.99 (incomplete) ens3
29 This changes the content of /proc/net/arp to:
32 IP address HW type Flags HW address Mask Device
33 172.20.1.99 0x3 0x0 * * bpq0
34 192.168.122.1 0x1 0x2 52:54:00:00:5d:5f * ens3
36 To do so it change ax2asc to put the string "*" in buf for a NULL address
37 argument. Finally the HW address field is left aligned in a 17 character
38 field (the length of an ethernet HW address in the usual hex notation) for
41 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
42 Signed-off-by: David S. Miller <davem@davemloft.net>
43 Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
44 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
46 net/ipv4/arp.c | 12 ++++++------
47 1 file changed, 6 insertions(+), 6 deletions(-)
51 @@ -1250,7 +1250,7 @@ void __init arp_init(void)
53 * ax25 -> ASCII conversion
55 -static char *ax2asc2(ax25_address *a, char *buf)
56 +static void ax2asc2(ax25_address *a, char *buf)
60 @@ -1272,10 +1272,10 @@ static char *ax2asc2(ax25_address *a, ch
64 - if (*buf == '\0' || *buf == '-')
68 + if (*buf == '\0' || *buf == '-') {
73 #endif /* CONFIG_AX25 */
75 @@ -1309,7 +1309,7 @@ static void arp_format_neigh_entry(struc
78 sprintf(tbuf, "%pI4", n->primary_key);
79 - seq_printf(seq, "%-16s 0x%-10x0x%-10x%s * %s\n",
80 + seq_printf(seq, "%-16s 0x%-10x0x%-10x%-17s * %s\n",
81 tbuf, hatype, arp_state_to_flags(n), hbuffer, dev->name);
82 read_unlock(&n->lock);