WLAN_INTERFACES_DIR not defined in rc.network

Please post any bugs you have found
Post Reply
Message
Author
s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

WLAN_INTERFACES_DIR not defined in rc.network

#1 Post by s243a »

Ignore this post (kept for background only) and go onto my next post


Background on net-setup.sh
I use the network wizard, "net-setup.sh (AKA "Network Wizard")", which is loaded from the gui via the following:
In the puppylinux menu chose:
setup -> Internet Connection Wizard

select "Wired or Wireless Lan" (in this gui)

In the next gui select the last of the three options "Network Wizard"
Both the next GUI, and also this one are defined in net-setup.sh

Now about the bug

Now net-setup.sh (aka "network wizard"), stores the wireless profile information at:

Code: Select all

/etc/network-wizard/wireless/interfaces
but the problem is that this directory location is not used at startup because this directory location is not defined anywhere in

Code: Select all

/etc/rc.d/rc.network
Specifically on line 408 of rc.network we have:

Code: Select all

 if [ -f "${WLAN_INTERFACES_DIR}/$HWADDRESS.conf" ] ; then
but since WLAN_INTERFACES_DIR is not defined in rc.network it means that lines 410 to 650 of rc.d will not be executed at startup.

To verify this claim, I did two grep statements to look for WLAN_INTERFACES_DIR

Code: Select all

root# grep -r -n 'WLAN_INTERFACES_DIR' /usr/sbin
/usr/sbin/net-setup.sh:1778:    if [ ! -s "${WLAN_INTERFACES_DIR}/$HWADDRESS.conf" ] ; then
/usr/sbin/net-setup.sh:1779:      #cp -a /tmp/wireless-config "${WLAN_INTERFACES_DIR}/$HWADDRESS.conf"
/usr/sbin/net-setup.sh:1780:      echo -e "INT_WPA_DRV='$PROFILE_WPA_DRV'\nUSE_WLAN_NG='$USE_WLAN_NG'" > ${WLAN_INTERFACES_DIR}/$HWADDRESS.conf
/usr/sbin/wag-profiles.sh:188:WLAN_INTERFACES_DIR='/etc/network-wizard/wireless/interfaces'
/usr/sbin/wag-profiles.sh:189:[ -d $WLAN_INTERFACES_DIR ] || mkdir -p $WLAN_INTERFACES_DIR
root# 

Code: Select all

root# grep -r -n 'WLAN_INTERFACES_DIR' /etc
/etc/rc.d/rc.network:409:  if [ -f "${WLAN_INTERFACES_DIR}/$HWADDRESS.conf" ] ; then
/etc/rc.d/rc.network:415:    . "${WLAN_INTERFACES_DIR}/$HWADDRESS.conf"
/etc/rc.d/rc.network:650:  fi # if [ -f "${WLAN_INTERFACES_DIR}/$HWADDRESS.conf" ] ; then
root# 
I will do more grep statements later to make sure that this information isn't defined somewhere else at startup.
Last edited by s243a on Wed 12 Oct 2016, 06:54, edited 1 time in total.

User avatar
rerwin
Posts: 2017
Joined: Wed 24 Aug 2005, 22:50
Location: Maine, USA

#2 Post by rerwin »

[Original posting replaced.]
That variable in set in /usr/sbin/wag-profiles.sh, which is "sourced" at line 118:

Code: Select all

. ${APPDIR}/wag-profiles.sh
Richard

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#3 Post by Flash »

S243a, it sometimes helps if you tell us which version of Puppy you're using and maybe something about the hardware.

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#4 Post by s243a »

rerwin wrote:[Original posting replaced.]
That variable in set in /usr/sbin/wag-profiles.sh, which is "sourced" at line 118:

Code: Select all

. ${APPDIR}/wag-profiles.sh
Richard
Thankyou, my mistake. :)

Anyway, I noticed something else

lines 653 to 655 of rc.network.

Code: Select all

  if testInterface ; then
    # sleep a bit, just in case (net-setup.sh has 5 seconds!)
    #sleep 1
    # try and get ip address
    if try_and_connect ; then
      success_message
      exit	# 25feb10
      # move to next interface (to allow more than one)
      GOT_ONE="yes"
      continue
    else
      failure_message
    fi
So the problem here is if the script connects to my wired Ethernet inteface successfully then it will never connect to my wireless interface. However, if I have my wired interface connected to a router then the interface will successfully connect to my router even if my router doesn't have an internet connection.

I'm using a wired interface for a local network and a wireless interface to connect to the internet. I'm going to try to comment out this exit statement and see what it happens.
The exit command terminates a script
http://tldp.org/LDP/abs/html/exit-status.html

edit: So I commented out the line noted above. Now when I run:

Code: Select all

sh -x ./rc.network $>bla2.txt
and examine bal2.txt I see that it is trying to connect to the wireless but it can't see the wireless network, which I'm trying to connect to. However, if I instead go through the network wizard I can see my network, or alternativly if I script the ntwork functions from the command line as noted on the thread:
Turn net-setup.sh into a function library

I can also connect.

I think what I'm going to do is delete a lot of the code in rc.network and instead use the functions in net-setup.sh, since I know net-setup.sh works but rc.network doesn't. I think that rc.network is having the same problems as "simple network setup wizard" in that the drivers that it loads for my hardware D-Link Dual band N600 can't see all the wirless connections that the hardware is capable of.

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#5 Post by s243a »

Flash wrote:S243a, it sometimes helps if you tell us which version of Puppy you're using and maybe something about the hardware.
I'm using tahrpup both 6.0.2 and 6.0.5 PAE version, frugal install.

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#6 Post by s243a »

Okay, I see the issue now.

rc.netwrok doesn't support WPA and/or WPA2 encryption but net-setup.sh does.

In the function useProfile (lines 1244 to 1258 of wag-profiles.sh)

Code: Select all

useProfile ()
{
    case $PROFILE_ENCRYPTION in
        WPA|WPA2)
            useWpaSupplicant wizard || return 1
            ;;
        *)
            if [ "$USE_WLAN_NG" ] ; then
              useWlanctl || return 1
            else
              useIwconfig || return 1
            fi
            ;;     
    esac
} # end useProfile
there is an option for WPA|WPA2 encryption, but this has not been copied into the corresponding start-up script rc.network.

I will modify rc.network and post my solution (probably in another thread).

rc.network only covers the last to cases which are
-- "use wlanctl-ng" see lines 417 to 500 and
--"use iwconfig" see lines 501 to 645

I will modify rc.network to include the WPA case and post my code (probably in a new thread).

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#7 Post by s243a »

The other problem I see is that rc.network loops of physical interfaces but the wireless profiles are based on the MAC ADDRESS of the device that we are trying to connect to rather than the hardware address of the interface.

For the wlanctl-ng section of the code runPrisimScan (found in wag-profiles) gives the available devices that you can connect to and this is matched up with a profile.

I'll have to give some though on whether WEP/WEP2 should be dealt with the same way.

Post Reply