• Dmitry Safonov's avatar
    selftests/net: Add a test for TCP-AO keys matching · ed9d09b3
    Dmitry Safonov authored
    Add TCP-AO tests on connect()/accept() pair.
    SNMP counters exposed by kernel are very useful here to verify the
    expected behavior of TCP-AO.
    
    Expected output for ipv4 version:
    > # ./connect-deny_ipv4
    > 1..19
    > # 1702[lib/setup.c:254] rand seed 1680553689
    > TAP version 13
    > ok 1 Non-AO server + AO client
    > ok 2 Non-AO server + AO client: counter TCPAOKeyNotFound increased 0 => 1
    > ok 3 AO server + Non-AO client
    > ok 4 AO server + Non-AO client: counter TCPAORequired increased 0 => 1
    > ok 5 Wrong password
    > ok 6 Wrong password: counter TCPAOBad increased 0 => 1
    > ok 7 Wrong rcv id
    > ok 8 Wrong rcv id: counter TCPAOKeyNotFound increased 1 => 2
    > ok 9 Wrong snd id
    > ok 10 Wrong snd id: counter TCPAOGood increased 0 => 1
    > ok 11 Server: Wrong addr: counter TCPAOKeyNotFound increased 2 => 3
    > ok 12 Server: Wrong addr
    > ok 13 Client: Wrong addr: connect() was prevented
    > ok 14 rcv id != snd id: connected
    > ok 15 rcv id != snd id: counter TCPAOGood increased 1 => 3
    > ok 16 Server: prefix match: connected
    > ok 17 Server: prefix match: counter TCPAOGood increased 4 => 6
    > ok 18 Client: prefix match: connected
    > ok 19 Client: prefix match: counter TCPAOGood increased 7 => 9
    > # Totals: pass:19 fail:0 xfail:0 xpass:0 skip:0 error:0
    
    Expected output for ipv6 version:
    > # ./connect-deny_ipv6
    > 1..19
    > # 1725[lib/setup.c:254] rand seed 1680553711
    > TAP version 13
    > ok 1 Non-AO server + AO client
    > ok 2 Non-AO server + AO client: counter TCPAOKeyNotFound increased 0 => 1
    > ok 3 AO server + Non-AO client: counter TCPAORequired increased 0 => 1
    > ok 4 AO server + Non-AO client
    > ok 5 Wrong password: counter TCPAOBad increased 0 => 1
    > ok 6 Wrong password
    > ok 7 Wrong rcv id: counter TCPAOKeyNotFound increased 1 => 2
    > ok 8 Wrong rcv id
    > ok 9 Wrong snd id: counter TCPAOGood increased 0 => 1
    > ok 10 Wrong snd id
    > ok 11 Server: Wrong addr
    > ok 12 Server: Wrong addr: counter TCPAOKeyNotFound increased 2 => 3
    > ok 13 Client: Wrong addr: connect() was prevented
    > ok 14 rcv id != snd id: connected
    > ok 15 rcv id != snd id: counter TCPAOGood increased 1 => 3
    > ok 16 Server: prefix match: connected
    > ok 17 Server: prefix match: counter TCPAOGood increased 5 => 7
    > ok 18 Client: prefix match: connected
    > ok 19 Client: prefix match: counter TCPAOGood increased 8 => 10
    > # Totals: pass:19 fail:0 xfail:0 xpass:0 skip:0 error:0
    Signed-off-by: default avatarDmitry Safonov <dima@arista.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ed9d09b3
connect-deny.c 7.78 KB