Skip to content

Commit e82848a

Browse files
authored
Merge pull request #962 from arthur-zhang/dev-pr-bridge
bridge: remove useless code
2 parents 2eee7ce + 5280b4d commit e82848a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

plugins/main/bridge/bridge.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func calcGateways(result *current.Result, n *NetConf) (*gwInfo, *gwInfo, error)
240240

241241
// Add a default route for this family using the current
242242
// gateway address if necessary.
243-
if n.IsDefaultGW && !gws.defaultRouteFound {
243+
if n.IsDefaultGW {
244244
for _, route := range result.Routes {
245245
if route.GW != nil && defaultNet.String() == route.Dst.String() {
246246
gws.defaultRouteFound = true
@@ -629,14 +629,10 @@ func cmdAdd(args *skel.CmdArgs) error {
629629
}
630630

631631
if n.IsGW {
632-
var firstV4Addr net.IP
633632
var vlanInterface *current.Interface
634633
// Set the IP address(es) on the bridge and enable forwarding
635634
for _, gws := range []*gwInfo{gwsV4, gwsV6} {
636635
for _, gw := range gws.gws {
637-
if gw.IP.To4() != nil && firstV4Addr == nil {
638-
firstV4Addr = gw.IP
639-
}
640636
if n.Vlan != 0 {
641637
vlanIface, err := ensureVlanInterface(br, n.Vlan, n.PreserveDefaultVlan)
642638
if err != nil {
@@ -733,7 +729,7 @@ func cmdAdd(args *skel.CmdArgs) error {
733729
}
734730

735731
// Use incoming DNS settings if provided, otherwise use the
736-
// settings that were already configued by the IPAM plugin
732+
// settings that were already configured by the IPAM plugin
737733
if dnsConfSet(n.DNS) {
738734
result.DNS = n.DNS
739735
}

0 commit comments

Comments
 (0)