Neale Ranns 49378f206b ipsec: IPSec interface correct drop w/ no protection
Type: improvement

When an IPSec interface is first constructed, the end node of the feature arc is not changed, which means it is interface-output.
This means that traffic directed into adjacencies on the link, that do not have protection (w/ an SA), drop like this:

...
00:00:01:111710: ip4-midchain
  tx_sw_if_index 4 dpo-idx 24 : ipv4 via 0.0.0.0 ipsec0: mtu:9000 next:6 flags:[]
  stacked-on:
    [@1]: dpo-drop ip4 flow hash: 0x00000000
  00000000: 4500005c000100003f01cb8cac100202010101010800ecf40000000058585858
  00000020: 58585858585858585858585858585858585858585858585858585858
00:00:01:111829: local0-output
  ipsec0
  00000000: 4500005c000100003f01cb8cac100202010101010800ecf40000000058585858
  00000020: 5858585858585858585858585858585858585858585858585858585858585858
  00000040: 58585858585858585858585858585858585858585858585858585858c2cf08c0
  00000060: 2a2c103cd0126bd8b03c4ec20ce2bd02dd77b3e3a4f49664
00:00:01:112017: error-drop
  rx:pg1
00:00:01:112034: drop
  local0-output: interface is down

although that's a drop, no packets should go to local0, and we want all IPvX packets to go through ipX-drop.

This change sets the interface's end-arc node to the appropriate drop node when the interface is created, and when the last protection is removed.
The resulting drop is:

...
00:00:01:111504: ip4-midchain
  tx_sw_if_index 4 dpo-idx 24 : ipv4 via 0.0.0.0 ipsec0: mtu:9000 next:0 flags:[]
  stacked-on:
    [@1]: dpo-drop ip4 flow hash: 0x00000000
  00000000: 4500005c000100003f01cb8cac100202010101010800ecf40000000058585858
  00000020: 58585858585858585858585858585858585858585858585858585858
00:00:01:111533: ip4-drop
    ICMP: 172.16.2.2 -> 1.1.1.1
      tos 0x00, ttl 63, length 92, checksum 0xcb8c dscp CS0 ecn NON_ECN
      fragment id 0x0001
    ICMP echo_request checksum 0xecf4 id 0
00:00:01:111620: error-drop
  rx:pg1
00:00:01:111640: drop
  null-node: blackholed packets

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: I7e7de23c541d9f1210a05e6984a688f1f821a155
2022-01-17 19:55:13 +00:00
..
2021-05-13 09:33:06 +00:00
2021-04-16 09:26:33 +00:00
2021-04-16 09:26:33 +00:00
2021-11-02 22:32:18 +00:00
2021-04-16 09:26:33 +00:00
2021-04-16 09:26:33 +00:00
2021-09-28 16:06:19 +00:00
2021-05-21 21:06:34 +00:00
2021-11-22 16:44:26 +00:00
2021-11-22 16:44:26 +00:00
2021-09-27 09:54:56 +00:00
2021-07-09 13:50:20 +00:00
2021-10-07 15:34:31 +00:00
2021-10-04 12:16:20 +02:00
2021-01-07 15:48:43 +00:00
2021-10-06 12:32:20 +00:00
2021-11-22 16:44:26 +00:00
2021-05-13 09:33:06 +00:00
2021-11-22 16:44:26 +00:00
2021-11-22 16:44:26 +00:00
2019-12-11 15:23:55 +00:00
2021-05-13 09:33:06 +00:00
2019-03-21 20:33:30 +00:00
2021-02-15 17:27:48 +00:00
2021-05-13 09:33:06 +00:00
2021-02-19 10:48:20 +00:00
2019-07-31 16:17:36 +00:00
2021-05-29 18:13:01 +00:00