Commit 51f82a2b authored by Denis Cheng's avatar Denis Cheng Committed by David S. Miller
Browse files

net/ipv4/arp.c: Use common hex_asc helpers



Here the local hexbuf is a duplicate of global const char hex_asc from
lib/hexdump.c, except the hex letters' cases:

	const char hexbuf[] = "0123456789ABCDEF";

	const char hex_asc[] = "0123456789abcdef";

and here to print HW addresses, the hex cases are not significant.

Thanks to Harvey Harrison to introduce the hex_asc_hi/hex_asc_lo helpers.
Signed-off-by: default avatarDenis Cheng <crquan@gmail.com>
Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b1443e2f
...@@ -1288,7 +1288,6 @@ static void arp_format_neigh_entry(struct seq_file *seq, ...@@ -1288,7 +1288,6 @@ static void arp_format_neigh_entry(struct seq_file *seq,
struct neighbour *n) struct neighbour *n)
{ {
char hbuffer[HBUFFERLEN]; char hbuffer[HBUFFERLEN];
const char hexbuf[] = "0123456789ABCDEF";
int k, j; int k, j;
char tbuf[16]; char tbuf[16];
struct net_device *dev = n->dev; struct net_device *dev = n->dev;
...@@ -1302,8 +1301,8 @@ static void arp_format_neigh_entry(struct seq_file *seq, ...@@ -1302,8 +1301,8 @@ static void arp_format_neigh_entry(struct seq_file *seq,
else { else {
#endif #endif
for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) { for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) {
hbuffer[k++] = hexbuf[(n->ha[j] >> 4) & 15]; hbuffer[k++] = hex_asc_hi(n->ha[j]);
hbuffer[k++] = hexbuf[n->ha[j] & 15]; hbuffer[k++] = hex_asc_lo(n->ha[j]);
hbuffer[k++] = ':'; hbuffer[k++] = ':';
} }
hbuffer[--k] = 0; hbuffer[--k] = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment