diff mbox

[iproute2,1/3] iproute2: arpd: use ll_addr_a2n and ll_addr_n2a

Message ID 1400159422-11797-2-git-send-email-jiri@resnulli.us
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Jiri Pirko May 15, 2014, 1:10 p.m. UTC
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 misc/arpd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Stephen Hemminger May 15, 2014, 3:43 p.m. UTC | #1
On Thu, 15 May 2014 15:10:20 +0200
Jiri Pirko <jiri@resnulli.us> wrote:

> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
>  misc/arpd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Why not use more standard ether_ntoa ?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko May 15, 2014, 4:50 p.m. UTC | #2
Thu, May 15, 2014 at 05:43:42PM CEST, stephen@networkplumber.org wrote:
>On Thu, 15 May 2014 15:10:20 +0200
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>> ---
>>  misc/arpd.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>> 
>
>Why not use more standard ether_ntoa ?

Because the rest of the code uses ll_addr_n2a. There is no user of
ether_ntoa in iproute2.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Hemminger May 17, 2014, 3:58 a.m. UTC | #3
On Thu, 15 May 2014 18:50:51 +0200
Jiri Pirko <jiri@resnulli.us> wrote:

> Thu, May 15, 2014 at 05:43:42PM CEST, stephen@networkplumber.org wrote:
> >On Thu, 15 May 2014 15:10:20 +0200
> >Jiri Pirko <jiri@resnulli.us> wrote:
> >
> >> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> >> ---
> >>  misc/arpd.c | 6 +++---
> >>  1 file changed, 3 insertions(+), 3 deletions(-)
> >> 
> >
> >Why not use more standard ether_ntoa ?
> 
> Because the rest of the code uses ll_addr_n2a. There is no user of
> ether_ntoa in iproute2.

arpd is more of a standalone program.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko May 17, 2014, 8:50 a.m. UTC | #4
Sat, May 17, 2014 at 05:58:16AM CEST, stephen@networkplumber.org wrote:
>On Thu, 15 May 2014 18:50:51 +0200
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> Thu, May 15, 2014 at 05:43:42PM CEST, stephen@networkplumber.org wrote:
>> >On Thu, 15 May 2014 15:10:20 +0200
>> >Jiri Pirko <jiri@resnulli.us> wrote:
>> >
>> >> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>> >> ---
>> >>  misc/arpd.c | 6 +++---
>> >>  1 file changed, 3 insertions(+), 3 deletions(-)
>> >> 
>> >
>> >Why not use more standard ether_ntoa ?
>> 
>> Because the rest of the code uses ll_addr_n2a. There is no user of
>> ether_ntoa in iproute2.
>
>arpd is more of a standalone program.

I know but it is a part of the package (git tree). The other instances
use ll_addr_n2a. I'm ok with using ether_ntoa, I just wanted to follow
what is already there.

I can change it and post v2 it you want. I can also change other instances
of usage ll_addr_n2a to ether_ntoa.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Hemminger June 9, 2014, 7:47 p.m. UTC | #5
On Sat, 17 May 2014 10:50:31 +0200
Jiri Pirko <jiri@resnulli.us> wrote:

> Sat, May 17, 2014 at 05:58:16AM CEST, stephen@networkplumber.org wrote:
> >On Thu, 15 May 2014 18:50:51 +0200
> >Jiri Pirko <jiri@resnulli.us> wrote:
> >
> >> Thu, May 15, 2014 at 05:43:42PM CEST, stephen@networkplumber.org wrote:
> >> >On Thu, 15 May 2014 15:10:20 +0200
> >> >Jiri Pirko <jiri@resnulli.us> wrote:
> >> >
> >> >> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> >> >> ---
> >> >>  misc/arpd.c | 6 +++---
> >> >>  1 file changed, 3 insertions(+), 3 deletions(-)
> >> >> 
> >> >
> >> >Why not use more standard ether_ntoa ?
> >> 
> >> Because the rest of the code uses ll_addr_n2a. There is no user of
> >> ether_ntoa in iproute2.
> >
> >arpd is more of a standalone program.
> 
> I know but it is a part of the package (git tree). The other instances
> use ll_addr_n2a. I'm ok with using ether_ntoa, I just wanted to follow
> what is already there.
> 
> I can change it and post v2 it you want. I can also change other instances
> of usage ll_addr_n2a to ether_ntoa.
> 
> 

This is fine, just went ahead and merged this version.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko June 10, 2014, 3:50 p.m. UTC | #6
Mon, Jun 09, 2014 at 09:47:22PM CEST, stephen@networkplumber.org wrote:
>On Sat, 17 May 2014 10:50:31 +0200
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> Sat, May 17, 2014 at 05:58:16AM CEST, stephen@networkplumber.org wrote:
>> >On Thu, 15 May 2014 18:50:51 +0200
>> >Jiri Pirko <jiri@resnulli.us> wrote:
>> >
>> >> Thu, May 15, 2014 at 05:43:42PM CEST, stephen@networkplumber.org wrote:
>> >> >On Thu, 15 May 2014 15:10:20 +0200
>> >> >Jiri Pirko <jiri@resnulli.us> wrote:
>> >> >
>> >> >> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>> >> >> ---
>> >> >>  misc/arpd.c | 6 +++---
>> >> >>  1 file changed, 3 insertions(+), 3 deletions(-)
>> >> >> 
>> >> >
>> >> >Why not use more standard ether_ntoa ?
>> >> 
>> >> Because the rest of the code uses ll_addr_n2a. There is no user of
>> >> ether_ntoa in iproute2.
>> >
>> >arpd is more of a standalone program.
>> 
>> I know but it is a part of the package (git tree). The other instances
>> use ll_addr_n2a. I'm ok with using ether_ntoa, I just wanted to follow
>> what is already there.
>> 
>> I can change it and post v2 it you want. I can also change other instances
>> of usage ll_addr_n2a to ether_ntoa.
>> 
>> 
>
>This is fine, just went ahead and merged this version.


Stephen, looks like you missed the last (3/3) patch from this set. I
can't see it in the iproute2 git.

Thanks

Jiri
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko June 10, 2014, 4:09 p.m. UTC | #7
Tue, Jun 10, 2014 at 05:50:25PM CEST, jiri@resnulli.us wrote:
>Mon, Jun 09, 2014 at 09:47:22PM CEST, stephen@networkplumber.org wrote:
>>On Sat, 17 May 2014 10:50:31 +0200
>>Jiri Pirko <jiri@resnulli.us> wrote:
>>
>>> Sat, May 17, 2014 at 05:58:16AM CEST, stephen@networkplumber.org wrote:
>>> >On Thu, 15 May 2014 18:50:51 +0200
>>> >Jiri Pirko <jiri@resnulli.us> wrote:
>>> >
>>> >> Thu, May 15, 2014 at 05:43:42PM CEST, stephen@networkplumber.org wrote:
>>> >> >On Thu, 15 May 2014 15:10:20 +0200
>>> >> >Jiri Pirko <jiri@resnulli.us> wrote:
>>> >> >
>>> >> >> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>>> >> >> ---
>>> >> >>  misc/arpd.c | 6 +++---
>>> >> >>  1 file changed, 3 insertions(+), 3 deletions(-)
>>> >> >> 
>>> >> >
>>> >> >Why not use more standard ether_ntoa ?
>>> >> 
>>> >> Because the rest of the code uses ll_addr_n2a. There is no user of
>>> >> ether_ntoa in iproute2.
>>> >
>>> >arpd is more of a standalone program.
>>> 
>>> I know but it is a part of the package (git tree). The other instances
>>> use ll_addr_n2a. I'm ok with using ether_ntoa, I just wanted to follow
>>> what is already there.
>>> 
>>> I can change it and post v2 it you want. I can also change other instances
>>> of usage ll_addr_n2a to ether_ntoa.
>>> 
>>> 
>>
>>This is fine, just went ahead and merged this version.
>
>
>Stephen, looks like you missed the last (3/3) patch from this set. I
>can't see it in the iproute2 git.

Oh, you already applied that before. That confused me because "iproute2:
ipa: show port id" actuall adds code which calls hexstring_n2a :)

Anyway, all good now. Sorry for the fuzz.

>
>Thanks
>
>Jiri
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/misc/arpd.c b/misc/arpd.c
index bfe7de9..0839e3f 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -36,6 +36,7 @@ 
 
 #include "libnetlink.h"
 #include "utils.h"
+#include "rt_names.h"
 
 int resolve_hosts;
 
@@ -721,8 +722,7 @@  int main(int argc, char **argv)
 				goto do_abort;
 			}
 
-			dbdat.data = hexstring_a2n(macbuf, b1, 6);
-			if (dbdat.data == NULL)
+			if (ll_addr_a2n((char *) b1, 6, macbuf) != 6)
 				goto do_abort;
 			dbdat.size = 6;
 
@@ -747,7 +747,7 @@  int main(int argc, char **argv)
 					printf("%-8d %-15s %s\n",
 					       key->iface,
 					       inet_ntoa(*(struct in_addr*)&key->addr),
-					       hexstring_n2a(dbdat.data, 6, b1, 18));
+					       ll_addr_n2a(dbdat.data, 6, ARPHRD_ETHER, b1, 18));
 				} else {
 					printf("%-8d %-15s FAILED: %dsec ago\n",
 					       key->iface,