diff --git a/postplug.d/20network b/postplug.d/20network index 237ef55..22be5ea 100644 --- a/postplug.d/20network +++ b/postplug.d/20network @@ -15,9 +15,6 @@ me="network" . /etc/postplug/postplug.defs -postplugnew_file=$postplugnewdir/network -rm -f $postplugnew_file - [ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug [ -r /etc/sysconfig/rc ] && . /etc/sysconfig/rc @@ -66,7 +63,7 @@ function cdc_usb() { ifconfig usb0 &>/dev/null && { [ "$NETWORK_CDC_NETMASK" ] && CDC_NETMASK=$NETWORK_CDC_NETMASK - [ -e $network_devices/ifcng-usb0 ] || { + [ -e $network_devices/ifcfg-usb0 ] || { [ "$NETWORK_CDC_IPADDR" ] && CDC_IPADDR=$NETWORK_CDC_IPADDR cat > $network_devices/ifcfg-usb0 << _EOF DEVICE=usb0 @@ -144,62 +141,72 @@ _EOF [ "$NETWORK_CDC_DISABLE" = "1" ] || cdc_usb [ "$NETWORK_ANDROID_DISABLE" = "1" ] || android_usb -wlan_ints=() -for wlan_int in $(cat /proc/net/wireless 2>/dev/null | sed -n '/[a-z]*[0-9]*:/{s,:.*,,;p}'); do - # checks for existing physical interfaces - /sbin/ifconfig $wlan_int >/dev/null 2>&1 || continue - +# Disable p2p interface managed by NetworkManager +for net_int in $(cat /proc/net/dev | sed -n '/p2p[0-9]*:/{s,:.*,,;p}'); do # found interface already configured - [ -e $network_devices/ifcfg-$wlan_int ] && continue + [ -e $network_devices/ifcfg-${net_int} ] && continue - wlan_ints[${#wlan_ints[*]}]="$wlan_int" - echo "$wlan_int" >> $postplugnew_file 2>/dev/null + if [ "${net_int:0:3}" = "p2p" ]; then + P2P_HWADDR=`ifconfig $net_int | grep HWaddr | sed "s|.* HWaddr ||"` + cat > $network_devices/ifcfg-${net_int} << _EOF +DEVICE=$net_int +HWADDR=$P2P_HWADDR +ONBOOT=no +NM_CONTROLLED=no +_EOF + fi done -eth_ints=() -for eth_int in $(cat /proc/net/dev | sed -n '/eth[0-9]*:/{s,:.*,,;p}'); do - # checks for existing physical interfaces - /sbin/ifconfig $eth_int >/dev/null 2>&1 || continue +# INFO: the following code is going obsolete +if [ "$NETWORK_NEWDEVICE" -a "$NETWORK_NEWDEVICE" != "off" ]; then - # found interface already configured - [ -e $network_devices/ifcfg-$eth_int ] && continue + wlan_ints=() + for wlan_int in $(cat /proc/net/wireless 2>/dev/null | sed -n '/[a-z]*[0-9]*:/{s,:.*,,;p}'); do + # found interface already configured + [ -e $network_devices/ifcfg-$wlan_int ] && continue + wlan_ints[${#wlan_ints[*]}]="$wlan_int" + done - eth_ints[${#eth_ints[*]}]="$eth_int" - echo "$eth_int" >> $postplugnew_file 2>/dev/null -done + eth_ints=() + for eth_int in $(cat /proc/net/dev | sed -n '/eth[0-9]*:/{s,:.*,,;p}'); do + # found interface already configured + [ -e $network_devices/ifcfg-$eth_int ] && continue + eth_ints[${#eth_ints[*]}]="$eth_int" + done -# how many interface have been configured? -let "int_newconf = 0" + # how many interface have been configured? + let "int_newconf = 0" -if [ ${#eth_ints[*]} -gt 0 ]; then - case "$NETWORK_NEWDEVICE" in - "auto") - for eth_int in ${eth_ints[*]}; do - eth_config_auto $eth_int - let "int_newconf += 1" - done - exit - ;; - "off"|"") - exit - ;; - *) logmsg "$me" "error: "$"\ + if [ ${#eth_ints[*]} -gt 0 ]; then + case "$NETWORK_NEWDEVICE" in + "auto") + for eth_int in ${eth_ints[*]}; do + eth_config_auto $eth_int + let "int_newconf += 1" + done + exit + ;; + "off"|"") + exit + ;; + *) logmsg "$me" "error: "$"\ illegal value for NETWORK_NEWDEVICE ($NETWORK_NEWDEVICE)" - exit 1 - ;; - esac -fi + exit 1 + ;; + esac + fi -if [ ${#wlan_ints[*]} -gt 0 ]; then - case "$NETWORK_NEWDEVICE" in - "auto") - for wlan_int in ${wlan_ints[*]}; do - wlan_config_auto $wlan_int - let "int_newconf += 1" - done - exit - ;; - esac + if [ ${#wlan_ints[*]} -gt 0 ]; then + case "$NETWORK_NEWDEVICE" in + "auto") + for wlan_int in ${wlan_ints[*]}; do + wlan_config_auto $wlan_int + let "int_newconf += 1" + done + exit + ;; + esac + fi fi exit 0