test/tft_test: Update filter test suite

The “IPv4 local address type” filter should be 9 bytes since it includes
not only the ip address, but also its subnet mask.

Quoting from 3GPP TS 24.008 10.5.6.12:
"""
 For "IPv4 remote address type", the packet filter component value field
 shall be encoded as a sequence of a four octet IPv4 address field and a
 four octet IPv4 address mask field. The IPv4 address field shall be
 transmitted first. For "IPv4 local address type", the packet filter
 component value field shall be encoded as defined for "IPv4 remote
 address type".
"""

Same for the ToS which also includes a 1 byte mask value
This commit is contained in:
Sylvain Munaut 2020-07-09 17:29:50 +02:00 committed by Andre Puschmann
parent 5783c01cbb
commit 9ba8b62972
1 changed files with 10 additions and 6 deletions

View File

@ -171,13 +171,15 @@ int tft_filter_test_ipv4_local_addr()
ip_msg1 = allocate_unique_buffer(*pool);
ip_msg2 = allocate_unique_buffer(*pool);
// Filter length: 5 bytes
// Filter length: 9 bytes
// Filter type: IPv4 local address
// Local address: 127.0.0.1
uint8_t filter_message[5];
uint8_t filter_size = 5;
// Subnet mask: 255.0.0.0
uint8_t filter_message[9];
uint8_t filter_size = 9;
filter_message[0] = IPV4_LOCAL_ADDR_TYPE;
inet_pton(AF_INET, "127.0.0.1", &filter_message[1]);
inet_pton(AF_INET, "255.0.0.0", &filter_message[5]);
// Set IP test message
ip_msg1->N_bytes = ip_message_len1;
@ -267,13 +269,15 @@ int tft_filter_test_ipv4_tos()
ip_msg1 = allocate_unique_buffer(*pool);
ip_msg2 = allocate_unique_buffer(*pool);
// Filter length: 2 bytes
// Filter length: 3 bytes
// Filter type: Type of service
// ToS: 4
uint8_t filter_message[2];
uint8_t filter_size = 2;
// ToS mask: 255
uint8_t filter_message[3];
uint8_t filter_size = 3;
filter_message[0] = TYPE_OF_SERVICE_TYPE;
filter_message[1] = 4;
filter_message[2] = 255;
// Set IP test message
ip_msg1->N_bytes = ip_message_len1;