traffic-selector: Always print protocol if either protocol or port is set
This helps to distinguish between port and protocol if only one of them is set. If no protocol is set it's printed as 0, if the traffic selector covers any port (0-65535) the slash that separates the two values and the port is omitted.
This commit is contained in:
@@ -72,10 +72,13 @@ START_TEST(test_create_from_cidr)
|
||||
verify("10.1.0.1/32[udp]", "10.1.0.1/32[17]",
|
||||
traffic_selector_create_from_cidr("10.1.0.1/32", IPPROTO_UDP,
|
||||
0, 65535));
|
||||
verify("10.1.0.1/32[0/domain]", "10.1.0.1/32[0/53]",
|
||||
traffic_selector_create_from_cidr("10.1.0.1/32", 0,
|
||||
53, 53));
|
||||
verify("10.1.0.1/32[udp/1234-1235]", "10.1.0.1/32[17/1234-1235]",
|
||||
traffic_selector_create_from_cidr("10.1.0.1/32", IPPROTO_UDP,
|
||||
1234, 1235));
|
||||
verify("10.1.0.0/16[OPAQUE]", NULL,
|
||||
verify("10.1.0.0/16[0/OPAQUE]", NULL,
|
||||
traffic_selector_create_from_cidr("10.1.0.0/16", 0, 65535, 0));
|
||||
|
||||
verify(NULL, NULL,
|
||||
|
||||
Reference in New Issue
Block a user