You are not logged in.
will this work on arch64 too?
the pkgbuild doesn't have a x86_64 flag...
I'll add one next release, there's nothing in this that prevents it working on x86_64. Feel free to add yourself in the meantime.
Slubman: i'll add that fix in tonight, thank you very much for the report.
James
Offline
Hi James,
I haven't tracked the changes on the forum lately and I wasn't aware that the development has moved on somewhere else. I'm still using netcfg-git from (http://www.archlinux.org/~james/project … a=shortlog) and I kinda wondered what changes were made since the last package there? Could you please summarize them for me? Also, what happened to the suspend/resume options (I've seen them stroked out in the wiki)?
I've currently got some spare time on my hands and I'm willing to test/submit patches to help you out with the netcfg2.
Michal
Offline
Hi James,
I haven't tracked the changes on the forum lately and I wasn't aware that the development has moved on somewhere else. I'm still using netcfg-git from (http://www.archlinux.org/~james/project … a=shortlog) and I kinda wondered what changes were made since the last package there? Could you please summarize them for me? Also, what happened to the suspend/resume options (I've seen them stroked out in the wiki)?
I've currently got some spare time on my hands and I'm willing to test/submit patches to help you out with the netcfg2.
Michal
I'v reversed the codebase back to a leaner, bash config setup. The code that does the actual connection is all the same, but the config code, and netcfg code is all 'new'. I have to add suspend/resume options back in again, which is why it's striked out. The git tree there is essentially historical, it's not my main working tree now. There's no scm now, I'm just releasing tarballs frequently - they're the same as what I have on disk here.
Currently, im mostly concerned with bug testing, getting these stable and in place, possibly merged, before I start to implement more of the feature requests. Patches are always welcome though.
James
Offline
Hi,
I've looked at the source code here at work. It's indeed a lot simplier and cleaner than network-git and I'm happy you dropped the ini system I hacked on the resume/suspend system from network-git, which basically creates a separate directory (suspend) storing profiles that were running before. Also, I've done a little tab cleanup:
diff -Naur netcfg-1.99.27/src/netcfg netcfg-1.99.27.mine/src/netcfg
--- netcfg-1.99.27/src/netcfg 2007-08-26 04:26:12.000000000 +0200
+++ netcfg-1.99.27.mine/src/netcfg 2007-08-30 14:29:07.000000000 +0200
@@ -25,6 +25,8 @@
echo "-d, down Take specified profile down"
echo "-a, all-down Take all active profiles down"
echo "-i, iface-down Take down profile active on specified interface"
+ echo "all-resume Resume previously suspended profiles and reconnect them"
+ echo "all-suspend Store a list of current running profiles and suspend them"
echo "-h, --help This message"
echo "-v, --version Output version information and exit"
}
@@ -43,17 +45,21 @@
CHECK="YES";
profile_up $2;;
clean)
- rm /var/run/network/interfaces/*
- rm /var/run/network/profiles/*
- killall wpa_supplicant
- killall dhcpcd
- ;;
- -d|down)
+ rm /var/run/network/interfaces/*
+ rm /var/run/network/profiles/*
+ killall wpa_supplicant
+ killall dhcpcd
+ ;;
+ -d|down)
profile_down $2;;
-i|iface-down)
interface_down $2;;
-a|all-down)
all_down;;
+ all-resume)
+ all_resume;;
+ all-suspend)
+ all_suspend;;
-*|--*)
usage;;
*)
diff -Naur netcfg-1.99.27/src/network.subr netcfg-1.99.27.mine/src/network.subr
--- netcfg-1.99.27/src/network.subr 2007-08-26 04:26:12.000000000 +0200
+++ netcfg-1.99.27.mine/src/network.subr 2007-08-30 14:29:26.000000000 +0200
@@ -33,8 +33,32 @@
#
all_down()
{
- for prof in $STATE_DIR/profiles/*; do
- profile_down $(basename $prof)
+ ls -1 $STATE_DIR/profiles/ | while read prof; do
+ profile_down $prof
+ done
+}
+
+# all_suspend
+# store a list of running profiles and take them down
+#
+all_suspend()
+{
+ [ ! -d $STATE_DIR/suspend ] && mkdir $STATE_DIR/suspend
+
+ ls -1 $STATE_DIR/profiles/ | while read prof; do
+ cp $STATE_DIR/profiles/$prof $STATE_DIR/suspend/
+ profile_down $prof
+ done
+}
+
+# all_suspend
+# store a list of running profiles and take them down
+#
+all_resume()
+{
+ ls -1 $STATE_DIR/suspend/ | while read prof; do
+ profile_up $prof
+ rm $STATE_DIR/suspend/$prof
done
}
Your previous method of iteration (for prof in $STATE_DIR/profiles/*) failed when there were no files in the directory, returning something that didn't exist (namely the matching expression). The supplied method of iteration handles even whitespace characters and is a lot better IMHO.
Please check this patch if it works as intendend, I have no linux machine with wireless here.
Michal
Offline
Just another test ... looks like the netcfg2 doesn't handle well virtual NIC (lan0:1, lan0:2 ...)
This is home-wired2
CONNECTION="ethernet"
DESCRIPTION="Weird ethernet config"
INTERFACE=lan0:1
IP="static"
IFOPTS="192.168.2.4 netmask 255.255.255.0 broadcast 192.168.2.255"
#GATEWAY="192.168.2.1"
#DNS1=192.168.2.1
And when i try to use it
# netcfg2 home-wired2
:: home-wired2 up [BUSY]
ethernet-up: Interface lan0:1 does not exist
[DONE]
# ifconfig
lan0 Link encap:Ethernet HWaddr 00:12:F0:EB:2E:32
inet addr:192.168.2.5 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::212:f0ff:feeb:2e32/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13844 errors:0 dropped:0 overruns:0 frame:0
TX packets:18666 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4127945 (3.9 Mb) TX bytes:1891899 (1.8 Mb)
Interrupt:22 Base address:0xac00
lan0:1 Link encap:Ethernet HWaddr 00:12:F0:EB:2E:32
inet addr:192.168.2.4 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:22 Base address:0xac00
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1539 (1.5 Kb) TX bytes:1539 (1.5 Kb)
# netcfg2 -d home-wired2
:: home-wired2 down [BUSY]
SIOCSIFFLAGS: Cannot assign requested address
[FAIL]
# ifconfig
lan0 Link encap:Ethernet HWaddr 00:12:F0:EB:2E:32
inet addr:192.168.2.5 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::212:f0ff:feeb:2e32/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14266 errors:0 dropped:0 overruns:0 frame:0
TX packets:19235 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4218917 (4.0 Mb) TX bytes:1944763 (1.8 Mb)
Interrupt:22 Base address:0xac00
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1539 (1.5 Kb) TX bytes:1539 (1.5 Kb)
The deactivation failed, but is in fact a success.
Offline
hi, i'm using netcfg2 on arch64 with ethernet and wireless.
works flawlessly
We can't stop here! This is bat country!!
Offline
alright, thanks for the testing guys, I'll merge all those fixes tonight and put out a release.
Offline
1.99.28 is out:
- Applied requested fixes to netcfg-menu
- Added virtual nic support
- Applied Neuro's patch - added suspend support
- Added x86_64 to pkgbuild
- Cleaned up output a bit
- Uploaded MD5SUMS for latest release
Havn't tested all of the changes yet, so if you reported a problem, let me know if it's working now.
http://src.iphitus.org/netcfg-release/n … pkg.tar.gz
http://src.iphitus.org/netcfg-release/n … .28.tar.gz
James
Last edited by iphitus (2007-09-01 23:51:50)
Offline
Havn't tested all of the changes yet, so if you reported a problem, let me know if it's working now.
I've finally moved to netcfg2 for my laptop and everything seems to be working just fine. I've only had a minor headache with the complete.example. The IFOPTS="dhcp" param there is misleading, I've had to dig up in the sourcecode to see that it should be IP="dhcp". Could you please fix the example in the next release?
pre/post up/down commands are working fine, mounting all me shares when needed. I've also checked the resume/suspend code I've written and it seems to be working just fine. At least for me.
James, are there any plans on implementing wifi auto-connect? I'm thinking of taking a shot at it today... Maybe I'll have something to show this evening.
Michal
Offline
iphitus wrote:Havn't tested all of the changes yet, so if you reported a problem, let me know if it's working now.
I've finally moved to netcfg2 for my laptop and everything seems to be working just fine. I've only had a minor headache with the complete.example. The IFOPTS="dhcp" param there is misleading, I've had to dig up in the sourcecode to see that it should be IP="dhcp". Could you please fix the example in the next release?
pre/post up/down commands are working fine, mounting all me shares when needed. I've also checked the resume/suspend code I've written and it seems to be working just fine. At least for me.
James, are there any plans on implementing wifi auto-connect? I'm thinking of taking a shot at it today... Maybe I'll have something to show this evening.
Michal
brain0's autowifi does a good job of that, though doesnt link into these scripts at all yet.
currently you can put them all into NETWORKS=() in rc.conf, enable scan in them, then restart net-profiles. Works well, but it's a bit backwards.
Maybe just create an /etc/rc.d daemon that searches for networks, if it finds them, then calls the appropriate profile. wireless.subr is source-able, so steal functions from there if you need them.
James
Offline
I've got a problem with my ipw3945. My AP is WPA2-PSK and it works fine with wpa_supplicant etc. However, after downing the interface with netcfg2, it associates with a nearby open AP (which doesn't need any keys at all). This is caused by the last line in wireless_down:
iwconfig $INTERFACE essid off key off
Anyone knows how to for ipw3945 into disassociated mode explicitely?
Now, it wouldn't bother me at all if not for the fact, that my card requires at least 2-3 attempts at iwlist scan to retrieve all APs (not only from the currently associated channel) nearby when it's associated. That's why I get:
[root@deck:/usr/lib/network] netcfg2 -d continuity-wifi
:: continuity-wifi down [DONE]
[root@deck:/usr/lib/network] netcfg2 continuity-wifi
:: continuity-wifi up - Network unavailable [FAIL]
After wrestling with the problem of iwlist scan, I've encountered another one. It seems that wpa_supplicant works properly only in clean conditions (right after inserting the ipw3945 module). If, for any reason (like my auto-associating problem) the interface is already associated to an AP, wpa_supplicant fails to set the ESSID correctly. It needs to be done manually.
My patch is sourced beneath. It shouldn't bork up other wireless cards, but it fixes the above problems with ipw3945.
--- wireless.subr 2007-09-02 01:47:45.000000000 +0200
+++ wireless.subr.new 2007-09-02 12:34:05.000000000 +0200
@@ -9,7 +9,7 @@
[ -z $TIMEOUT ] && TIMEOUT=15
let timeout=0
while [ $timeout -ne $TIMEOUT ]; do
- eval `wpa_cli status|grep wpa_state`
+ eval `wpa_cli status|grep wpa_state`
[ "$wpa_state" = "COMPLETED" ] && return 0
sleep 1
let timeout++
@@ -26,7 +26,7 @@
{
INTERFACE=$1; TIMEOUT=$2
- [ -z $TIMEOUT ] && TIMEOUT=15
+ [ -z $TIMEOUT ] && TIMEOUT=30
let timeout=0
while [ $timeout -ne $TIMEOUT ]; do
bssid=`iwgetid $INTERFACE -ra`
@@ -43,12 +43,16 @@
# find_essid interface essid
find_essid()
{
- INTERFACE=$1; ESSID=$2
-
- if ! iwlist $INTERFACE scan|sed "s/ESSID://g"|grep -q "\"$ESSID\""; then
- # Network not found
- return 1
- fi
+ INTERFACE=$1; ESSID=$2; RETRIES=4
+ try=0;
+ while [ $try -ne $RETRIES ]; do
+ if iwlist $INTERFACE scan|sed "s/ESSID://g"|grep -q "\"$ESSID\""; then
+ return 0 # network found
+ fi
+ sleep 0.5
+ let try++
+ done
+ return 1
}
start_wpa()
@@ -80,6 +84,8 @@
# Required by atheros to enable device
ifconfig $INTERFACE up
+ # Required by ipw3945 to properly re-associate
+ iwconfig $INTERFACE mode managed essid $ESSID
# Kill any lingering wpa_supplicants.
if [ -f /var/run/wpa_supplicant_$INTERFACE.pid ]; then
@@ -157,6 +163,7 @@
fi
wpa_cli terminate &> /dev/null
iwconfig $INTERFACE essid off key off &> /dev/null
+ ifconfig $INTERFACE down
}
wireless_clean_scope() {
Offline
Sorry to double post, but this is a completely different topic, so I guess it's justified.
I've worked on the auto-wifi command for netcfg2 today and I think I've come with a working solution.
Features:
- multiple iwlist scan calls, so that no APs will be left behind
- takes advantage of iwlist scan's ordering so that the best-signal APs will be prefered
- matches each found AP on the given interface against the profile database
- automatically connects to the detected profile
- debug mode (on until properly tested)
Possible shortcommings:
- not tested on cards other than ipw3945
- doesn't support APs with hidden essids (how on earth could one auto-detect them?)
- doesn't support Aps with spaces in their essids (is it allowed at all?)
Now, it works for me (TM), but I'm sure it requires testing. I've always missed this relatively simple, yet powerful, feature in netcfg. Two patches follow:
--- network.subr 2007-09-02 01:47:45.000000000 +0200
+++ network.subr.new 2007-09-02 13:51:32.000000000 +0200
@@ -40,6 +40,40 @@
### Profile up/down
##
+# wifi_auto
+# autoconnect wireless interface
+# $1 - wireless interface
+wifi_auto()
+{
+ IFACE=$1; RETRIES=6; DEBUG=1
+ BEST=0; ESSIDS=''; PROFILE=''
+ let try 0;
+ while [[ $try -ne $RETRIES ]]; do
+ essid=`iwlist $IFACE scan | grep ESSID | sed 's/.*ESSID:"\([^"]\+\)".*/\1/'`
+ cur=`echo $essid | wc -w`
+ [[ DEBUG -gt 0 ]] && echo "Try: $timeout Found: "$essid
+ if [[ $cur -ge $BEST ]]; then
+ BEST=$cur
+ ESSIDS=$essid
+ fi
+ sleep 0.5
+ let try++
+ done
+ [[ $DEBUG -gt 0 ]] && echo "Found $BEST APs"
+ for ap in $ESSIDS; do
+ profile=`grep -l -P -e "CONNECTION=\"?wireless\"?(\n|.)*INTERFACE=\"?$IFACE\"?(\n|.)*ESSID=\"?$ap\"?" $PROFILE_DIR/* | head -n 1`
+ if [[ -n $profile && -z $PROFILE ]]; then
+ PROFILE=$(basename $profile)
+ fi;
+ [[ $DEBUG -gt 0 ]] && echo "AP: $ap profile: $profile"
+ done;
+ if [[ -n $PROFILE ]]; then
+ profile_up $PROFILE
+ else
+ err "Found $BEST APs. No matching profiles found."
+ fi;
+}
+
# all_down
# take all profiles down
#
--- netcfg 2007-09-02 01:47:45.000000000 +0200
+++ netcfg2.new 2007-09-02 13:51:03.000000000 +0200
@@ -29,8 +29,9 @@
echo "-d, down Take specified profile down"
echo "-a, all-down Take all active profiles down"
echo "-i, iface-down Take down profile active on specified interface"
- echo " all-resume Resume previously suspended profiles and reconnect them"
- echo " all-suspend Store a list of current running profiles and suspend them"
+ echo "all-resume Resume previously suspended profiles and reconnect them"
+ echo "all-suspend Store a list of current running profiles and suspend them"
+ echo "auto-wifi <iface> Perform wifi autoconnect on interface <iface>"
echo "-h, --help This message"
echo "-v, --version Output version information and exit"
}
@@ -64,6 +65,8 @@
all_resume;;
all-suspend)
all_suspend;;
+ auto-wifi)
+ wifi_auto $2;;
-*|--*)
usage;;
*)
Last edited by Neuro (2007-09-02 12:03:53)
Offline
how can i apply these patches?
or please add the patches and release a new package!
great work, tested it, but i definitely need auto-connect! since today i had my own script - now using autowifi and want to switch to netcfg2!!!!
[EDIT:] done it! test it, works great - but: at my university i have to login with wpa-eap, no pre shared key. the wpa_supplicant entry looks like this:
network={
ssid="802.1X"
key_mgmt=WPA-EAP
eap=TTLS
proto=WPA
phase2="auth=PAP"
identity="username"
password="password"
}
how can i realize that with the new profiles?
setting a profile like the wpa.example does not work!
[EDIT 2:] ok, found out, that the value SECURITY="wpa-config" forces the script to use the own-configured config. nice scripts - very nice! good work!!!
SYSTEM_INFO: iwl3945
mfg
iggy
Last edited by iggy (2007-09-12 02:45:56)
sorry for my bad english
Offline
Hey, nice work so far. Is there a way to set a default profile as with the old version? Symlinking a profile to "main doesn't seem to do the trick anymore.
Thanks!
Offline
iggy: have you tried my auto connection patches? Do they work for you? I see that you've got the same wifi card (ipw3945).
Has anyone with a different card tried my auto connection patches?
Michal
Offline
hey hello!
after long tests i can say, the auto connect patch works great. but i have sometimes problems, that firefox or eclipse, ... can't connect to the network. netcfg2 says [DONE].
sorry for my bad english
Offline
Is this still actively in development? I can't seem to find it in testing just at the source link. Curious if this is still being maintained and tested or what..
Last edited by shen (2007-10-22 02:19:36)
Offline
Maintained. I've been awfully busy with life the last few months, but I'll be pushing this as far as it'll go in the coming weeks.
Next release (possibly tonight):
- Add neuro's patches
- Convert from dhcpcd -> dhclient
- Add support for a menu 'default' option
- Fix typo in complete example IFOPTS -> IP
Neuro: Sorry for long delay, for the TIMEOUT fix, you can set that in the config file. The default in the script is a reasonable one that suffices in most cases. As for your auto option, I reckon that'd be better split out into netcfg-auto, as I can see that growing a bit and I want to keep netcfg and it's core really lean.
James
Last edited by iphitus (2007-10-28 10:42:28)
Offline
Hey iphitus,
good to have you back What about my request (see above)? Is there already a way to accomplish this? Otherwise, could you put it in? Or would you rather want me to submit a patch?
Best wishes and thanks for your work!
Moritz
Offline
Sure, I'll look at that too. Shouldn't be much work so don't worry about the patch.
iggy: Some of that's due to dhcpcd... it'll be out soon.
Moritz: I'll have to spend a bit of time lookin at that default option, its all there but obviously doesn't work...
Last edited by iphitus (2007-10-28 10:29:37)
Offline
ok....
0.99.29: Changelog:
- Add neuro's ipw3945 patches
- Fixed iggy's issue by adding an extra argument to dhcpcd
- Fixed the menu in general
- Fixed the menu looking for 'main' -- it was ignoring symlinks
- Fixed typo in the complete exaple
Neuro: If you don't do it before me, I'll separate out your automatic connection into another script and include that in the next tarball.
James
Offline
Just out of curiousity, how does netcfg2 fit in relative to network-manager? It looks like an alternative, or does it actually use network-manager utilities internally? Does it cover the same sort of stuff as n-m (minus tray applets and whatnot)? n-m doesn't work properly for me, so I'd be interested in trying this out; before I move my configs and such to using this, however, I'd sort of like to know how it fits into the bigger picture.
-nogoma
---
Code Happy, Code Ruby!
http://www.last.fm/user/nogoma/
Offline
Thanks a lot James, I'll install the new version right now
Offline
works great here too at iwl4965.
one tiny detail..
--- netcfg.old 2007-11-01 14:08:27.000000000 +0100
+++ netcfg 2007-11-01 14:07:54.000000000 +0100
@@ -5,7 +5,7 @@
. /usr/lib/network/network.subr
err() {
- stat_append " - $*"
+ stat_append " - $*\n"
}
NETCFG_VER=1.99.29
Last edited by cybe-arch (2007-11-01 13:20:33)
Offline
1.99.30 is now available with two minor fixes and a tidied PKGBUILD.
I've added a testing section to the wiki, so let me know how netcfg2 works on your wireless hardware:
http://wiki.archlinux.org/index.php/Net … ts#Testing
cybe-arch: Thanks for the feeback and patch, though that'll break stat_append and force the [DONE] onto the next line. What was the problem originally?
Offline