Page MenuHomeVyOS Platform

VPP: 'delete vpp nat cgnat' leaves the det44 features on the interfaces and all routed traffic through VPP is dropped
In progress, HighPublicBUG

Description

After delete vpp nat cgnat, VPP's det44 tables are empty but det44-in2out / det44-out2in stay on the interfaces' ip4-unicast arc, so every routed packet is dropped as "No translation" until VPP is reconfigured. delete vpp nat nat44 does not have this problem.

Steps:

  1. VPP on eth1 (inside, 10.51.3.9/24) and eth2 (outside, 10.51.4.9/24), a host on each side, routing works.
  2. set vpp nat cgnat interface inside eth1, set vpp nat cgnat interface outside eth2, set vpp nat cgnat rule 100 inside-prefix 10.51.3.0/24, set vpp nat cgnat rule 100 outside-prefix 10.51.4.9/32, commit. Ping inside to outside: 20/20.
  3. delete vpp nat cgnat, commit.
  4. Ping again; check vppctl show errors and show interface features.

Actual (rolling, ~14 s after the commit; the same a minute later):

20 packets transmitted, 0 received, 100% packet loss, time 3946ms
## show det44 interfaces
DET44 interfaces:
## show errors (det44|nat44|translation)
        20            det44-out2in                      No translation             error
## show interface features eth1 (enabled arcs only)
ip4-unicast:   det44-in2out
ip4-unicast:   det44-in2out
## show interface features eth2 (enabled arcs only)
ip4-unicast:   det44-out2in
ip4-unicast:   det44-in2out

Cause: vpp_nat_cgnat.py only calls disable_det44_plugin() on removal, and VPP's det44 plugin (src/plugins/nat/det44/det44.c, same on VPP master) does not clean up: (1) det44_interface_add_del() passes enable=1 to vnet_feature_enable_disable() on delete; (2) det44_plugin_disable() passes the interface flags (1/2) as is_inside, so the outside interface is removed as inside (the extra det44-in2out on eth2); (3) it walks vec_dup() of the interface pool, freed entries included, and logs with unformat_vnet_sw_interface, which crashes VPP.

Suggested fix: disable the feature on delete, pass a boolean is_inside, walk the pool with pool_foreach, log with a format function. With the patched det44_plugin.so on rolling and stock vyos-1x, routing worked after the delete with no det44 feature left; rule changes and re-adding CGNAT still worked.

Details

Version
1.5.1, rolling
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)