[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Fwd: bug 8926 - Arping dropping leading 0 from mac address
From: Vito_Mulè <mule.vito () gmail ! com>
Date: 2016-05-16 17:16:09
Message-ID: CAFy+01Phd6Z2aZHpZ5wy_SFvsNFQuEi7GwYbWVvjg9yV=qFVSA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello,
not sure if this is necessary since I've opened the bug already, apologies
in case it's not.
Bug link: https://bugs.busybox.net/show_bug.cgi?id=8926
Not sure if this is intende but busybox arping is not consistent with
arping on linux, printing MAC addressed.
root@agent4:/home/vmule# arping 192.168.1.159
ARPING 192.168.1.159
60 bytes from 08:00:27:86:47:9d (192.168.1.159): index=0 time=1.002 sec
and this is busybox arping
root@agent4:/home/vmule# busybox arping 192.168.1.159
ARPING to 192.168.1.159 from 192.168.1.157 via eth0
Unicast reply from 192.168.1.159 [8:0:27:86:47:9d] 0.314ms
I wrote a small patch to fix it:
diff --git a/networking/arping.c b/networking/arping.c
index 6b0de4d..2b22451 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -230,12 +230,15 @@ static void recv_pack(unsigned char *buf, int
len, struct sockaddr_ll *FROM)
}
if (!(option_mask32 & QUIET)) {
int s_printed = 0;
+ struct ether_addr* mac = (struct ether_addr *) p;
- printf("%scast re%s from %s [%s]",
+ printf("%scast re%s from %s [%02x:%02x:%02x:%02x:%02x:%02x] ",
FROM->sll_pkttype == PACKET_HOST ? "Uni" : "Broad",
ah->ar_op == htons(ARPOP_REPLY) ? "ply" : "quest",
inet_ntoa(src_ip),
- ether_ntoa((struct ether_addr *) p));
+ mac->ether_addr_octet[0], mac->ether_addr_octet[1],
+ mac->ether_addr_octet[2], mac->ether_addr_octet[3],
+ mac->ether_addr_octet[4], mac->ether_addr_octet[5]);
if (dst_ip.s_addr != src.s_addr) {
printf("for %s ", inet_ntoa(dst_ip));
s_printed = 1;
@@ -243,8 +246,11 @@ static void recv_pack(unsigned char *buf, int
len, struct sockaddr_ll *FROM)
if (memcmp(p + ah->ar_hln + 4, me.sll_addr, ah->ar_hln)) {
if (!s_printed)
printf("for ");
- printf("[%s]",
- ether_ntoa((struct ether_addr *) p +
ah->ar_hln + 4));
+ struct ether_addr* mac2 = mac + ah->ar_hln + 4;
+ printf("[%02x:%02x:%02x:%02x:%02x:%02x]",
+ mac2->ether_addr_octet[0],
mac2->ether_addr_octet[1],
+ mac2->ether_addr_octet[2],
mac2->ether_addr_octet[3],
+ mac2->ether_addr_octet[4],
mac2->ether_addr_octet[5]);
}
if (last) {
Ideas?
Cheers
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hello,<div>not sure if this is \
necessary since I've opened the bug already, apologies in case it's \
not.<br>Bug link: <a href="https://bugs.busybox.net/show_bug.cgi?id=8926" \
target="_blank">https://bugs.busybox.net/show_bug.cgi?id=8926</a></div><div><br><br><pre \
style="white-space:pre-wrap;width:50em;color:rgb(0,0,0)">Not sure if this is intende \
but busybox arping is not consistent with arping on linux, printing MAC addressed.
root@agent4:/home/vmule# arping 192.168.1.159
ARPING 192.168.1.159
60 bytes from 08:00:27:86:47:9d (192.168.1.159): index=0 time=1.002 sec
and this is busybox arping
root@agent4:/home/vmule# busybox arping 192.168.1.159
ARPING to 192.168.1.159 from 192.168.1.157 via eth0
Unicast reply from 192.168.1.159 [8:0:27:86:47:9d] 0.314ms
I wrote a small patch to fix it:
diff --git a/networking/arping.c b/networking/arping.c
index 6b0de4d..2b22451 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -230,12 +230,15 @@ static void recv_pack(unsigned char *buf, int len, struct \
sockaddr_ll *FROM) }
if (!(option_mask32 & QUIET)) {
int s_printed = 0;
+ struct ether_addr* mac = (struct ether_addr *) p;
- printf("%scast re%s from %s [%s]",
+ printf("%scast re%s from %s [%02x:%02x:%02x:%02x:%02x:%02x] \
",
FROM->sll_pkttype == PACKET_HOST ? "Uni" : \
"Broad",
ah->ar_op == htons(ARPOP_REPLY) ? "ply" : \
"quest", inet_ntoa(src_ip),
- ether_ntoa((struct ether_addr *) p));
+ mac->ether_addr_octet[0], mac->ether_addr_octet[1],
+ mac->ether_addr_octet[2], mac->ether_addr_octet[3],
+ mac->ether_addr_octet[4], mac->ether_addr_octet[5]);
if (dst_ip.s_addr != src.s_addr) {
printf("for %s ", inet_ntoa(dst_ip));
s_printed = 1;
@@ -243,8 +246,11 @@ static void recv_pack(unsigned char *buf, int len, struct \
sockaddr_ll *FROM)
if (memcmp(p + ah->ar_hln + 4, me.sll_addr, ah->ar_hln)) {
if (!s_printed)
printf("for ");
- printf("[%s]",
- ether_ntoa((struct ether_addr *) p + ah->ar_hln + \
4)); + struct ether_addr* mac2 = mac + ah->ar_hln + 4;
+ printf("[%02x:%02x:%02x:%02x:%02x:%02x]",
+ mac2->ether_addr_octet[0], \
mac2->ether_addr_octet[1], + \
mac2->ether_addr_octet[2], mac2->ether_addr_octet[3], + \
mac2->ether_addr_octet[4], mac2->ether_addr_octet[5]); }
if (last) {
Ideas?</pre><pre style="white-space:pre-wrap;width:50em;color:rgb(0,0,0)"><br></pre><pre \
style="white-space:pre-wrap;width:50em;color:rgb(0,0,0)">Cheers</pre></div></div> \
</div><br></div>
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic