You are not logged in.

#1 2007-08-18 03:17:52

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

netcfg2 beta - Network profiles updated

Looking for testers for netcfg2, which will replace the current netcfg/profile system.

This package installs alongside the existing netcfg, so it will not clobber or overwrite any configuration. I've hunted down all the bugs from netcfg, and the existing scripts, so if i've missed any, please let me know on the bug tracker. Particularly some of those nastier ones like essid's containing spaces, all fixed. I've closed most feature requests too. Those that remain will be done 'soon', 2.1 or earlier. I'd like to get the foundation solid and stable first. Contributions are always welcome though!

Features of note:
http://wiki.archlinux.org/index.php/Net … w_Features

Download:
Package and source:
http://src.iphitus.org/netcfg-release/
Will be in the [testing] repo later today too.
PKGBUILD is inside the above source tarball.

Documentation:
I'm writing it.
Configuration is in /etc/network.d/, there are countless examples in there already.
In rc.conf, it has been renamed from NET_PROFILES to NETWORKS.
The rc.d daemon is now /etc/rc.d/net-profiles

For those who used the ini based network scripts, this one has gone back to sh style configs. It's had a few other changes too. I'm approaching this a bit more conservatively, as the ini setup was just totally over-engineered. This ones something like half the code size at least, works just as well, and far more readable. So if you got scared off by the source last time, give it another look.

If you want roaming support, ala networkmanager, see brain0's autowifi.

Please remember that this is not the final version, and there are bugs. Through testing, i want to get them fixed before the final version.

Last edited by iphitus (2007-08-18 03:30:47)

Offline

#2 2007-08-18 08:44:49

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

Re: netcfg2 beta - Network profiles updated

... and we're actually a head of schedule! (ie, its not year 3000 yet...)

congratulations for a great work done. i knew you could wink

i'll take a look, and wait for some more users to check it out, before changing the gui program.

Offline

#3 2007-08-19 01:42:51

leif_thande
Member
Registered: 2005-07-09
Posts: 20

Re: netcfg2 beta - Network profiles updated

Tested rapidly, here are some comments :

- netcfg2 should output the help menu when called without arguments.

- The wiki says some man pages are written, but they aren't in the package nor the sources, so where can we find them ?

- You should rename the subroutines in /usr/lib/network because when using a bad connection type, netcfg2 outputs :

example is not a valid connection.
Try one of: ethernet.subr
network.subr
wireless.subr

which in fact won't work because you don't need to type the .subr in "CONNECTION".
also it would look better if it was printed all on the same line, like this :

Try one of : ethernet, choice2, choiceN

The -a option is not working, the problem is in network.subr :
all_down()
{
    for prof in $STATE_DIR/profiles/*; do
        . $STATE_DIR/profiles/$prof
        profile_down $PROFILE
    done
}

Here $prof already contains the full path, so $STATE_DIR/profiles is in excess. Also, sourcing the profile doesn't set $PROFILE. I fixed the problem this way :
all_down()
{
    for prof in $STATE_DIR/profiles/*; do
        profile_down `basename $prof`
    done
}


The rest seems ok. I did a little sneak peek to the code and I must say that I like you style wink

Keep up with the good work

Leif-

Last edited by leif_thande (2007-08-19 02:49:15)

Offline

#4 2007-08-19 11:41:50

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

alright. new version uploaded with the aforementioned changes.

The documentation mentioned on the wiki page is here:
http://archlinux.org/~james/projects/?p … 2a;hb=HEAD

though it's written for an older version of these scripts which experimented with ini styled configs, not the bash configs in this one, so there will need to be some minor changes to correct them

thanks for testing, I really appreciate it. As for style, the style of these came after a lot of changes, edits and lessons learnt from earlier versions. It was also partially inspired by the style used in some of FreeBSD's scripts.

James

Last edited by iphitus (2007-08-19 11:45:24)

Offline

#5 2007-08-19 16:17:49

RedShift
Member
From: Belgium
Registered: 2004-07-16
Posts: 230

Re: netcfg2 beta - Network profiles updated

I can't help but get the bloat feeling when I see this sad

Last edited by RedShift (2007-08-19 16:18:15)


:?

Offline

#6 2007-08-19 17:26:12

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: netcfg2 beta - Network profiles updated

Isn't it confusing to have two systems :
INTERFACES stuff in rc.conf, and network profiles ?

The only thing I've in INTERFACES for a while is lo. Is there any cases where one wouldn't want to have the loopback interface ?
Maybe it could be built in somewhere.
Otherwise maybe it's already possible to make a profile for it?


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#7 2007-08-19 20:24:58

leif_thande
Member
Registered: 2005-07-09
Posts: 20

Re: netcfg2 beta - Network profiles updated

Redshit : Bloat ? Come on, it could hardly be more minimalistic. Arch was missing a good Internet connection manager and netcfg is good tool, well integrated into the Arch setup.

Last edited by leif_thande (2007-08-19 20:25:17)

Offline

#8 2007-08-19 23:46:40

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

shining wrote:

Isn't it confusing to have two systems :
INTERFACES stuff in rc.conf, and network profiles ?

The only thing I've in INTERFACES for a while is lo. Is there any cases where one wouldn't want to have the loopback interface ?
Maybe it could be built in somewhere.
Otherwise maybe it's already possible to make a profile for it?

Profiles came after INTERFACES, and INTERFACES will definitely not be removed. Many people still find them useful, particularly on desktops with static configurations - myself even. I do intend to increase the code share between these two, as there's a lot of duplication already, but that'll come later.

It is possible to create a profile for lo though:

CONNECTION="ethernet"
INTERFACE="lo"
IP="static"
IFOPTS="127.0.0.1"

Should work.


RedShift wrote:

I can't help but get the bloat feeling when I see this

Take a look at /usr/bin/netcfg. It's very messy. The scripts themselves, are blind, stupid and make plenty of assumptions - mostly incorrect. Take a look at the example profile in /etc/network-profiles, generally confusing. As you can see, the current network profiles do need a lot of work.

This is simply a long needed rewrite, that is a lot tidier, separated from initscripts and has many of the nastier bugs removed. Have a look at the code before you declare 'bloat' - you'll find its anything but. This code has been developed over 18 or so months, evolving through a few forms, resulting in the simplest and tidiest implementation I could design, that you see here now.

These scripts will make it far easier to run on wireless on Arch "out of the box", in a "simple" arch styled way, in addition to meeting some long missing capabilities, closing plenty of bugs and feature requests.

James

Offline

#9 2007-08-20 10:31:59

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: netcfg2 beta - Network profiles updated

iphitus wrote:
shining wrote:

Isn't it confusing to have two systems :
INTERFACES stuff in rc.conf, and network profiles ?

The only thing I've in INTERFACES for a while is lo. Is there any cases where one wouldn't want to have the loopback interface ?
Maybe it could be built in somewhere.
Otherwise maybe it's already possible to make a profile for it?

Profiles came after INTERFACES, and INTERFACES will definitely not be removed. Many people still find them useful, particularly on desktops with static configurations - myself even. I do intend to increase the code share between these two, as there's a lot of duplication already, but that'll come later.

Ok so maybe that could be possible in the long run?

It is possible to create a profile for lo though:

CONNECTION="ethernet"
INTERFACE="lo"
IP="static"
IFOPTS="127.0.0.1"

Should work.

That seems to work fine for bringing the interface up, but netcfg2 isn't able to bring it down.
"sudo netcfg2 -d loopback" fails, "ifconfig lo" shows it's still up, and the files in /var/run/net/ are still there.

Otherwise, there is a little typo in the init script :

--- /etc/rc.d/net-profiles    2007-08-19 13:39:23.000000000 +0200
+++ /etc/rc.d/net-profiles.new    2007-08-20 12:15:08.000000000 +0200
@@ -37,7 +37,7 @@
         ;;
     stop)
         # shutdown any profiles started by netcfg (or from NET_PROFILES in rc.conf)
-        status "Stopping Network Profiles" /usr/bin/netcfg2 down-all
+        status "Stopping Network Profiles" /usr/bin/netcfg2 all-down
         rm_daemon net-profiles
         ;;
     restart)

And finally, there is a little problem due to the co existence of netcfg and netcfg2 :
"/etc/rc.d/network stop" calls "/usr/bin/netcfg --stopall" , which will look for files in /var/run/net .
But netcfg2 already uses this directory, in a different way:

sudo /etc/rc.d/network stop                                                                                                                      ~
/usr/bin/netcfg: line 76: .: /var/run/net/interfaces: is a directory
error: missing interface name (eg, eth0)
:: Stopping Network                                                                                                                                     [DONE]

pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#10 2007-08-20 11:29:28

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

shining wrote:

Ok so maybe that could be possible in the long run?

Yup, hopefully.

That seems to work fine for bringing the interface up, but netcfg2 isn't able to bring it down.
"sudo netcfg2 -d loopback" fails, "ifconfig lo" shows it's still up, and the files in /var/run/net/ are still there.

Ok, tested it, and its working for me. Made some changes, try in 1.99.25.

Otherwise, there is a little typo in the init script :

fixed. Thanks for that.

And finally, there is a little problem due to the co existence of netcfg and netcfg2 :
"/etc/rc.d/network stop" calls "/usr/bin/netcfg --stopall" , which will look for files in /var/run/net .
But netcfg2 already uses this directory, in a different way:

sudo /etc/rc.d/network stop                                                                                                                      ~
/usr/bin/netcfg: line 76: .: /var/run/net/interfaces: is a directory
error: missing interface name (eg, eth0)
:: Stopping Network                                                                                                                                     [DONE]

hrm. ok. I suppose I could move it, but it's where it should be, anywhere else is a tad counter-intuitive. I'll move it temporarily, though the idea is for it to be a global state directory for all scripts. It's moved to /var/run/network/ in 1.99.26

James

Last edited by iphitus (2007-08-20 11:31:25)

Offline

#11 2007-08-20 11:45:14

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: netcfg2 beta - Network profiles updated

iphitus wrote:

Ok, tested it, and its working for me. Made some changes, try in 1.99.25.

Cool, it works perfectly now.
I figured something was probably missing in ethernet_down , but wasn't sure exactly wink

I suppose I can disable the network script now, and only use net-profiles.

fixed. Thanks for that.

no problem.

hrm. ok. I suppose I could move it, but it's where it should be, anywhere else is a tad counter-intuitive. I'll move it temporarily, though the idea is for it to be a global state directory for all scripts. It's moved to /var/run/network/ in 1.99.26

James

It isn't a real problem, since it will disappear when netcfg2 replaces netcfg. I just wanted to mention it smile


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#12 2007-08-20 11:57:18

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

shining wrote:

It isn't a real problem, since it will disappear when netcfg2 replaces netcfg. I just wanted to mention it smile

yeah. /var/run/network is fine anyway, it's in 1.99.26.

As a note, for those upgrading to 1.99.26 from a prior version, take all netcfg managed connections down first, upgrade, then raise them again after the upgrade.

I've got my desktop running entirely on netcfg2 now, without any problems, for me all of  wireless(wpa), ethernet and loopback are connected, going up and down upon request -- working fine. wep was also working as required earlier.

James

Offline

#13 2007-08-20 14:36:55

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: netcfg2 beta - Network profiles updated

iphitus wrote:

As a note, for those upgrading to 1.99.26 from a prior version, take all netcfg managed connections down first, upgrade, then raise them again after the upgrade.

I've got my desktop running entirely on netcfg2 now, without any problems, for me all of  wireless(wpa), ethernet and loopback are connected, going up and down upon request -- working fine. wep was also working as required earlier.

James

I'm now using 1.99.26 with loopback and wireless (dhcp + wpa), everything works perfectly, thanks.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#14 2007-08-20 23:11:48

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

shining wrote:
iphitus wrote:

As a note, for those upgrading to 1.99.26 from a prior version, take all netcfg managed connections down first, upgrade, then raise them again after the upgrade.

I've got my desktop running entirely on netcfg2 now, without any problems, for me all of  wireless(wpa), ethernet and loopback are connected, going up and down upon request -- working fine. wep was also working as required earlier.

James

I'm now using 1.99.26 with loopback and wireless (dhcp + wpa), everything works perfectly, thanks.

Great smile Thanks for your help. Anyone else using wireless care to test? This setup will not interfere with your current one, thus should break nothing.

James

Offline

#15 2007-08-23 04:59:19

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: netcfg2 beta - Network profiles updated

One wep wireless with static ip + loopback working here (using 1.99.26).  No problems to report - boring, I know... Thanks for your work on this!

Last edited by fwojciec (2007-08-23 05:04:56)

Offline

#16 2007-08-26 02:31:09

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

Updated, 1.99.27

Fixed -c, checkyesno, and added an example configs for loopback and net-rename (/etc/iftab)

http://src.iphitus.org/netcfg-release/n … pkg.tar.gz

James

Offline

#17 2007-08-26 07:40:16

WhiteMagic
Member
Registered: 2007-03-01
Posts: 85

Re: netcfg2 beta - Network profiles updated

I tired out the new scripts at home with wpa, wep an no encryption and it all worked fine. I also tested it with the wirless at my university where it also worked without a problem. All with the atheros based card in my laptop.

The only error like thing I sometimes got was that, even though the interface was down, or no longer connected to the access point netcfg2 wouldn't let me reconnect until I first told it to take the interface down and then up again. But I haven't yet figured in which circumstances this happens I'll try some more.

Anyway many thanks for those nice scripts.

Offline

#18 2007-08-27 15:01:42

slubman
Member
From: Grenoble (France)
Registered: 2004-08-04
Posts: 86
Website

Re: netcfg2 beta - Network profiles updated

Trying to use netcfg-menu give an error

# netcfg-menu
/usr/bin/netcfg-menu: line 14: /home-wifi: Aucun fichier ou répertoire de ce type
/usr/bin/netcfg-menu: line 14: /home-wired: Aucun fichier ou répertoire de ce type
/usr/bin/netcfg-menu: line 14: /loopback: Aucun fichier ou répertoire de ce type
No profiles were found in
/usr/bin/netcfg-menu: line 25: return: can only `return' from a function or sourced script
...
lots of empty lines
...
netcfg v0.1

usage: netcfg [options] <profile_name>
       netcfg --stop <interface>
       netcfg --menu [--timeout <secs>]
       netcfg --stopall

options:
  -c    Don't reconfigure an interface if it's already up

Network profiles are stored in /etc/network-profiles

solved by these little patch

--- netcfg-menu.old     2007-08-27 16:59:22.000000000 +0200
+++ netcfg-menu 2007-08-27 17:02:52.000000000 +0200
@@ -3,6 +3,8 @@
. /etc/rc.conf
. /etc/rc.d/functions

+PROFILE_DIR=/etc/network.d
+
# Scan all profiles
i=0
for prof in `find $PROFILE_DIR -maxdepth 1 -type f -printf "%f\n"`; do
@@ -44,10 +46,10 @@
case $ret in
     1) ;; # Cancel - do nothing
     255) # timeout - use default
-        netcfg $DEFAULT
+        netcfg2 $DEFAULT
         ;;
     0)  # User selection
-        netcfg $(cat $ANSWER)
+        netcfg2 $(tail -n 1 $ANSWER)
         ;;
     *)  # Shouldnt happen
         echo "Abnormal ret code from dialog: $ret"

Everything else (ethernet and wifi all with dhcp and a hack to have the 2 nic with the ame mac address) works fine.

Offline

#19 2007-08-27 16:58:21

Mikko777
Member
From: Suomi, Finland
Registered: 2006-10-30
Posts: 837

Re: netcfg2 beta - Network profiles updated

How the **ll did i miss this! big_smile

Been waiting for ages wink thanks iphi! will test asap smile

Offline

#20 2007-08-27 18:32:00

slubman
Member
From: Grenoble (France)
Registered: 2004-08-04
Posts: 86
Website

Re: netcfg2 beta - Network profiles updated

After some more test with wifi, when using WPA (with an ipw2200bg), before calling wpa_supplicant,lookslike a call to iwconfig is missing to set the ESSID.

Am I the only one with such a problem ?

Offline

#21 2007-08-27 23:01:41

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

slubman wrote:

After some more test with wifi, when using WPA (with an ipw2200bg), before calling wpa_supplicant,lookslike a call to iwconfig is missing to set the ESSID.

Am I the only one with such a problem ?

no call is missing. wpa_supplicant sets the essid, there's no need for iwconfig to do anything whatsoever when using wpa_supplicant. wpa works fine for me, you saying it isnt working there or just you think it should do that?

I'll fix up netcfg-menu too.

James

Offline

#22 2007-08-28 04:02:35

slubman
Member
From: Grenoble (France)
Registered: 2004-08-04
Posts: 86
Website

Re: netcfg2 beta - Network profiles updated

I say it does not work without this call with my card.

Offline

#23 2007-08-28 07:02:09

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

slubman wrote:

I say it does not work without this call with my card.

what card? what's your configuration? where are you adding ifconfig into the scripts? does it work when you add it in that exact location?

that's quite an odd problem. It'll be interesting to see what driver it is.

Last edited by iphitus (2007-08-28 07:02:44)

Offline

#24 2007-08-28 07:35:28

slubman
Member
From: Grenoble (France)
Registered: 2004-08-04
Posts: 86
Website

Re: netcfg2 beta - Network profiles updated

I'm using Arch32, an Intel Pro Wireless 2200 bg, the stock arch kernel and no change the default wpa_supplicant.conf.
I'm connecting to an AP with an hidden ESSID, using WPA2.

This the "patch":

--- wireless.subr.old   2007-08-26 04:26:12.000000000 +0200
+++ wireless.subr.new   2007-08-28 09:32:35.000000000 +0200
@@ -113,6 +113,11 @@
     wpa)
         local WPA_CONF=`mktemp /tmp/wpa.XXXXXXXX`

+       if ! eval iwconfig $INTERFACE mode managed essid "$ESSID"; then
+           echo "wireless-up: Could not set wireless configuration"
+           return 1
+        fi
+
         # Create a random file to store configuration, make it root only.
         chmod 600 $WPA_CONF
         echo "ctrl_interface=/var/run/wpa_supplicant" >> $WPA_CONF

If I look at the iwconfig output with the original netcfg2 script, I can see when the key is set but no essid set, and I've got the

Wireless association failed.

error. Then if I set the ssid before calling netcfg2, the connection is ok. That's why I added this line to wireless.subr

Last edited by slubman (2007-08-28 07:35:55)

Offline

#25 2007-08-28 21:51:17

xsdnyd
Member
Registered: 2007-04-28
Posts: 110

Re: netcfg2 beta - Network profiles updated

will this work on arch64 too?
the pkgbuild doesn't have a x86_64 flag...


We can't stop here! This is bat country!!

Offline

Board footer

Powered by FluxBB