mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-25 20:54:36 +00:00
dm: remove "acrn_" prefix from tap name
Some projects based on ACRN don't want tap name to contain "acrn_" prefix. This patch removes that prefix. Tracked-On: #2509 Signed-off-by: Jie Deng <jie.deng@intel.com> Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
parent
3d0992c7bd
commit
00dd26b081
@ -674,7 +674,7 @@ virtio_net_tap_setup(struct virtio_net *net, char *devname)
|
|||||||
int vhost_fd = -1;
|
int vhost_fd = -1;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = snprintf(tbuf, IFNAMSIZ, "acrn_%s", devname);
|
rc = snprintf(tbuf, IFNAMSIZ, "%s", devname);
|
||||||
if (rc < 0 || rc >= IFNAMSIZ) /* give warning if error or truncation happens */
|
if (rc < 0 || rc >= IFNAMSIZ) /* give warning if error or truncation happens */
|
||||||
WPRINTF(("Fail to set tap device name %s\n", tbuf));
|
WPRINTF(("Fail to set tap device name %s\n", tbuf));
|
||||||
|
|
||||||
|
@ -57,20 +57,20 @@ mac_seed=${mac:9:8}-${vm_name}
|
|||||||
|
|
||||||
# create a unique tap device for each VM
|
# create a unique tap device for each VM
|
||||||
tap=tap_$6
|
tap=tap_$6
|
||||||
tap_exist=$(ip a | grep acrn_"$tap" | awk '{print $1}')
|
tap_exist=$(ip a | grep "$tap" | awk '{print $1}')
|
||||||
if [ "$tap_exist"x != "x" ]; then
|
if [ "$tap_exist"x != "x" ]; then
|
||||||
echo "tap device existed, reuse acrn_$tap"
|
echo "tap device existed, reuse $tap"
|
||||||
else
|
else
|
||||||
ip tuntap add dev acrn_$tap mode tap
|
ip tuntap add dev $tap mode tap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if acrn-br0 exists, add VM's unique tap device under it
|
# if acrn-br0 exists, add VM's unique tap device under it
|
||||||
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
||||||
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
||||||
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
||||||
ip link set acrn_"$tap" master acrn-br0
|
ip link set "$tap" master acrn-br0
|
||||||
ip link set dev acrn_"$tap" down
|
ip link set dev "$tap" down
|
||||||
ip link set dev acrn_"$tap" up
|
ip link set dev "$tap" up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#check if the vm is running or not
|
#check if the vm is running or not
|
||||||
@ -196,20 +196,20 @@ mac_seed=${mac:9:8}-${vm_name}
|
|||||||
|
|
||||||
# create a unique tap device for each VM
|
# create a unique tap device for each VM
|
||||||
tap=tap_$6
|
tap=tap_$6
|
||||||
tap_exist=$(ip a | grep acrn_"$tap" | awk '{print $1}')
|
tap_exist=$(ip a | grep "$tap" | awk '{print $1}')
|
||||||
if [ "$tap_exist"x != "x" ]; then
|
if [ "$tap_exist"x != "x" ]; then
|
||||||
echo "tap device existed, reuse acrn_$tap"
|
echo "tap device existed, reuse $tap"
|
||||||
else
|
else
|
||||||
ip tuntap add dev acrn_$tap mode tap
|
ip tuntap add dev $tap mode tap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if acrn-br0 exists, add VM's unique tap device under it
|
# if acrn-br0 exists, add VM's unique tap device under it
|
||||||
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
||||||
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
||||||
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
||||||
ip link set acrn_"$tap" master acrn-br0
|
ip link set "$tap" master acrn-br0
|
||||||
ip link set dev acrn_"$tap" down
|
ip link set dev "$tap" down
|
||||||
ip link set dev acrn_"$tap" up
|
ip link set dev "$tap" up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Use MMC name + serial for ADB serial no., same as native android
|
#Use MMC name + serial for ADB serial no., same as native android
|
||||||
|
@ -46,20 +46,20 @@ mac_seed=${mac:9:8}-${vm_name}
|
|||||||
|
|
||||||
# create a unique tap device for each VM
|
# create a unique tap device for each VM
|
||||||
tap=tap_$6
|
tap=tap_$6
|
||||||
tap_exist=$(ip a | grep acrn_"$tap" | awk '{print $1}')
|
tap_exist=$(ip a | grep "$tap" | awk '{print $1}')
|
||||||
if [ "$tap_exist"x != "x" ]; then
|
if [ "$tap_exist"x != "x" ]; then
|
||||||
echo "tap device existed, reuse acrn_$tap"
|
echo "tap device existed, reuse $tap"
|
||||||
else
|
else
|
||||||
ip tuntap add dev acrn_$tap mode tap
|
ip tuntap add dev $tap mode tap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if acrn-br0 exists, add VM's unique tap device under it
|
# if acrn-br0 exists, add VM's unique tap device under it
|
||||||
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
||||||
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
||||||
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
||||||
ip link set acrn_"$tap" master acrn-br0
|
ip link set "$tap" master acrn-br0
|
||||||
ip link set dev acrn_"$tap" down
|
ip link set dev "$tap" down
|
||||||
ip link set dev acrn_"$tap" up
|
ip link set dev "$tap" up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#check if the vm is running or not
|
#check if the vm is running or not
|
||||||
@ -182,20 +182,20 @@ mac_seed=${mac:9:8}-${vm_name}
|
|||||||
|
|
||||||
# create a unique tap device for each VM
|
# create a unique tap device for each VM
|
||||||
tap=tap_$6
|
tap=tap_$6
|
||||||
tap_exist=$(ip a | grep acrn_"$tap" | awk '{print $1}')
|
tap_exist=$(ip a | grep "$tap" | awk '{print $1}')
|
||||||
if [ "$tap_exist"x != "x" ]; then
|
if [ "$tap_exist"x != "x" ]; then
|
||||||
echo "tap device existed, reuse acrn_$tap"
|
echo "tap device existed, reuse $tap"
|
||||||
else
|
else
|
||||||
ip tuntap add dev acrn_$tap mode tap
|
ip tuntap add dev $tap mode tap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if acrn-br0 exists, add VM's unique tap device under it
|
# if acrn-br0 exists, add VM's unique tap device under it
|
||||||
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
||||||
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
||||||
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
||||||
ip link set acrn_"$tap" master acrn-br0
|
ip link set "$tap" master acrn-br0
|
||||||
ip link set dev acrn_"$tap" down
|
ip link set dev "$tap" down
|
||||||
ip link set dev acrn_"$tap" up
|
ip link set dev "$tap" up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Use MMC name + serial for ADB serial no., same as native android
|
#Use MMC name + serial for ADB serial no., same as native android
|
||||||
|
@ -15,20 +15,20 @@ fi
|
|||||||
|
|
||||||
# create a unique tap device for each VM
|
# create a unique tap device for each VM
|
||||||
tap=tap_AaaG
|
tap=tap_AaaG
|
||||||
tap_exist=$(ip a | grep acrn_"$tap" | awk '{print $1}')
|
tap_exist=$(ip a | grep "$tap" | awk '{print $1}')
|
||||||
if [ "$tap_exist"x != "x" ]; then
|
if [ "$tap_exist"x != "x" ]; then
|
||||||
echo "tap device existed, reuse acrn_$tap"
|
echo "tap device existed, reuse $tap"
|
||||||
else
|
else
|
||||||
ip tuntap add dev acrn_$tap mode tap
|
ip tuntap add dev $tap mode tap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if acrn-br0 exists, add VM's unique tap device under it
|
# if acrn-br0 exists, add VM's unique tap device under it
|
||||||
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
||||||
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
||||||
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
||||||
ip link set acrn_"$tap" master acrn-br0
|
ip link set "$tap" master acrn-br0
|
||||||
ip link set dev acrn_"$tap" down
|
ip link set dev "$tap" down
|
||||||
ip link set dev acrn_"$tap" up
|
ip link set dev "$tap" up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
modprobe pci_stub
|
modprobe pci_stub
|
||||||
|
@ -5,12 +5,12 @@ SYSTEMD_NETWORKDIR := usr/lib
|
|||||||
all:
|
all:
|
||||||
cp acrn.netdev $(OUT_DIR)
|
cp acrn.netdev $(OUT_DIR)
|
||||||
cp acrn.network $(OUT_DIR)
|
cp acrn.network $(OUT_DIR)
|
||||||
cp acrn_tap0.netdev $(OUT_DIR)
|
cp tap0.netdev $(OUT_DIR)
|
||||||
cp eth.network $(OUT_DIR)
|
cp eth.network $(OUT_DIR)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -d $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network
|
install -d $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network
|
||||||
install -p -D -m 0644 $(OUT_DIR)/acrn.netdev $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network/50-acrn.netdev
|
install -p -D -m 0644 $(OUT_DIR)/acrn.netdev $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network/50-acrn.netdev
|
||||||
install -p -D -m 0644 $(OUT_DIR)/acrn.network $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network/50-acrn.network
|
install -p -D -m 0644 $(OUT_DIR)/acrn.network $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network/50-acrn.network
|
||||||
install -p -D -m 0644 $(OUT_DIR)/acrn_tap0.netdev $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network/50-acrn_tap0.netdev
|
install -p -D -m 0644 $(OUT_DIR)/tap0.netdev $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network/50-tap0.netdev
|
||||||
install -p -D -m 0644 $(OUT_DIR)/eth.network $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network/50-eth.network
|
install -p -D -m 0644 $(OUT_DIR)/eth.network $(DESTDIR)/$(SYSTEMD_NETWORKDIR)/systemd/network/50-eth.network
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[Match]
|
[Match]
|
||||||
Name=e* acrn_tap*
|
Name=e* acrn_tap* tap*
|
||||||
|
|
||||||
[Network]
|
[Network]
|
||||||
Bridge=acrn-br0
|
Bridge=acrn-br0
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
[NetDev]
|
[NetDev]
|
||||||
Name=acrn_tap0
|
Name=tap0
|
||||||
Kind=tap
|
Kind=tap
|
Loading…
Reference in New Issue
Block a user