[kexec-tools] add vlan support

Dave Young yangrr at fedoraproject.org
Mon Jun 11 06:06:42 UTC 2012


commit e720fcdadf68b1b8c1d2f01b9354f54031697a3e
Author: Cong Wang <amwang at redhat.com>
Date:   Sun Jun 10 18:24:36 2012 +0800

    add vlan support
    
    This patch depends on the latest dracut in git.
    It adds support of dumping over a vlan device.
    
    Cc: Vivek Goyal <vgoyal at redhat.com>
    Signed-off-by: Cong Wang <amwang at redhat.com>
    Acked-by: Dave Young <dyoung at redhat.com>

 dracut-module-setup.sh |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 0938121..1acefdb 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -39,6 +39,10 @@ kdump_is_bond() {
      [ -d /sys/class/net/"$1"/bonding ]
 }
 
+kdump_is_vlan() {
+     [ -f /proc/net/vlan/"$1" ]
+}
+
 #$1: netdev name
 #checking /etc/sysconfig/network-scripts/ifcfg-$1,
 #if it use static ip echo it, or echo null
@@ -73,6 +77,14 @@ kdump_setup_bond() {
     #echo "bondoptions=\"$bondoptions\"" >> ${initdir}/etc/cmdline.d/42bond.conf
 }
 
+kdump_setup_vlan() {
+    local _netdev=$1
+    local _phydev="$(awk '/^Device:/{print $2}' /proc/net/vlan/"$_netdev")"
+    local _netmac="$(kdump_get_mac_addr $_phydev)"
+    echo -n " ifname=$_phydev:$_netmac" > ${initdir}/etc/cmdline.d/43vlan.conf
+    echo " vlan=$_netdev:$_phydev" >> ${initdir}/etc/cmdline.d/43vlan.conf
+}
+
 # Setup dracut to bringup a given network interface
 kdump_setup_netdev() {
     local _netdev=$1
@@ -92,6 +104,8 @@ kdump_setup_netdev() {
         kdump_setup_bridge "$_netdev"
     elif kdump_is_bond "$_netdev"; then
         kdump_setup_bond "$_netdev"
+    elif kdump_is_vlan "$_netdev"; then
+        kdump_setup_vlan "$_netdev"
     else
         echo -n " ip=${_static}$_netdev:${_proto}" > ${initdir}/etc/cmdline.d/40ip.conf
         echo " ifname=$_netdev:$(kdump_get_mac_addr $_netdev)" >> ${initdir}/etc/cmdline.d/40ip.conf


More information about the scm-commits mailing list