Sync IPv4 and IPv6 addresses from VPP to LCP

There are three ways in which IP addresses will want to be copied
from VPP into the companion Linux devices:

1) set interface ip address ... adds an IPv4 or IPv6 address
  - this is handled by lcp_itf_ip[46]_add_del_interface_addr() which
    is a callback installed in lcp_itf_pair_init()
2) set interface ip address del ... removes them
  - also handled by lcp_itf_ip[46]_add_del_interface_addr() but
    curiously there is no upstream vnet_netlink_del_ip[46]_addr() so
    I wrote them inline here - I will try to get them upstreamed, as
    they appear to be obvious companions in vnet/device/netlink.h
3) Upon LIP creation, it could be that there are L3 addresses already
   on the VPP interface. If so, set them with lcp_itf_set_interface_addr()

This means that now, at any time a new LIP is created, its state from
VPP is fully copied over (MTU, Link state, IPv4/IPv6 addresses)!

At runtime, new addresses can be set/removed as well.
This commit is contained in:
Pim van Pelt
2021-08-13 16:50:32 +02:00
parent 39bfa1615f
commit f7e1bb951d
4 changed files with 265 additions and 4 deletions

@ -28,6 +28,7 @@ add_vpp_library(lcpng
SOURCES
lcpng_interface.c
lcpng_adj.c
lcpng_if_sync.c
lcpng.c
LINK_LIBRARIES
@ -44,7 +45,6 @@ add_vpp_plugin(lcpng_if
lcpng_if_api.c
lcpng_if_cli.c
lcpng_if_node.c
lcpng_if_sync.c
API_FILES
lcpng_if.api