@@ -418,18 +418,19 @@ func (client *TransparentVlanEndpointClient) AddEndpointRules(epInfo *EndpointIn
418418 }
419419 logger .Info ("[transparent-vlan] Adding tunneling rules in vnet namespace" )
420420 err := ExecuteInNS (client .nsClient , client .vnetNSName , func () error {
421- return client .AddVnetRules (epInfo )
422- })
423- if err == nil {
424- logger .Info ("calling setArpProxy for" , zap .String ("vlanIfName" , client .vlanIfName ))
425- if err := client .setArpProxy (client .vlanIfName ); err != nil {
426- logger .Error ("setArpProxy failed with" , zap .Error (err ))
421+ if err := client .AddVnetRules (epInfo ); err != nil {
427422 return err
428423 }
429- if err != nil {
430- logger .Error ("setArpProxy failed for VLAN interface" , zap .Error (err ))
424+
425+ // Set ARP proxy on vnet veth (inside vnet namespace)
426+ logger .Info ("calling setArpProxy for" , zap .String ("vnetVethName" , client .vnetVethName ))
427+ if err := client .setArpProxy (client .vnetVethName ); err != nil {
428+ logger .Error ("setArpProxy failed with" , zap .Error (err ))
429+ return err
431430 }
432- }
431+
432+ return nil
433+ })
433434
434435 return err
435436}
@@ -544,7 +545,7 @@ func (client *TransparentVlanEndpointClient) ConfigureContainerInterfacesAndRout
544545
545546 if epInfo .SkipDefaultRoutes {
546547 logger .Info ("Skipping adding default routes in container ns as requested" )
547- if err := client .addCustomRoutes (client .containerVethName , epInfo .Subnets [0 ].Gateway , epInfo .IPAddresses [0 ]); err != nil {
548+ if err := client .addCustomRoutes (client .containerVethName , epInfo .Subnets [0 ].Gateway , epInfo .Subnets [0 ]. Prefix , 0 ); err != nil {
548549 return errors .Wrap (err , "failed container ns add custom routes" )
549550 }
550551 return nil
@@ -665,8 +666,8 @@ func (client *TransparentVlanEndpointClient) addCustomRoutes(linkToName string,
665666 }
666667
667668 // Add subnet route (ip route add <subnetCIDR> via <gatewayIP> dev <linkToName>)
668- _ , subnetIPNet , _ := net .ParseCIDR (subnetCIDR .String ())
669- dstIP := net.IPNet {IP : net . ParseIP ( defaultGw ) , Mask : subnetIPNet .Mask }
669+ subnetPrefix , subnetIPNet , _ := net .ParseCIDR (subnetCIDR .String ())
670+ dstIP := net.IPNet {IP : subnetPrefix , Mask : subnetIPNet .Mask }
670671 routeInfo = RouteInfo {
671672 Dst : dstIP ,
672673 Gw : gWIP ,
0 commit comments