Skip to content

Commit

Permalink
Merge pull request #962 from arthur-zhang/dev-pr-bridge
Browse files Browse the repository at this point in the history
bridge: remove useless code
  • Loading branch information
squeed authored Nov 13, 2023
2 parents 2eee7ce + 5280b4d commit e82848a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions plugins/main/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func calcGateways(result *current.Result, n *NetConf) (*gwInfo, *gwInfo, error)

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

if n.IsGW {
var firstV4Addr net.IP
var vlanInterface *current.Interface
// Set the IP address(es) on the bridge and enable forwarding
for _, gws := range []*gwInfo{gwsV4, gwsV6} {
for _, gw := range gws.gws {
if gw.IP.To4() != nil && firstV4Addr == nil {
firstV4Addr = gw.IP
}
if n.Vlan != 0 {
vlanIface, err := ensureVlanInterface(br, n.Vlan, n.PreserveDefaultVlan)
if err != nil {
Expand Down Expand Up @@ -733,7 +729,7 @@ func cmdAdd(args *skel.CmdArgs) error {
}

// Use incoming DNS settings if provided, otherwise use the
// settings that were already configued by the IPAM plugin
// settings that were already configured by the IPAM plugin
if dnsConfSet(n.DNS) {
result.DNS = n.DNS
}
Expand Down

0 comments on commit e82848a

Please sign in to comment.