LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   [Suggestion] How to add parameters to wpa_supplicant and dhcpcd in rc.inet1.conf (https://www.linuxquestions.org/questions/slackware-14/%5Bsuggestion%5D-how-to-add-parameters-to-wpa_supplicant-and-dhcpcd-in-rc-inet1-conf-4175472037/)

guanx 08-04-2013 01:09 AM

[Suggestion] How to add parameters to wpa_supplicant and dhcpcd in rc.inet1.conf
 
Today when I was setting up a bonding interface, I put the followings in "/etc/rc.d/rc.netdevice":
Code:

#! /bin/sh
modprobe bonding mode=active-backup miimon=100 downdelay=200 updelay=200 primary=eth0
ifconfig bond0 up
ifenslave bond0 eth0
ifenslave bond0 wlan0

and these in "/etc/rc.d/rc.inet1.conf":
Code:

# Config information for eth0:
IFNAME[0]="wlan0"
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="no"
WLAN_MODE[0]=Managed
WLAN_WPA[0]="wpa_supplicant"
WLAN_WPACONF[0]="/etc/wpa_supplicant.conf -b bond0"
WLAN_WPADRIVER[0]="wext"
WLAN_WPAWAIT[0]=10

# Config information for eth1:
IFNAME[1]="bond0"
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]="yes"
DHCP_HOSTNAME[1]=""

It works as expected but my workaround to add the "-b" parameter to wpa_supplicant is certainly ulgy. Is there an elegant way of adding extra parameters to wpa_supplicant in "rc.inet1.conf"?

Similarly, I find it difficult to add options (such as --nolink) to dhcpcd.

guanx 08-04-2013 11:33 AM

I've made these changes to rc.wireless and rc.inet1 for adding options to wpa_supplicant and dhcpcd. Hope these doesn't hurt.
Code:

--- rc.wireless 2013-08-04 12:28:09.420596206 -0400
+++ rc.wireless.new    2013-08-04 12:28:27.072548445 -0400
@@ -175,6 +175,7 @@
 # The default config file as installed by the wpa_supplicant package:
 WPACONF=${WLAN_WPACONF[$i]:-${WPACONF:="/etc/wpa_supplicant.conf"}}
 WPAWAIT=${WLAN_WPAWAIT[$i]:-${WPAWAIT:="60"}}
+WPA_OPTIONS=${WLAN_WPAOPTIONS[$i]:-${WPAOPTIONS}}
 
 
 [ -n "$VERBOSE" -a -n "$INFO" ] && echo "$0:  $1 information: '$INFO'"
@@ -289,8 +290,7 @@
        # Interface down, so wpa_supplicant can associate with the AP
        $IFCOMMAND down
        #WPACONF=${WPACONF:-/etc/wpa_supplicant.conf}
-      WPA_OPTIONS=""
-      [ ${WPADRIVER} ] && WPA_OPTIONS="-D${WPADRIVER}" # specify the driver
+      [ ${WPADRIVER} ] && WPA_OPTIONS="${WPA_OPTIONS} -D${WPADRIVER}" # specify the driver
        [ ${WPA} = "wpaxsupplicant" ] && WPA_OPTIONS="${WPA_OPTIONS} -e" # Use external xsupplicant (disables the internal supplicant)
 
        # We leave a running wpa_supplicant process in peace:

Code:

--- rc.inet1    2013-08-04 12:28:05.914399737 -0400
+++ rc.inet1.new        2013-08-04 12:28:18.687103653 -0400
@@ -131,7 +131,7 @@
      fi
      if [ "${USE_DHCP[$i]}" = "yes" ]; then # use DHCP to bring interface up
        # Clear DHCP_OPTIONS before adding new options to it:
-        unset DHCP_OPTIONS
+        DHCP_OPTIONS="${DHCP_OPTIONS[$i]}"
        # Set DHCP_OPTIONS for this interface:
        [ ${DHCP_HOSTNAME[$i]} ] && DHCP_OPTIONS="-h ${DHCP_HOSTNAME[$i]}"
        [ "${DHCP_KEEPRESOLV[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -C resolv.conf"



All times are GMT -5. The time now is 09:26 AM.