History log of /linux/tools/testing/selftests/net/tcp_ao/icmps-discard.c (Results 1 – 3 of 3)
Revision Date Author Comments
# 586d8702 23-Aug-2024 Dmitry Safonov <0x7f454c46@gmail.com>

selftests/net: Add trace events matching to tcp_ao

Setup trace points, add a new ftrace instance in order to not interfere
with the rest of the system, filtering by net namespace cookies.
Raise a ne

selftests/net: Add trace events matching to tcp_ao

Setup trace points, add a new ftrace instance in order to not interfere
with the rest of the system, filtering by net namespace cookies.
Raise a new background thread that parses trace_pipe, matches them with
the list of expected events.

Wiring up trace events to selftests provides another insight if there is
anything unexpected happining in the tcp-ao code (i.e. key rotation when
it's not expected).

Note: in real programs libtraceevent should be used instead of this
manual labor of setting ftrace up and parsing. I'm not using it here
as I don't want to have an .so library dependency that one would have to
bring into VM or DUT (Device Under Test). Please, don't copy it over
into any real world programs, that aren't tests.

Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
Link: https://patch.msgid.link/20240823-tcp-ao-selftests-upd-6-12-v4-8-05623636fe8c@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

show more ...


# d11301f6 15-Dec-2023 Dmitry Safonov <dima@arista.com>

selftests/net: Add TCP-AO ICMPs accept test

Reverse to icmps-discard test: the server accepts ICMPs, using
TCP_AO_CMDF_ACCEPT_ICMP and it is expected to fail under ICMP
flood from client. Test that

selftests/net: Add TCP-AO ICMPs accept test

Reverse to icmps-discard test: the server accepts ICMPs, using
TCP_AO_CMDF_ACCEPT_ICMP and it is expected to fail under ICMP
flood from client. Test that the default pre-TCP-AO behaviour functions
when TCP_AO_CMDF_ACCEPT_ICMP is set.

Expected output for ipv4 version (in case it receives ICMP_PROT_UNREACH):
> # ./icmps-accept_ipv4
> 1..3
> # 3209[lib/setup.c:166] rand seed 1642623870
> TAP version 13
> # 3209[lib/proc.c:207] Snmp6 Ip6InReceives: 0 => 1
> # 3209[lib/proc.c:207] Snmp6 Ip6InNoRoutes: 0 => 1
> # 3209[lib/proc.c:207] Snmp6 Ip6InOctets: 0 => 76
> # 3209[lib/proc.c:207] Snmp6 Ip6InNoECTPkts: 0 => 1
> # 3209[lib/proc.c:207] Tcp InSegs: 3 => 23
> # 3209[lib/proc.c:207] Tcp OutSegs: 2 => 22
> # 3209[lib/proc.c:207] IcmpMsg InType3: 0 => 4
> # 3209[lib/proc.c:207] Icmp InMsgs: 0 => 4
> # 3209[lib/proc.c:207] Icmp InDestUnreachs: 0 => 4
> # 3209[lib/proc.c:207] Ip InReceives: 3 => 27
> # 3209[lib/proc.c:207] Ip InDelivers: 3 => 27
> # 3209[lib/proc.c:207] Ip OutRequests: 2 => 22
> # 3209[lib/proc.c:207] IpExt InOctets: 288 => 3420
> # 3209[lib/proc.c:207] IpExt OutOctets: 124 => 3244
> # 3209[lib/proc.c:207] IpExt InNoECTPkts: 3 => 25
> # 3209[lib/proc.c:207] TcpExt TCPPureAcks: 1 => 2
> # 3209[lib/proc.c:207] TcpExt TCPOrigDataSent: 0 => 20
> # 3209[lib/proc.c:207] TcpExt TCPDelivered: 0 => 19
> # 3209[lib/proc.c:207] TcpExt TCPAOGood: 3 => 23
> ok 1 InDestUnreachs delivered 4
> ok 2 server failed with -92: Protocol not available
> ok 3 TCPAODroppedIcmps counter didn't change: 0 >= 0
> # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0

Expected output for ipv6 version (in case it receives ADM_PROHIBITED):
> # ./icmps-accept_ipv6
> 1..3
> # 3277[lib/setup.c:166] rand seed 1642624035
> TAP version 13
> # 3277[lib/proc.c:207] Snmp6 Ip6InReceives: 6 => 31
> # 3277[lib/proc.c:207] Snmp6 Ip6InDelivers: 4 => 29
> # 3277[lib/proc.c:207] Snmp6 Ip6OutRequests: 4 => 24
> # 3277[lib/proc.c:207] Snmp6 Ip6InOctets: 592 => 4492
> # 3277[lib/proc.c:207] Snmp6 Ip6OutOctets: 332 => 3852
> # 3277[lib/proc.c:207] Snmp6 Ip6InNoECTPkts: 6 => 31
> # 3277[lib/proc.c:207] Snmp6 Icmp6InMsgs: 1 => 6
> # 3277[lib/proc.c:207] Snmp6 Icmp6InDestUnreachs: 0 => 5
> # 3277[lib/proc.c:207] Snmp6 Icmp6InType1: 0 => 5
> # 3277[lib/proc.c:207] Tcp InSegs: 3 => 23
> # 3277[lib/proc.c:207] Tcp OutSegs: 2 => 22
> # 3277[lib/proc.c:207] TcpExt TCPPureAcks: 1 => 2
> # 3277[lib/proc.c:207] TcpExt TCPOrigDataSent: 0 => 20
> # 3277[lib/proc.c:207] TcpExt TCPDelivered: 0 => 19
> # 3277[lib/proc.c:207] TcpExt TCPAOGood: 3 => 23
> ok 1 Icmp6InDestUnreachs delivered 5
> ok 2 server failed with -13: Permission denied
> ok 3 TCPAODroppedIcmps counter didn't change: 0 >= 0
> # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0

With some luck the server may fail with ECONNREFUSED (depending on what
icmp packet was delivered firstly).
For the kernel error handlers see: tab_unreach[] and icmp_err_convert[].

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

show more ...


# a8fcf8ca 15-Dec-2023 Dmitry Safonov <dima@arista.com>

selftests/net: Verify that TCP-AO complies with ignoring ICMPs

Hand-crafted ICMP packets are sent to the server, the server checks for
hard/soft errors and fails if any.

Expected output for ipv4 ve

selftests/net: Verify that TCP-AO complies with ignoring ICMPs

Hand-crafted ICMP packets are sent to the server, the server checks for
hard/soft errors and fails if any.

Expected output for ipv4 version:
> # ./icmps-discard_ipv4
> 1..3
> # 3164[lib/setup.c:166] rand seed 1642623745
> TAP version 13
> # 3164[lib/proc.c:207] Snmp6 Ip6InReceives: 0 => 1
> # 3164[lib/proc.c:207] Snmp6 Ip6InNoRoutes: 0 => 1
> # 3164[lib/proc.c:207] Snmp6 Ip6InOctets: 0 => 76
> # 3164[lib/proc.c:207] Snmp6 Ip6InNoECTPkts: 0 => 1
> # 3164[lib/proc.c:207] Tcp InSegs: 2 => 203
> # 3164[lib/proc.c:207] Tcp OutSegs: 1 => 202
> # 3164[lib/proc.c:207] IcmpMsg InType3: 0 => 543
> # 3164[lib/proc.c:207] Icmp InMsgs: 0 => 543
> # 3164[lib/proc.c:207] Icmp InDestUnreachs: 0 => 543
> # 3164[lib/proc.c:207] Ip InReceives: 2 => 746
> # 3164[lib/proc.c:207] Ip InDelivers: 2 => 746
> # 3164[lib/proc.c:207] Ip OutRequests: 1 => 202
> # 3164[lib/proc.c:207] IpExt InOctets: 132 => 61684
> # 3164[lib/proc.c:207] IpExt OutOctets: 68 => 31324
> # 3164[lib/proc.c:207] IpExt InNoECTPkts: 2 => 744
> # 3164[lib/proc.c:207] TcpExt TCPPureAcks: 1 => 2
> # 3164[lib/proc.c:207] TcpExt TCPOrigDataSent: 0 => 200
> # 3164[lib/proc.c:207] TcpExt TCPDelivered: 0 => 199
> # 3164[lib/proc.c:207] TcpExt TCPAOGood: 2 => 203
> # 3164[lib/proc.c:207] TcpExt TCPAODroppedIcmps: 0 => 541
> ok 1 InDestUnreachs delivered 543
> ok 2 Server survived 20000 bytes of traffic
> ok 3 ICMPs ignored 541
> # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0

Expected output for ipv6 version:
> # ./icmps-discard_ipv6
> 1..3
> # 3186[lib/setup.c:166] rand seed 1642623803
> TAP version 13
> # 3186[lib/proc.c:207] Snmp6 Ip6InReceives: 4 => 568
> # 3186[lib/proc.c:207] Snmp6 Ip6InDelivers: 3 => 564
> # 3186[lib/proc.c:207] Snmp6 Ip6OutRequests: 2 => 204
> # 3186[lib/proc.c:207] Snmp6 Ip6InMcastPkts: 1 => 4
> # 3186[lib/proc.c:207] Snmp6 Ip6OutMcastPkts: 0 => 1
> # 3186[lib/proc.c:207] Snmp6 Ip6InOctets: 320 => 70420
> # 3186[lib/proc.c:207] Snmp6 Ip6OutOctets: 160 => 35512
> # 3186[lib/proc.c:207] Snmp6 Ip6InMcastOctets: 72 => 336
> # 3186[lib/proc.c:207] Snmp6 Ip6OutMcastOctets: 0 => 76
> # 3186[lib/proc.c:207] Snmp6 Ip6InNoECTPkts: 4 => 568
> # 3186[lib/proc.c:207] Snmp6 Icmp6InMsgs: 1 => 361
> # 3186[lib/proc.c:207] Snmp6 Icmp6OutMsgs: 1 => 2
> # 3186[lib/proc.c:207] Snmp6 Icmp6InDestUnreachs: 0 => 360
> # 3186[lib/proc.c:207] Snmp6 Icmp6OutMLDv2Reports: 0 => 1
> # 3186[lib/proc.c:207] Snmp6 Icmp6InType1: 0 => 360
> # 3186[lib/proc.c:207] Snmp6 Icmp6OutType143: 0 => 1
> # 3186[lib/proc.c:207] Tcp InSegs: 2 => 203
> # 3186[lib/proc.c:207] Tcp OutSegs: 1 => 202
> # 3186[lib/proc.c:207] TcpExt TCPPureAcks: 1 => 2
> # 3186[lib/proc.c:207] TcpExt TCPOrigDataSent: 0 => 200
> # 3186[lib/proc.c:207] TcpExt TCPDelivered: 0 => 199
> # 3186[lib/proc.c:207] TcpExt TCPAOGood: 2 => 203
> # 3186[lib/proc.c:207] TcpExt TCPAODroppedIcmps: 0 => 360
> ok 1 Icmp6InDestUnreachs delivered 360
> ok 2 Server survived 20000 bytes of traffic
> ok 3 ICMPs ignored 360
> # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

show more ...