netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iproute2: fix broken get_prefix_1
@ 2015-03-21 20:07 Joe Harvell
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Harvell @ 2015-03-21 20:07 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Vadim Kochan

Fixes bug that causes a basic 'ip addr add' command to fail address due 
to the address prefix is incorrectly determined to be invalid.

I assume master must have some new change because this fix was needed 
for a basic 'ip addr add 10.0.3.1/24 dev dumbo label foo' command I 
pased in.  In this case, 'family' passed into get_addr_1 two lines above 
is zero, causing get_addr_1 to detect the family from the address and 
populate the result in the family field in dst.  But then instead of 
passing in the result, family (still 0) is passed in to af_bit_len. 
Without my change, the above command complains that 10.0.3.1/24 is not 
an address prefix.  With the change it works fine as expected.

The following changes since commit 4612d04d6b8f07274bd5d0688f717ccc189499ad:

   tc class: Show class names from file (2015-03-15 12:27:40 -0700)

are available in the git repository at:

   git@github.com:jharvell/iproute2.git fix-broken-get_prefix_1

for you to fetch changes up to d24d5cb9ad9b09ceb37aa8ffe8c1160c14f713ef:

   Signed-off-by: Joe Harvell <joe.harvell@tekcomms.com> (2015-03-21 
15:03:32 -0500)

----------------------------------------------------------------
Joe Harvell (2):
       Fixing obvious error of passing in the wrong variable for the 
family parameter     of af_bit_len.
       Signed-off-by: Joe Harvell <joe.harvell@tekcomms.com>

  lib/utils.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils.c b/lib/utils.c
index 9cda268..0d08a86 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -477,7 +477,7 @@ int get_prefix_1(inet_prefix *dst, char *arg, int 
family)

         err = get_addr_1(dst, arg, family);
         if (err == 0) {
-               dst->bitlen = af_bit_len(family);
+               dst->bitlen = af_bit_len(dst->family);

                 if (slash) {
                         if (get_netmask(&plen, slash+1, 0)

^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [PATCH] iproute2: fix broken get_prefix_1
@ 2015-03-21 17:46 Joe Harvell
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Harvell @ 2015-03-21 17:46 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Vadim Kochan

Fixes bug that causes a basic 'ip addr add' command to fail address due 
to the address prefix is incorrectly determined to be invalid.

I assume master must have some new change because this fix was needed 
for a basic 'ip addr add 10.0.3.1/24 dev dumbo label foo' command I 
pased in.  In this case, 'family' passed into get_addr_1 two lines above 
is zero, causing get_addr_1 to detect the family from the address and 
populate the result in the family field in dst.  But then instead of 
passing in the result, family (still 0) is passed in to af_bit_len. 
Without my change, the above command complains that 10.0.3.1/24 is not 
an address prefix.  With the change it works fine as expected.

The following changes since commit 4612d04d6b8f07274bd5d0688f717ccc189499ad:

   tc class: Show class names from file (2015-03-15 12:27:40 -0700)

are available in the git repository at:

   git@github.com:jharvell/iproute2.git fix-broken-get_prefix_1

for you to fetch changes up to 50d23ac0379cc1371f1096a4c84d8c1573c0a00a:

   Signed-off-by: Joe Harvell <joe.harvell@tekcomms.com> Tested-by: Joe 
Harvell <joe.harvell@tekcomms.com> (2015-03-21 12:35:15 -0500)

----------------------------------------------------------------
Joe Harvell (2):
       Fixing obvious error of passing in the wrong variable for the 
family parameter     of af_bit_len.
       Signed-off-by: Joe Harvell <joe.harvell@tekcomms.com>     
Tested-by: Joe Harvell <joe.harvell@tekcomms.com>

  lib/utils.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils.c b/lib/utils.c
index 9cda268..0d08a86 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -477,7 +477,7 @@ int get_prefix_1(inet_prefix *dst, char *arg, int 
family)

         err = get_addr_1(dst, arg, family);
         if (err == 0) {
-               dst->bitlen = af_bit_len(family);
+               dst->bitlen = af_bit_len(dst->family);

                 if (slash) {
                         if (get_netmask(&plen, slash+1, 0)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-21 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-21 20:07 [PATCH] iproute2: fix broken get_prefix_1 Joe Harvell
  -- strict thread matches above, loose matches on Subject: below --
2015-03-21 17:46 Joe Harvell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).