Skip to content

Commit

Permalink
Merge pull request #16452 from louis-6wind/fix-ipv4-mapped-ipv6-display
Browse files Browse the repository at this point in the history
lib, test: fix display ipv4 mapped ipv6 addresses
  • Loading branch information
riw777 authored Oct 16, 2024
2 parents 1ce225d + 3c430cd commit 75e34c0
Show file tree
Hide file tree
Showing 22 changed files with 91 additions and 80 deletions.
13 changes: 12 additions & 1 deletion lib/ntop.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,18 @@ const char *frr_inet_ntop(int af, const void * restrict src,
best = i - curlen;
bestlen = curlen;
}
/* do we want ::ffff:A.B.C.D? */
if (best == 0 && bestlen == 5 && b[10] == 0xff && b[11] == 0xff) {
/* ::ffff:A.B.C.D */
*o++ = ':';
*o++ = ':';
*o++ = 'f';
*o++ = 'f';
*o++ = 'f';
*o++ = 'f';
*o++ = ':';
b += 12;
goto inet4;
}
if (best == 0 && bestlen == 6) {
*o++ = ':';
*o++ = ':';
Expand Down
Binary file modified tests/isisd/test_fuzz_isis_tlv_tests.h.gz
Binary file not shown.
16 changes: 8 additions & 8 deletions tests/topotests/bfd_isis_topo1/rt1/step1/show_ipv6_route.ref
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"::ffff:202:202\/128":[
"::ffff:2.2.2.2\/128":[
{
"prefix":"::ffff:202:202\/128",
"prefix":"::ffff:2.2.2.2\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -16,9 +16,9 @@
]
}
],
"::ffff:303:303\/128":[
"::ffff:3.3.3.3\/128":[
{
"prefix":"::ffff:303:303\/128",
"prefix":"::ffff:3.3.3.3\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -33,9 +33,9 @@
]
}
],
"::ffff:404:404\/128":[
"::ffff:4.4.4.4\/128":[
{
"prefix":"::ffff:404:404\/128",
"prefix":"::ffff:4.4.4.4\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -50,9 +50,9 @@
]
}
],
"::ffff:505:505\/128":[
"::ffff:5.5.5.5\/128":[
{
"prefix":"::ffff:505:505\/128",
"prefix":"::ffff:5.5.5.5\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"::ffff:202:202\/128":[
"::ffff:2.2.2.2\/128":[
{
"prefix":"::ffff:202:202\/128",
"prefix":"::ffff:2.2.2.2\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -16,9 +16,9 @@
]
}
],
"::ffff:303:303\/128":[
"::ffff:3.3.3.3\/128":[
{
"prefix":"::ffff:303:303\/128",
"prefix":"::ffff:3.3.3.3\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -33,9 +33,9 @@
]
}
],
"::ffff:404:404\/128":[
"::ffff:4.4.4.4\/128":[
{
"prefix":"::ffff:404:404\/128",
"prefix":"::ffff:4.4.4.4\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -50,9 +50,9 @@
]
}
],
"::ffff:505:505\/128":[
"::ffff:5.5.5.5\/128":[
{
"prefix":"::ffff:505:505\/128",
"prefix":"::ffff:5.5.5.5\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"::ffff:202:202\/128":[
"::ffff:2.2.2.2\/128":[
{
"prefix":"::ffff:202:202\/128",
"prefix":"::ffff:2.2.2.2\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -16,9 +16,9 @@
]
}
],
"::ffff:303:303\/128":[
"::ffff:3.3.3.3\/128":[
{
"prefix":"::ffff:303:303\/128",
"prefix":"::ffff:3.3.3.3\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -33,9 +33,9 @@
]
}
],
"::ffff:404:404\/128":[
"::ffff:4.4.4.4\/128":[
{
"prefix":"::ffff:404:404\/128",
"prefix":"::ffff:4.4.4.4\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -50,9 +50,9 @@
]
}
],
"::ffff:505:505\/128":[
"::ffff:5.5.5.5\/128":[
{
"prefix":"::ffff:505:505\/128",
"prefix":"::ffff:5.5.5.5\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"::ffff:202:202\/128":[
"::ffff:2.2.2.2\/128":[
{
"prefix":"::ffff:202:202\/128",
"prefix":"::ffff:2.2.2.2\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -16,9 +16,9 @@
]
}
],
"::ffff:303:303\/128":[
"::ffff:3.3.3.3\/128":[
{
"prefix":"::ffff:303:303\/128",
"prefix":"::ffff:3.3.3.3\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -33,9 +33,9 @@
]
}
],
"::ffff:404:404\/128":[
"::ffff:4.4.4.4\/128":[
{
"prefix":"::ffff:404:404\/128",
"prefix":"::ffff:4.4.4.4\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand All @@ -50,9 +50,9 @@
]
}
],
"::ffff:505:505\/128":[
"::ffff:5.5.5.5\/128":[
{
"prefix":"::ffff:505:505\/128",
"prefix":"::ffff:5.5.5.5\/128",
"protocol":"isis",
"selected":true,
"destSelected":true,
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_isis_topo1/rt1/zebra.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ hostname rt1
!
interface lo
ip address 1.1.1.1/32
ipv6 address ::ffff:0101:0101/128
ipv6 address ::ffff:1.1.1.1/128
!
interface eth-rt2
ip address 10.0.1.1/24
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_isis_topo1/rt2/zebra.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hostname rt2
!
interface lo
ip address 2.2.2.2/32
ipv6 address ::ffff:0202:0202/128
ipv6 address ::ffff:2.2.2.2/128
!
interface eth-rt1
ip address 10.0.1.2/24
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_isis_topo1/rt3/zebra.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hostname rt3
!
interface lo
ip address 3.3.3.3/32
ipv6 address ::ffff:0303:0303/128
ipv6 address ::ffff:3.3.3.3/128
!
interface eth-rt1
ip address 10.0.2.2/24
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_isis_topo1/rt4/zebra.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hostname rt4
!
interface lo
ip address 4.4.4.4/32
ipv6 address ::ffff:0404:0404/128
ipv6 address ::ffff:4.4.4.4/128
!
interface eth-rt3
ip address 10.0.4.2/24
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_isis_topo1/rt5/zebra.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hostname rt5
!
interface lo
ip address 5.5.5.5/32
ipv6 address ::ffff:0505:0505/128
ipv6 address ::ffff:5.5.5.5/128
!
interface eth-rt2
ip address 10.0.3.2/24
Expand Down
16 changes: 8 additions & 8 deletions tests/topotests/bfd_ospf_topo1/rt1/step1/show_ipv6_route.ref
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"::ffff:202:202\/128":[
"::ffff:2.2.2.2\/128":[
{
"prefix":"::ffff:202:202\/128",
"prefix":"::ffff:2.2.2.2\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -16,9 +16,9 @@
]
}
],
"::ffff:303:303\/128":[
"::ffff:3.3.3.3\/128":[
{
"prefix":"::ffff:303:303\/128",
"prefix":"::ffff:3.3.3.3\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -33,9 +33,9 @@
]
}
],
"::ffff:404:404\/128":[
"::ffff:4.4.4.4\/128":[
{
"prefix":"::ffff:404:404\/128",
"prefix":"::ffff:4.4.4.4\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -50,9 +50,9 @@
]
}
],
"::ffff:505:505\/128":[
"::ffff:5.5.5.5\/128":[
{
"prefix":"::ffff:505:505\/128",
"prefix":"::ffff:5.5.5.5\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"::ffff:202:202\/128":[
"::ffff:2.2.2.2\/128":[
{
"prefix":"::ffff:202:202\/128",
"prefix":"::ffff:2.2.2.2\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -16,9 +16,9 @@
]
}
],
"::ffff:303:303\/128":[
"::ffff:3.3.3.3\/128":[
{
"prefix":"::ffff:303:303\/128",
"prefix":"::ffff:3.3.3.3\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -33,9 +33,9 @@
]
}
],
"::ffff:404:404\/128":[
"::ffff:4.4.4.4\/128":[
{
"prefix":"::ffff:404:404\/128",
"prefix":"::ffff:4.4.4.4\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -50,9 +50,9 @@
]
}
],
"::ffff:505:505\/128":[
"::ffff:5.5.5.5\/128":[
{
"prefix":"::ffff:505:505\/128",
"prefix":"::ffff:5.5.5.5\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"::ffff:202:202\/128":[
"::ffff:2.2.2.2\/128":[
{
"prefix":"::ffff:202:202\/128",
"prefix":"::ffff:2.2.2.2\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -16,9 +16,9 @@
]
}
],
"::ffff:303:303\/128":[
"::ffff:3.3.3.3\/128":[
{
"prefix":"::ffff:303:303\/128",
"prefix":"::ffff:3.3.3.3\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -33,9 +33,9 @@
]
}
],
"::ffff:404:404\/128":[
"::ffff:4.4.4.4\/128":[
{
"prefix":"::ffff:404:404\/128",
"prefix":"::ffff:4.4.4.4\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand All @@ -50,9 +50,9 @@
]
}
],
"::ffff:505:505\/128":[
"::ffff:5.5.5.5\/128":[
{
"prefix":"::ffff:505:505\/128",
"prefix":"::ffff:5.5.5.5\/128",
"protocol":"ospf6",
"selected":true,
"destSelected":true,
Expand Down
Loading

0 comments on commit 75e34c0

Please sign in to comment.