Skip to content

Commit

Permalink
test-dhcp: remove deprecated ifconfig/brctl commands
Browse files Browse the repository at this point in the history
These commands are deprecated for a long time, but it seems in our new
CI images ifconfig is missing so migrate to the new ip command instead.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
  • Loading branch information
Luap99 committed Nov 19, 2024
1 parent 55a0f25 commit 71d8a5a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions test-dhcp/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -281,25 +281,24 @@ function basic_setup() {
}

#
# add_bridge br0
# add_bridge <name>
#
function add_bridge() {
local bridge_name="$1"
br_cidr=$(gateway_from_subnet "$SUBNET_CIDR")
run_in_container_netns brctl addbr $bridge_name
run_in_container_netns ifconfig $bridge_name $br_cidr up
run_in_container_netns firewall-cmd --add-interface=$bridge_name --zone=trusted
run_in_container_netns ip link add $bridge_name type bridge
run_in_container_netns ip addr add $br_cidr dev $bridge_name
run_in_container_netns ip link set $bridge_name up
}

#
# remove_bridge br0
# remove_bridge <name>
#
function remove_bridge() {
local bridge_name="$1"
run_in_container_netns firewall-cmd --remove-interface="$bridge_name" --zone=trusted
run_in_container_netns ip link set "$bridge_name" down
# shellcheck disable=SC2086
run_in_container_netns brctl delbr $bridge_name
run_in_container_netns ip link del $bridge_name
}

#
Expand All @@ -310,10 +309,7 @@ function remove_veth() {
local bridge_name="$2"
local veth_br_name="${veth_name}br"

run_in_container_netns ip link set "$veth_br_name" down
run_in_container_netns ip link set "$veth_name" down
run_in_container_netns brctl delif "$bridge_name" "$veth_br_name"
run_in_container_netns ip link del "$veth_br_name" type veth peer name "$veth_name"
run_in_container_netns ip link del "$veth_br_name"
}

#
Expand All @@ -324,7 +320,7 @@ function add_veth() {
local bridge_name="$2"
local veth_br_name="${veth_name}br"
run_in_container_netns ip link add "$veth_br_name" type veth peer name "$veth_name"
run_in_container_netns brctl addif "$bridge_name" "$veth_br_name"
run_in_container_netns ip link set "$veth_br_name" master "$bridge_name"
run_in_container_netns ip link set "$veth_br_name" up
run_in_container_netns ip link set "$veth_name" up
}
Expand Down

0 comments on commit 71d8a5a

Please sign in to comment.