Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ethernet 802.1Q VLAN support
- if [ -x /sbin/vconfig -a "${VLAN}" = "yes" -a "$ISALIAS" = "no" ]; then
- VID=""
- MATCH='^(eth|hsi|bond)[0-9]+\.[0-9]{1,4}$'
- if [[ "${DEVICE}" =~ $MATCH ]]; then
- VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^[a-z0-9]*\.0*//')
- PHYSDEV=${DEVICE%.*}
- fi
- if [[ "${DEVICE}" =~ '^vlan[0-9]{1,4}?' ]]; then
- VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//')
- # PHYSDEV should be set in ifcfg-vlan* file
- if test -z "$PHYSDEV"; then
- echo $"PHYSDEV should be set for device ${DEVICE}"
- exit 1
- fi
- fi
- if [ -n "$VID" ]; then
- if [ ! -d /proc/net/vlan ]; then
- if ! modprobe 8021q >/dev/null 2>&1 ; then
- echo $"No 802.1Q VLAN support available in kernel for device ${DEVICE}"
- exit 1
- fi
- fi
- test -z "$VLAN_NAME_TYPE" && VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD
- /sbin/vconfig set_name_type "$VLAN_NAME_TYPE" >/dev/null 2>&1 || {
- echo $"Could not set 802.1Q VLAN parameters."
- }
- is_available ${PHYSDEV} || {
- if [ "$?" = "1" ] ; then
- echo $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
- exit 1
- else
- exit 0
- fi
- }
- # Link on Physical device needs to be up but no ip required
- check_device_down ${PHYSDEV} && {
- ip -o link set dev ${PHYSDEV} up
- }
- if [ ! -f /proc/net/vlan/${DEVICE} ]; then
- /sbin/vconfig add ${PHYSDEV} ${VID} || {
- (/usr/bin/logger -p daemon.info -t ifup \
- $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" &)&
- echo $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}"
- exit 1
- }
- fi
- if [ -f /proc/net/vlan/${DEVICE} ]; then
- case "$REORDER_HDR" in
- yes|1)
- /sbin/vconfig set_flag ${DEVICE} 1 1 || {
- (/usr/bin/logger -p daemon.info -t ifup \
- "WARNING: vconfig not able to enable REORDER_HDR on ${DEVICE}" &)&
- }
- ;;
- no|0)
- /sbin/vconfig set_flag ${DEVICE} 1 0 || {
- (/usr/bin/logger -p daemon.info -t ifup \
- $"WARNING: vconfig not able to disable REORDER_HDR on ${DEVICE}" &)&
- }
- ;;
- esac
- fi
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement