Improved Network Wizard (and rc.network)

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#46 Post by Dougal »

Another update.
I've changed the code that finds info about usb devices (for display in
the first wizard window). I hope it works ok.

I've also added some failsafes, so if you try and create a profile without
scanning first (and thus it is incomplete), the wizard will not crash.

Also, if you use the option of autoconnecting after boot (when using my
update to the "Connect" desktop icon, as posted last time), you will get
dialogs telling you which network it tries to connect to and if it
succeeded or failed.
This is also different when connecting with the wizard: when you try and
configure a wireless network, the dialog will give you a message like:
Configuring interface $INTERFACE to network $ESSID
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
urban soul
Posts: 273
Joined: Wed 05 Mar 2008, 17:03
Location: "Killing a nerd is not as much fun as ist sounds" B.Simpson
Contact:

#47 Post by urban soul »

Dougal wrote: 2) I noticed something small that I'm not sure what to do with, maybe
someone (tempestuous?) will know:
While testing, I tried using the "autoconnect" profile and got an error
from iwconfig, that the interface (wlan0, the Ralink in the Classmate
with rt73usb) does not support the "Auto" mode...
iwconfig essid auto never worked for me for rt73usb or orinico or prism2.
Dougal wrote: 3) I've fixed something I implemented originally but was incomplete, but
I'm not even sure if it's the right thing to do:
When configuring a wireless interface (with iwconfig, wpa_sup or
wlanctl-ng), if any of the commands fails (setting mode, essid etc.), then
it will declare the configuration as failed, not even trying to see if
it's connected.
Is there a point in doing so, or just go on and test the interface (with
ifplugstatus) anyway?
Yes, it is. My orinico card does not support set frequency and some others, however it connects just fine. In fact you only need the essid (and the key) for wep.
Dougal wrote: 4) I've found the problem that caused the crashing, the question is how
to solve it:
When creating a new profile not from a scan result (i.e, a
completely "made up" one, like the samples), the user is asked for a name
and ESSID.
But the profile is saved according to the MAC address... so you get the
file /etc/wireless/profiles/.Open.conf (blank MAC address before first
dot...)
After a scan, you have the MAC address. (PROFILE_MAC or so in function SetupNewProfile in wag-profiles.sh). I would make scanning obligatory as i have done in wag-profiles.sh last time. It also saves typing and is a known procedure to every user. Please wait with editing wag-profiles.sh a bit, Barry is reviewing it now.

Urban

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#48 Post by BarryK »

Please wait with editing wag-profiles.sh a bit, Barry is reviewing it now.
Yes, I was looking at some changes Urban Soul made a week or so ago.
I have just downloaded the Jul27 wizard, and will checkout the connect mods.

It would be really great if the 'sleep 10' could be replaced with a loop that can terminate sooner. Although your profiles are not based on eth0, wlan0 etc. names, you can still lookup the interface (eth0, wlan0 etc) of each profile and wait on it. If the max wait is 10 or 12 seconds, it doesn't matter, as it runs in the background, but you will get the bonus of earlier completion of the loop if the interfaces are available.
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#49 Post by BarryK »

First item of feedback, testing Jul27th tarball:

Running 4.1alpha "pre-5"

In the first window, my wlan1 interface has no description:

wlan1 Wireless rt73usb usb: <nothing>

I suggest have the fallback to getting info from the module itself:

Code: Select all

# modinfo rt73usb | grep '^description:'
That returns:
"Ralink RT73 USB Wireless LAN driver"
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#50 Post by BarryK »

2nd item of feedback:

The prominent 'Scan' button is very nice.

Perhaps this is a dumb question, but isn't it a bit confusing that the user is asked to save twice? I mean, asked to save the profile, then a bit later asked to save the configuration for next boot.

..no, the profile is a different thing from saving the configuration for reboot.

But, perhaps the user should not be asked to save the profile until the final step, so the user is only asked once to save. Just a thought.
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#51 Post by BarryK »

3rd item:

Having completed the operation of connecting wlan1 to the network, there is a return to the main window, with this text at the top:

"NETWORK CONFIGURATION OF wlan1 SUCCESSFUL!
The configuration has been saved to file /etc/wlan1mode.
This file is read at bootup by /etc/rc.d/rc.network
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#52 Post by BarryK »

4th item:

After setting up my rt73usb interface, I rebooted, but didn't get any Blinky.

I looked in /tmp/bootsysinit.log and found this:

Code: Select all

/etc/rc.d/rc.network: line 172: syntax error near unexpected token `}'
/etc/rc.d/rc.network: line 172: `}'
My config files are as follows:

/etc/network/interfaces/00:1C:F0:0A:55:F9.conf
...empty file.

/etc/wireless/interfaces/00:1C:F0:0A:55:F9.conf

Code: Select all

INT_WPA_DRV=''
USE_WLAN_NG=''
00:12:BF:19:ED:11.Open.conf

Code: Select all

TITLE="WLAN"
        WPA_DRV=""
        WPA_TYPE=""
        WPA_AP_SCAN=""
        ESSID="WLAN"
        NWID=""
        KEY=""
        MODE="managed"
        SECURE="open"
        FREQ="2.437G"
        CHANNEL="6"
        AP_MAC="00:12:BF:19:ED:11"

/etc/wireless/profiles/autoconnect.conf

Code: Select all

TITLE="autoconnect"
	IP=""
	GATEWAY=""
	ESSID="any"
	NWID=""
	KEY="off"
	MODE="Auto"
	SECURE="open"
	FREQ=""
	CHANNEL=""
	AP_MAC=""
/etc/wireless/profiles/template.conf

Code: Select all

TITLE="template"
	IP="192.168.0.3"
	GATEWAY=""
	ESSID="hotspot"
	NWID=""
	KEY=""
	MODE="Managed"
	SECURE="open"
	FREQ="2.437G"
	CHANNEL=""
	AP_MAC=""
/etc/wireless/wpa_profiles/wpa_supplicant2.conf

Code: Select all

ctrl_interface=/var/run/wpa_supplicant
ap_scan=2
update_config=1

network={
	ssid="default"
	psk="defaultpsk"
	proto=WPA2
	key_mgmt=WPA-PSK
	pairwise=CCMP TKIP
	group=CCMP TKIP
}
/etc/wireless/wpa_profiles/wpa_supplicant.conf

Code: Select all

ctrl_interface=/var/run/wpa_supplicant
ap_scan=2
update_config=1

network={
	ssid="default"
	psk="defaultpsk"
	proto=WPA
	key_mgmt=WPA-PSK
	pairwise=TKIP
	group=TKIP
}
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#53 Post by BarryK »

BarryK wrote:First item of feedback, testing Jul27th tarball:

Running 4.1alpha "pre-5"

In the first window, my wlan1 interface has no description:

wlan1 Wireless rt73usb usb: <nothing>

I suggest have the fallback to getting info from the module itself:

Code: Select all

# modinfo rt73usb | grep '^description:'
That returns:
"Ralink RT73 USB Wireless LAN driver"
But of course that same info is already in /etc/networkmodules:

# cat /etc/networkmodules | grep 'rt73'
rt73usb "usb: Ralink RT73 USB Wireless LAN driver."
[url]https://bkhome.org/news/[/url]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#54 Post by Dougal »

iwconfig essid auto never worked for me for rt73usb or orinico or prism2.
Ok, I changed the "autoconnect" profile to use Managed.

My orinico card does not support set frequency and some others, however it connects just fine. In fact you only need the essid (and the key) for wep.
I changed it back -- now it will always go and check if it actually is connected.

It would be really great if the 'sleep 10' could be replaced with a loop that can terminate sooner. Although your profiles are not based on eth0, wlan0 etc. names, you can still lookup the interface (eth0, wlan0 etc) of each profile and wait on it. If the max wait is 10 or 12 seconds, it doesn't matter, as it runs in the background, but you will get the bonus of earlier completion of the loop if the interfaces are available.
Ok, the max is now 12, but if all the interfaces that have been configured
are detected, it'll break the loop.

In the first window, my wlan1 interface has no description:

wlan1 Wireless rt73usb usb: <nothing>

I suggest have the fallback to getting info from the module itself:
Code:
# modinfo rt73usb | grep '^description:'
I noticed you implemented something of this kind already, by looking in
/etc/networkmodules (I actually wrote a script for updating that file
for new kernels based on the modinfo output -- sent it to tempestuous a
while ago).

The problem I have with presenting that info is that it could be confusing
to the user, since they might not know which chip is in their device.
That's why I think using lsusb is good, since it will at least give the
right NIC manufacturer, which is what the user will know.

I've implemented your suggestion for now, but still prefer lsusb.

Having completed the operation of connecting wlan1 to the network, there is a return to the main window, with this text at the top:

"NETWORK CONFIGURATION OF wlan1 SUCCESSFUL!
The configuration has been saved to file /etc/wlan1mode.
This file is read at bootup by /etc/rc.d/rc.network
I removed that. Might want to add some info later, but I don't know if
there's a point (it would be better to just explain everything in the man
page).

After setting up my rt73usb interface, I rebooted, but didn't get any Blinky.

I looked in /tmp/bootsysinit.log and found this:

Code:
/etc/rc.d/rc.network: line 172: syntax error near unexpected token `}'
/etc/rc.d/rc.network: line 172: `}'
oops, that's the result of last-minute changes that weren't tested... fixed.


I've uploaded an updated attachment with all these updates (this time it
is properly tested...).
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#55 Post by BarryK »

Oh dear, hit another problem. I just now booted my laptop, the profiles are as before, but this time no Blinky.

wlan1 is down, and /tmp/bootsysinit.log has this:

Code: Select all

configuring network interface wlan1
wireless scan with iwlist failed... skipping interface
And /var/log/messages has this:

Code: Select all

Jul 29 18:03:41 (none) local0.err dhcpcd[5272]: wlan1: dhcpcd not running
... a few lines repeating this message.
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#56 Post by BarryK »

Strange. I shutdown the laptop, started it again, this time I got Blinky.

/tmp/bootsysinit.log has this:

Code: Select all

..Configuring interface wlan1 with iwconfig...

cheching if interface wlan1 is alive...
Info, wlan1: dhcpcd 3.1.8 starting
Info, wlan1: hardware address = 00:1c:f0:0a:53:f8
Info, wlan1: broadcasting for a lease
Debug, wlan1: sending DHCP_DISCOVER with xid 0x51992b6e
Debug, wlan1: waiting on select for 20 seconds
Debug, wlan1: waiting on select for 20 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 19 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: got a packet with xid 0x51992b6e
Info, wlan1: offered 10.1.1.3 from 10.1.1.1
Debug, wlan1: sending DHCP_REQUEST with xid 0x51992b6e
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 18 seconds
Debug, wlan1: waiting on select for 17 seconds
Debug, wlan1: got a packet with xid 0x51992b6e
Info, wlan1: checking 10.1.1.3 is available on attached networks
Debug, wlan1: sending ARP probe #1
Debug, wlan1: sending ARP probe #2
Debug, wlan1: sending ARP probe #3
Debug, wlan1: sending ARP claim #1
Debug, wlan1: sending ARP claim #2
Info, wlan1: leased 10.1.1.3 for 172800 seconds
Info, wlan1: no renewal time supplied, assuming 86400 seconds
Info, wlan1: no rebind time supplied, assuming 151200 seconds
Info, wlan1: adding IP address 10.1.1.3/24
Info, wlan1: adding default route via 10.1.1.1 metric 0
Info, wlan1: adding route to 169.254.0.0/16 metric 0
Debug, wlan1: writing /etc/resolv.conf
Debug, wlan1: writing /var/lib/dhcpcd/dhcpcd-wlan1.info
Debug, wlan1: exec "/etc/dhcpcd.sh" "/var/lib/dhcpcd/dhcpcd-wlan1.info" "new"
Debug, wlan1: forking to background
Success!
And /var/log/messages still has a couple of these:

Code: Select all

Jul 30 03:01:54 (none) local0.err dhcpcd[5098]: wlan1: dhcpcd not running
[url]https://bkhome.org/news/[/url]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#57 Post by Dougal »

BarryK wrote:Oh dear, hit another problem. I just now booted my laptop, the profiles are as before, but this time no Blinky.

wlan1 is down, and /tmp/bootsysinit.log has this:

Code: Select all

configuring network interface wlan1
wireless scan with iwlist failed... skipping interface
This would mean that the scan didn't find anything. The question is if it is related to some bug (like someone here who got a "interface doesn't support scanning" error, which I assumed came from firmware not being loaded yet (are we sure everything is ok if the interface is listed in "ifconfig -a"?).
I could add a test for when the scan returns nothing, sleep 1 and then try again.
And /var/log/messages has this:

Code: Select all

Jul 29 18:03:41 (none) local0.err dhcpcd[5272]: wlan1: dhcpcd not running
... a few lines repeating this message.
I think these messages can be ignored: every time it goes to configure an interface, it runs a clean_up_interface, which, among other things, runs dhcpcd -k $INTERFACE -- just in case. I'm assuming these errors come from that.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#58 Post by BarryK »

Dougal wrote: This would mean that the scan didn't find anything. The question is if it is related to some bug (like someone here who got a "interface doesn't support scanning" error, which I assumed came from firmware not being loaded yet (are we sure everything is ok if the interface is listed in "ifconfig -a"?).
Well, I would like to upload 4.1alpha5 soon, so maybe I'll just stick in a 'sleep 1' after that ifconfig loop, in case it does need a little bit of extra time to settle sometimes.

But then, my rc.network goes straight ahead after the ifconfig loop without any sleep, and that works reliably.
[url]https://bkhome.org/news/[/url]

User avatar
edoc
Posts: 4729
Joined: Sun 07 Aug 2005, 20:16
Location: Southeast Georgia, USA
Contact:

#59 Post by edoc »

HairyWill wrote:
Dougal wrote:For a long time I didn't even realise that the network wizard had a scan button.
Just tried Pwireless wireless scan and it discovered my wireless router then prompted for the WEP.

After I entered it the app asks if I want to use that connection which I did then it promptly locked up my computer so that I had to do a cold reboot.

This is on my Panasonic CF-28 laptop using a GigaFast USB modem (ZyDAS).

I have also tried the Scan feature inside of Setup - Network Wizard - Wireless window. It all looks good there but still fails to create a connection that Seamonkey or Sylpheed in 4.00 can use.
[b]Thanks! David[/b]
[i]Home page: [/i][url]http://nevils-station.com[/url]
[i]Don't google[/i] [b]Search![/b] [url]http://duckduckgo.com[/url]
TahrPup64 & Lighthouse64-b602 & JL64-603

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#60 Post by BarryK »

Dougal,
Is there something you can do to cater for laptop people on-the-go who need to connect to the Internet at different places. If the profiles are based only only the mac address, doesn't this leave us with the same limitation as the old system?

In my case, I was in Perth at a relative's place, then I came home, but the same profile worked at home. The wireless networks are open at both places.

But, that won't always be the case. I do move around a lot, need to get online at many places. With a wired network, it is simpler, just use whatever dhcpd returns, but the wireless networks may have major differences.

Perhaps include something else as well as the mac address in the profile name? essid?
[url]https://bkhome.org/news/[/url]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#61 Post by Dougal »

BarryK wrote:In my case, I was in Perth at a relative's place, then I came home, but the same profile worked at home. The wireless networks are open at both places.
What do you mean by "the same profile worked"? You mean the same MAC address existed in both cases?
I already mentioned in this thread that I could easily add the SSID, too, but figured people might change it sometimes on their router.

In any case, the way it currently works is that if it wasn't able to connect to any network that has a profile, it will try each of the (non-profiled) open networks available.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#62 Post by BarryK »

Correct me if I'm wrong, but isn't the MAC address simply the hardware address of the network interface device.

In my case, I'm using the same wireless hardware, so of course the address will be the same whereever I take my laptop.

A side note, I'm using a D-Link DWA-110 USB wireless unit with my laptop, as I could never get the internal wireless hardware to work.

Therefore, the problem as I asked in my previous question, still remains. The MAC address is a constant whereever I take my laptop, but I need to connect to different wireless networks.

Actually, do you need to use the MAC address at all in the profile name -- why not a random number? or the date? The MAC address, can be inside the profile file.

The thing is, I need to create a profile for each of the places I go to, so the profile file must have a different name for each. I imagine a lot of people would have the same situation as me.
[url]https://bkhome.org/news/[/url]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#63 Post by Dougal »

BarryK wrote:Correct me if I'm wrong, but isn't the MAC address simply the hardware address of the network interface device.
As far as I understand it, the MAC address is the HW address of the network you connect to, i.e. the router. Thus (as I explained in the parent post) I used it as a unique identifier of the network (since, as I explained in another post, I've seen cases where the SSID is "default" and such).

If you run a wireless scan somewhere where there are a few networks, you see that each has its own address.

I may be wrong, of course, but I asked an no-one bothered to correct me.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#64 Post by BarryK »

Dougal,
No, the MAC address is the hardware address of the actual network card/hardware on your PC, not the external thing that you connect to.

That's what I always understood, so I was puzzled about the choice of MAC address for the profile files in the new Wizard.

I can prove it right now. If I run ifconfig, and look at the wlan1 information, it shows eactly the same MAC address as when I was at my relative's place:

wlan1 Link encap:Ethernet HWaddr 00:1C:F0:0A:53:F8

They refer to it as the HW (hardware) address, which is a far less confusing name than "MAC".

Perhaps name the profile as a combination:
<mac address>_<date>.profile.
...although, it would be nice to have a more meaningful name...
er, why not just ask the user for a simple name to uniquely identify the connection, like, in my case:
perenjori_internet.profile
relative_1_internet.profile
[url]https://bkhome.org/news/[/url]

nic2109
Posts: 405
Joined: Mon 01 Jan 2007, 20:24
Location: Hayslope, near Middlemarch, Midlands, England

#65 Post by nic2109 »

Barry's correct.

Every Ethernet device has its own unique "hard wired" MAC address. The Router associates the MAC address to the I/P address either via DHCP or manual assigments. The Router will of course have its own MAC address but that's irrelevant.
[color=darkblue][b][size=150]Nick[/size][/b][/color]

Post Reply