@@ -58,6 +58,7 @@ type networkConfiguration struct {
5858 BridgeName string
5959 EnableIPv6 bool
6060 EnableIPMasquerade bool
61+ NDPProxyInterface string
6162 EnableICC bool
6263 Mtu int
6364 DefaultBindingIP net.IP
@@ -215,6 +216,8 @@ func (c *networkConfiguration) fromLabels(labels map[string]string) error {
215216 if c .EnableIPMasquerade , err = strconv .ParseBool (value ); err != nil {
216217 return parseErr (label , value , err .Error ())
217218 }
219+ case NDPProxyInterface :
220+ c .NDPProxyInterface = value
218221 case EnableICC :
219222 if c .EnableICC , err = strconv .ParseBool (value ); err != nil {
220223 return parseErr (label , value , err .Error ())
@@ -680,6 +683,7 @@ func (d *driver) createNetwork(config *networkConfiguration) error {
680683 bridgeSetup .queueStep (setupBridgeIPv4 )
681684
682685 enableIPv6Forwarding := d .config .EnableIPForwarding && config .AddressIPv6 != nil
686+ enableNDPProxying := config .NDPProxyInterface != "" && config .AddressIPv6 != nil
683687
684688 // Conditionally queue setup steps depending on configuration values.
685689 for _ , step := range []struct {
@@ -699,6 +703,9 @@ func (d *driver) createNetwork(config *networkConfiguration) error {
699703 // Enable IPv6 Forwarding
700704 {enableIPv6Forwarding , setupIPv6Forwarding },
701705
706+ // Enable NDP Proxying
707+ {enableNDPProxying , setupNDPProxying },
708+
702709 // Setup Loopback Adresses Routing
703710 {! d .config .EnableUserlandProxy , setupLoopbackAdressesRouting },
704711
@@ -1019,6 +1026,27 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
10191026 }
10201027 }
10211028
1029+ // Add a neighbor proxy if using NDP proxying
1030+ if config .NDPProxyInterface != "" && config .EnableIPv6 {
1031+ link , err := d .nlh .LinkByName (config .NDPProxyInterface )
1032+ if err != nil {
1033+ return err
1034+ }
1035+ neighbor := netlink.Neigh {
1036+ LinkIndex : link .Attrs ().Index ,
1037+ Family : netlink .FAMILY_V6 ,
1038+ State : netlink .NUD_PERMANENT ,
1039+ Type : netlink .NDA_UNSPEC ,
1040+ Flags : netlink .NTF_PROXY ,
1041+ IP : endpoint .addrv6 .IP ,
1042+ HardwareAddr : endpoint .macAddress ,
1043+ }
1044+ if err := d .nlh .NeighAdd (& neighbor ); err != nil {
1045+ logrus .Warnf ("could not add the neighbor proxy: %v" , err )
1046+ return err
1047+ }
1048+ }
1049+
10221050 if err = d .storeUpdate (endpoint ); err != nil {
10231051 return fmt .Errorf ("failed to save bridge endpoint %s to store: %v" , endpoint .id [0 :7 ], err )
10241052 }
@@ -1077,6 +1105,24 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
10771105 }
10781106 }()
10791107
1108+ // Try removal of neighbor proxy. Discard error: it is a best effort.
1109+ // Also make sure defer does not see this error either.
1110+ if n .config .NDPProxyInterface != "" && n .config .EnableIPv6 {
1111+ link , err := d .nlh .LinkByName (n .config .NDPProxyInterface )
1112+ if err == nil {
1113+ neighbor := netlink.Neigh {
1114+ LinkIndex : link .Attrs ().Index ,
1115+ Family : netlink .FAMILY_V6 ,
1116+ State : netlink .NUD_PERMANENT ,
1117+ Type : netlink .NDA_UNSPEC ,
1118+ Flags : netlink .NTF_PROXY ,
1119+ IP : ep .addrv6 .IP ,
1120+ HardwareAddr : ep .macAddress ,
1121+ }
1122+ d .nlh .NeighDel (& neighbor )
1123+ }
1124+ }
1125+
10801126 // Try removal of link. Discard error: it is a best effort.
10811127 // Also make sure defer does not see this error either.
10821128 if link , err := d .nlh .LinkByName (ep .srcName ); err == nil {
0 commit comments