mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-09 18:41:55 +00:00
Birdtest: Use origin macros from lib/ip.h
Thanks to Ondrej 'Santiago' Zajicek
This commit is contained in:
parent
7e035b81cb
commit
ca996d807f
@ -13,12 +13,6 @@
|
|||||||
|
|
||||||
#define IP4_MAX_LEN 16
|
#define IP4_MAX_LEN 16
|
||||||
|
|
||||||
static u32
|
|
||||||
build_ip4(u8 a, u8 b, u8 c, u8 d)
|
|
||||||
{
|
|
||||||
return ((u32)a << 24) + ((u32)b << 16) + ((u32)c << 8) + (u32)d;
|
|
||||||
}
|
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
ip4_pton_(char *s)
|
ip4_pton_(char *s)
|
||||||
{
|
{
|
||||||
@ -36,15 +30,15 @@ t_ip4_pton(void)
|
|||||||
} in_out[] = {
|
} in_out[] = {
|
||||||
{
|
{
|
||||||
.in = "192.168.1.128",
|
.in = "192.168.1.128",
|
||||||
.out = build_ip4(192, 168, 1, 128),
|
.out = ip4_to_u32(ip4_build(192, 168, 1, 128)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.in = "255.255.255.255",
|
.in = "255.255.255.255",
|
||||||
.out = build_ip4(255, 255, 255, 255),
|
.out = ip4_to_u32(ip4_build(255, 255, 255, 255)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.in = "0.0.0.0",
|
.in = "0.0.0.0",
|
||||||
.out = build_ip4(0, 0, 0, 0),
|
.out = ip4_to_u32(ip4_build(0, 0, 0, 0)),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -119,15 +113,15 @@ t_ip4_ntop(void)
|
|||||||
char out[IP4_MAX_LEN];
|
char out[IP4_MAX_LEN];
|
||||||
} in_out[] = {
|
} in_out[] = {
|
||||||
{
|
{
|
||||||
.in = ip4_from_u32(build_ip4(192, 168, 1, 128)),
|
.in = ip4_build(192, 168, 1, 128),
|
||||||
.out = "192.168.1.128",
|
.out = "192.168.1.128",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.in = ip4_from_u32(build_ip4(255, 255, 255, 255)),
|
.in = ip4_build(255, 255, 255, 255),
|
||||||
.out = "255.255.255.255",
|
.out = "255.255.255.255",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.in = ip4_from_u32(build_ip4(0, 0, 0, 1)),
|
.in = ip4_build(0, 0, 0, 1),
|
||||||
.out = "0.0.0.1",
|
.out = "0.0.0.1",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user