Skip to content

Commit

Permalink
Splitted bridge port configuration updating code
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Jun 20, 2014
1 parent 3d22cd0 commit 03b9025
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/include/network/lan/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ def InitBridge(key)
nil
end

def configure_as_bridge_port(device)
log.info("Adapt device #{device} as bridge port")

NetworkInterfaces.Edit(device)
NetworkInterfaces.Current["IPADDR"] = ""
NetworkInterfaces.Current["NETMASK"] = ""
NetworkInterfaces.Current["BOOTPROTO"] = "none"
NetworkInterfaces.Commit
NetworkInterfaces.Add
end

def ValidateBridge(key, event)
old_name = NetworkInterfaces.Name
valid = true
Expand Down Expand Up @@ -86,12 +97,7 @@ def ValidateBridge(key, event)

when "bond"
if LanItems.operation == :add
NetworkInterfaces.Edit(device)
NetworkInterfaces.Current["IPADDR"] = ""
NetworkInterfaces.Current["NETMASK"] = ""
NetworkInterfaces.Current["BOOTPROTO"] = "none"
NetworkInterfaces.Commit
NetworkInterfaces.Add
configure_as_bridge_port(device)
end
next
end
Expand All @@ -112,13 +118,7 @@ def ValidateBridge(key, event)
if valid
i = LanItems.current
if LanItems.FindAndSelect(device)
log.info("Adapt device #{device} for bridge (0.0.0.0/32)")
NetworkInterfaces.Edit(device)
NetworkInterfaces.Current["IPADDR"] = ""
NetworkInterfaces.Current["PREFIXLEN"] = ""
NetworkInterfaces.Current["BOOTPROTO"] = "none"
NetworkInterfaces.Commit
NetworkInterfaces.Add
configure_as_bridge_port(device)
LanItems.current = i
end
end
Expand Down

0 comments on commit 03b9025

Please sign in to comment.