summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorMike RE Mallin <mremallin@gmail.com>2024-05-21 16:16:09 +0200
committerMike RE Mallin <mremallin@gmail.com>2024-05-31 16:27:22 +0200
commitf450332476e6358ccdab9810ab45b0e6f85da4be (patch)
tree331f7a403b04cf25274683e4d05d4f7cc37e8bf0 /tests/lib
parentlib, zebra: Update prefix_sg structure for IPv6 group support (diff)
downloadfrr-f450332476e6358ccdab9810ab45b0e6f85da4be.tar.xz
frr-f450332476e6358ccdab9810ab45b0e6f85da4be.zip
tests: Extend prefix_sg print UT for IPv6
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/test_printfrr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/lib/test_printfrr.c b/tests/lib/test_printfrr.c
index cefa07ec7..a81ebcdbc 100644
--- a/tests/lib/test_printfrr.c
+++ b/tests/lib/test_printfrr.c
@@ -230,19 +230,25 @@ int main(int argc, char **argv)
printchk("02:ca:fe:f0:0d:1e", "%pFXh", &pfx);
struct prefix_sg sg;
- sg.src.s_addr = INADDR_ANY;
+ SET_IPADDR_V4(&sg.src);
+ sg.src.ipaddr_v4.s_addr = INADDR_ANY;
sg.grp.s_addr = INADDR_ANY;
printchk("(*,*)", "%pPSG4", &sg);
- inet_aton("192.168.1.2", &sg.src);
+ inet_aton("192.168.1.2", &sg.src.ipaddr_v4);
printchk("(192.168.1.2,*)", "%pPSG4", &sg);
inet_aton("224.1.2.3", &sg.grp);
printchk("(192.168.1.2,224.1.2.3)", "%pPSG4", &sg);
- sg.src.s_addr = INADDR_ANY;
+ SET_IPADDR_NONE(&sg.src);
+ sg.src.ipaddr_v4.s_addr = INADDR_ANY;
printchk("(*,224.1.2.3)", "%pPSG4", &sg);
+ SET_IPADDR_V6(&sg.src);
+ inet_pton(AF_INET6, "1:2:3:4::5", &sg.src.ipaddr_v6);
+ printchk("(1:2:3:4::5,224.1.2.3)", "%pPSG4", &sg);
+
uint8_t randhex[] = { 0x12, 0x34, 0x00, 0xca, 0xfe, 0x00, 0xaa, 0x55 };
FMT_NSTD(printchk("12 34 00 ca fe 00 aa 55", "%.8pHX", randhex));