mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
tests: ipv4-prefix: added checks for ipv4_route_to_cidr
This commit is contained in:
@@ -18,8 +18,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <talloc.h>
|
||||
|
||||
#include "../src/common.h"
|
||||
#include "../src/ip-util.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -102,5 +103,20 @@ int main()
|
||||
}
|
||||
talloc_free(p);
|
||||
|
||||
/* Check ipv4_route_to_cidr */
|
||||
p = ipv4_route_to_cidr(NULL, "192.168.5.0/255.255.255.0");
|
||||
if (p == NULL || strcmp(p, "192.168.5.0/24") != 0) {
|
||||
fprintf(stderr, "error in %d: %s\n", __LINE__, p);
|
||||
exit(1);
|
||||
}
|
||||
talloc_free(p);
|
||||
|
||||
p = ipv4_route_to_cidr(NULL, "192.168.4.0/255.255.0.0");
|
||||
if (p == NULL || strcmp(p, "192.168.4.0/16") != 0) {
|
||||
fprintf(stderr, "error in %d: %s\n", __LINE__, p);
|
||||
exit(1);
|
||||
}
|
||||
talloc_free(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user