Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/netpfil/pf/route_to.sh
| Show First 20 Lines • Show All 962 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| atf_test_case "table_loop" "cleanup" | atf_test_case "table_loop" "cleanup" | ||||
| table_loop_head() | table_loop_head() | ||||
| { | { | ||||
| atf_set descr 'Check that iterating over tables poperly loops' | atf_set descr 'Check that iterating over tables poperly loops' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| table_loop_body() | table_loop_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| jexec router pfctl -e | jexec router pfctl -e | ||||
| pft_set_rules router \ | pft_set_rules router \ | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
| atf_test_case "roundrobin" "cleanup" | atf_test_case "roundrobin" "cleanup" | ||||
| roundrobin_head() | roundrobin_head() | ||||
| { | { | ||||
| atf_set descr 'multiple gateways of mixed AF, including prefixes and tables, for IPv6 packets' | atf_set descr 'multiple gateways of mixed AF, including prefixes and tables, for IPv6 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| roundrobin_body() | roundrobin_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # The rule is defined as "inet6 proto tcp" so directly given IPv4 hosts | # The rule is defined as "inet6 proto tcp" so directly given IPv4 hosts | ||||
| # will be removed from the pool by pfctl. Tables will still be loaded | # will be removed from the pool by pfctl. Tables will still be loaded | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| atf_test_case "random_table" "cleanup" | atf_test_case "random_table" "cleanup" | ||||
| random_table_head() | random_table_head() | ||||
| { | { | ||||
| atf_set descr 'Pool with random flag and a table for IPv6' | atf_set descr 'Pool with random flag and a table for IPv6' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| random_table_body() | random_table_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # The "random" flag will pick random hosts from the table but will | # The "random" flag will pick random hosts from the table but will | ||||
| # not dive into prefixes, always choosing the 0th address. | # not dive into prefixes, always choosing the 0th address. | ||||
| Show All 21 Lines | |||||
| } | } | ||||
| atf_test_case "random_prefix" "cleanup" | atf_test_case "random_prefix" "cleanup" | ||||
| random_prefix_head() | random_prefix_head() | ||||
| { | { | ||||
| atf_set descr 'Pool with random flag and a table for IPv4' | atf_set descr 'Pool with random flag and a table for IPv4' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| random_prefix_body() | random_prefix_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # The "random" flag will pick random hosts from given prefix. | # The "random" flag will pick random hosts from given prefix. | ||||
| # The choice being random makes testing it non-trivial. We do 10 | # The choice being random makes testing it non-trivial. We do 10 | ||||
| Show All 20 Lines | |||||
| } | } | ||||
| atf_test_case "prefer_ipv6_nexthop_single_ipv4" "cleanup" | atf_test_case "prefer_ipv6_nexthop_single_ipv4" "cleanup" | ||||
| prefer_ipv6_nexthop_single_ipv4_head() | prefer_ipv6_nexthop_single_ipv4_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for a single IPv4 gateway' | atf_set descr 'prefer-ipv6-nexthop option for a single IPv4 gateway' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_single_ipv4_body() | prefer_ipv6_nexthop_single_ipv4_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # Basic forwarding test for prefer-ipv6-nexthop pool option. | # Basic forwarding test for prefer-ipv6-nexthop pool option. | ||||
| # A single IPv4 gateway will work only for IPv4 traffic. | # A single IPv4 gateway will work only for IPv4 traffic. | ||||
| Show All 36 Lines | |||||
| } | } | ||||
| atf_test_case "prefer_ipv6_nexthop_single_ipv6" "cleanup" | atf_test_case "prefer_ipv6_nexthop_single_ipv6" "cleanup" | ||||
| prefer_ipv6_nexthop_single_ipv6_head() | prefer_ipv6_nexthop_single_ipv6_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for a single IPv6 gateway' | atf_set descr 'prefer-ipv6-nexthop option for a single IPv6 gateway' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_single_ipv6_body() | prefer_ipv6_nexthop_single_ipv6_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # Basic forwarding test for prefer-ipv6-nexthop pool option. | # Basic forwarding test for prefer-ipv6-nexthop pool option. | ||||
| # A single IPve gateway will work both for IPv4 and IPv6 traffic. | # A single IPve gateway will work both for IPv4 and IPv6 traffic. | ||||
| Show All 34 Lines | |||||
| } | } | ||||
| atf_test_case "prefer_ipv6_nexthop_mixed_af_roundrobin_ipv4" "cleanup" | atf_test_case "prefer_ipv6_nexthop_mixed_af_roundrobin_ipv4" "cleanup" | ||||
| prefer_ipv6_nexthop_mixed_af_roundrobin_ipv4_head() | prefer_ipv6_nexthop_mixed_af_roundrobin_ipv4_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for multiple gateways of mixed AF with prefixes and tables, round robin selection, for IPv4 packets' | atf_set descr 'prefer-ipv6-nexthop option for multiple gateways of mixed AF with prefixes and tables, round robin selection, for IPv4 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_mixed_af_roundrobin_ipv4_body() | prefer_ipv6_nexthop_mixed_af_roundrobin_ipv4_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # pf_map_addr() starts iterating over hosts of the pool from the 2nd | # pf_map_addr() starts iterating over hosts of the pool from the 2nd | ||||
| # host. This behaviour was here before adding prefer-ipv6-nexthop | # host. This behaviour was here before adding prefer-ipv6-nexthop | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| pft_cleanup | pft_cleanup | ||||
| } | } | ||||
| prefer_ipv6_nexthop_mixed_af_roundrobin_ipv6_head() | prefer_ipv6_nexthop_mixed_af_roundrobin_ipv6_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for multiple gateways of mixed AF with prefixes and tables, round-robin selection, for IPv6 packets' | atf_set descr 'prefer-ipv6-nexthop option for multiple gateways of mixed AF with prefixes and tables, round-robin selection, for IPv6 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_mixed_af_roundrobin_ipv6_body() | prefer_ipv6_nexthop_mixed_af_roundrobin_ipv6_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # The "random" flag will pick random hosts from the table but will | # The "random" flag will pick random hosts from the table but will | ||||
| # not dive into prefixes, always choosing the 0th address. | # not dive into prefixes, always choosing the 0th address. | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| atf_test_case "prefer_ipv6_nexthop_mixed_af_random_ipv4" "cleanup" | atf_test_case "prefer_ipv6_nexthop_mixed_af_random_ipv4" "cleanup" | ||||
| prefer_ipv6_nexthop_mixed_af_random_table_ipv4_head() | prefer_ipv6_nexthop_mixed_af_random_table_ipv4_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for a mixed-af table with random selection for IPv4 packets' | atf_set descr 'prefer-ipv6-nexthop option for a mixed-af table with random selection for IPv4 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_mixed_af_random_table_ipv4_body() | prefer_ipv6_nexthop_mixed_af_random_table_ipv4_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # Similarly to the test "random_table" the algorithm will choose | # Similarly to the test "random_table" the algorithm will choose | ||||
| # IP addresses from the table not diving into prefixes. | # IP addresses from the table not diving into prefixes. | ||||
| Show All 21 Lines | |||||
| { | { | ||||
| pft_cleanup | pft_cleanup | ||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv4_random_table_ipv4_head() | prefer_ipv6_nexthop_ipv4_random_table_ipv4_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for an IPv4-only table with random selection for IPv4 packets' | atf_set descr 'prefer-ipv6-nexthop option for an IPv4-only table with random selection for IPv4 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv4_random_table_ipv4_body() | prefer_ipv6_nexthop_ipv4_random_table_ipv4_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # Similarly to the test pf_map_addr:random_table the algorithm will | # Similarly to the test pf_map_addr:random_table the algorithm will | ||||
| # choose IP addresses from the table not diving into prefixes. | # choose IP addresses from the table not diving into prefixes. | ||||
| Show All 19 Lines | |||||
| { | { | ||||
| pft_cleanup | pft_cleanup | ||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv4_random_table_ipv6_head() | prefer_ipv6_nexthop_ipv4_random_table_ipv6_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for an IPv4-only table with random selection for IPv6 packets' | atf_set descr 'prefer-ipv6-nexthop option for an IPv4-only table with random selection for IPv6 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv4_random_table_ipv6_body() | prefer_ipv6_nexthop_ipv4_random_table_ipv6_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # IPv6 packets can't be forwarded over IPv4 next-hops. | # IPv6 packets can't be forwarded over IPv4 next-hops. | ||||
| # The failure happens in pf_map_addr() and increases the respective | # The failure happens in pf_map_addr() and increases the respective | ||||
| Show All 21 Lines | |||||
| { | { | ||||
| pft_cleanup | pft_cleanup | ||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv6_random_prefix_ipv4_head() | prefer_ipv6_nexthop_ipv6_random_prefix_ipv4_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for an IPv6 prefix with random selection for IPv4 packets' | atf_set descr 'prefer-ipv6-nexthop option for an IPv6 prefix with random selection for IPv4 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv6_random_prefix_ipv4_body() | prefer_ipv6_nexthop_ipv6_random_prefix_ipv4_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| jexec router pfctl -e | jexec router pfctl -e | ||||
| pft_set_rules router \ | pft_set_rules router \ | ||||
| Show All 12 Lines | |||||
| { | { | ||||
| pft_cleanup | pft_cleanup | ||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv6_random_prefix_ipv6_head() | prefer_ipv6_nexthop_ipv6_random_prefix_ipv6_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for an IPv6 prefix with random selection for IPv6 packets' | atf_set descr 'prefer-ipv6-nexthop option for an IPv6 prefix with random selection for IPv6 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv6_random_prefix_ipv6_body() | prefer_ipv6_nexthop_ipv6_random_prefix_ipv6_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| jexec router pfctl -e | jexec router pfctl -e | ||||
| pft_set_rules router \ | pft_set_rules router \ | ||||
| Show All 12 Lines | |||||
| { | { | ||||
| pft_cleanup | pft_cleanup | ||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv4_random_prefix_ipv4_head() | prefer_ipv6_nexthop_ipv4_random_prefix_ipv4_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for an IPv4 prefix with random selection for IPv4 packets' | atf_set descr 'prefer-ipv6-nexthop option for an IPv4 prefix with random selection for IPv4 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv4_random_prefix_ipv4_body() | prefer_ipv6_nexthop_ipv4_random_prefix_ipv4_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| jexec router pfctl -e | jexec router pfctl -e | ||||
| pft_set_rules router \ | pft_set_rules router \ | ||||
| Show All 12 Lines | |||||
| { | { | ||||
| pft_cleanup | pft_cleanup | ||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv4_random_prefix_ipv6_head() | prefer_ipv6_nexthop_ipv4_random_prefix_ipv6_head() | ||||
| { | { | ||||
| atf_set descr 'prefer-ipv6-nexthop option for an IPv4 prefix with random selection for IPv6 packets' | atf_set descr 'prefer-ipv6-nexthop option for an IPv4 prefix with random selection for IPv6 packets' | ||||
| atf_set require.user root | atf_set require.user root | ||||
| atf_set require.progs python3 scapy | |||||
| } | } | ||||
| prefer_ipv6_nexthop_ipv4_random_prefix_ipv6_body() | prefer_ipv6_nexthop_ipv4_random_prefix_ipv6_body() | ||||
| { | { | ||||
| pf_map_addr_common | pf_map_addr_common | ||||
| # IPv6 packets can't be forwarded over IPv4 next-hops. | # IPv6 packets can't be forwarded over IPv4 next-hops. | ||||
| # The failure happens in pf_map_addr() and increases the respective | # The failure happens in pf_map_addr() and increases the respective | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||