You are not logged in.

#1 2005-03-12 12:44:56

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

rc.d/network - a few tweaks for verbosity and wifi

Wireless
I've been working on improving support for wireless stuff - i looked at the stuff that phrakture has put togther and at the normal set up, I also looked at the pcmcia-cs scripts

I've set up a way of using "schemes" to configure your wireless card, using a case statement in the conf.d/wireless file, which i borrowed from the pcmcia-cs scripts.

I've also set up how the interfaces are defined/listed in two ways - in the first they are just listed in conf.d/wireless, as they are now - in the second they are listed in the INTERFACES array in rc.conf but prefixed with @

Anyway, check them ou

Verbose StartUp
The way that network works as a daemon is crap - if one interface up fails the whole daemon fails and the interfaces that did go up can then not be bought down with network stop, plus you don't know which interface failed.

I made a patch that makes start up more verbose, telling you which devices went up and which didn't.  Now the daemon still gets started if one fails (but you can see which one) and will only fail if all the interfaces fail to be bought up.

Try it.

Files are here: http://dtw.jiwe.org/share/wireless/ (See below)

Offline

#2 2005-03-12 12:53:48

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

I should also note my scripts also support the renaming of interfaces with mactab at startup

question

why doesn't rc.conf tell you to looking in conf.d for dhcp and wireless settings?

Offline

#3 2005-03-13 12:16:04

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

i updated the patches for the latest initscripts:

http://dtw.jiwe.org/share/wireless/late … s_patches/

· net contains the verbose patch
· wifi contains the patches for both wireless implementations + corresponding conf.d files
· both contains a patch which implements the more simple wireless approach and the verbose net settings

Offline

#4 2005-03-21 09:05:12

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

updated again - all the old patches have been deleted

http://dtw.jiwe.org/share/wireless/

I have also added a new patch the verbose stuff for functions - this adds stat_warn () - which warns you that the daemon may have failed to start some interfaces - i figure it could be used in all daemons for warnings.

· net contains the verbose patches
· wifi contains the patches for both wireless implementations + corresponding conf.d files - you need the -alt files for the @ method
· both contains a patches that implement both interface defining mechs (again the -alt- is the @ version) AND have support for the verbose startup

There are some screenies too:

Simple
Several commands

Offline

#5 2005-03-21 14:34:32

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: rc.d/network - a few tweaks for verbosity and wifi

I won't test nor use it, as I have only one, genuine (read: non-wifi) network card, what makes those patches pretty useless for me, but nevertheless it seems you're doing a good job, dibble. As always :-) Keep it up.

Offline

#6 2005-03-30 07:33:45

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

anyone else?  if this is a crap idea at least say it is will you!

Offline

#7 2005-03-30 17:02:49

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

i've been debating removing my wireless scripts from the wiki - due to the implementation in the network script... but I have to think hard about it...

Offline

#8 2005-03-31 05:52:19

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

but the current support in the network script is crap!

Offline

#9 2005-03-31 16:08:58

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

I agree... *sigh*

Offline

#10 2005-04-01 08:40:05

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

i posted a feature request that linked to this thread with the hope of getting some useful changes made to the script - what do you thin of the case system for the schemes

Offline

#11 2005-04-01 16:13:24

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

i dunno if I agree with it that much... it works, but I'd still rather have each scheme be it's own file... instead of one file for everything... *shrug* not that it matters, either way is fine

but I seriously doubt anyone will do anything about it - I've thrown stuff out on the mailing list about the wireless stuff, and no one cares...

Offline

#12 2005-04-01 16:59:39

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: rc.d/network - a few tweaks for verbosity and wifi

Sorry, I'd love to test it, but I only have wlan @ university. Even if I go there, it wouldn't be of much help, since all I have to do is ask for an IP, and this is already supported. The 'difficult' part is setting up a vpnc connection, but that has nothing to do with the networking init-scripts.

Offline

#13 2005-04-01 18:20:35

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

LB06 wrote:

Sorry, I'd love to test it, but I only have wlan @ university. Even if I go there, it wouldn't be of much help, since all I have to do is ask for an IP, and this is already supported. The 'difficult' part is setting up a vpnc connection, but that has nothing to do with the networking init-scripts.

yeah, but what dibble and I have a problem with, is if you have multiple places you use wireless... let's assume you had a wireless router at home - when you got home from school, and turned on your computer, you'd have to edit the /etc/conf.d/wireless file and change the essid to match your home... then change it when you got back to school...

both of us have proposed mechanisms to handle this... though we each implement it slightly differently, the idea is the same... that you can configure a "home" and "school" setup and just tell the wireless scripts to "connect to school" and "connect to home" depending on where you are.....

I'm going to look into modifying my scripts to work in conjunction with the existing functionality... I have some ideas....

Offline

#14 2005-04-02 04:11:07

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

cool smile

Offline

#15 2005-04-03 10:53:16

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

phrak - basically the biggest change i would advocate is a proper wifup function - as we have both proposed.  trying to treat wifi interfaces and other interfaces as the same is just daft.

also, seeing as wifi is going to become more popular i can't see how it can avoided!

Offline

#16 2005-04-03 22:09:32

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,964
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

I just found this thread; after I had posted something similar on the mailinglist. So we are sure: the way arch handels wireless connections is not optimal. Here are my mails:

Hello,

what about an official support for wireless-cards in archlinux? There are
scripts in the wiki for managing different wireless-connections[1]. This
might be a good startingpoint. But we should extend it with WPA-encryption
and perhaps customizable scripts which start a vpn-client when connected to a
certain net.

A clear integration in current init-scripts and rc.conf should be done. We
also need a package for ndiswrapper and wpa_supplicant.

I modified the scripts and added wpa; but I have no experience in
bash-scripting. So what might be the best way for integrating wireless into
arch?

Pierre

[1]http://wiki2.archlinux.org/index.php/Wireless setup

I have modified the script from the wiki a bit. Now each profile has its own
directory. There you have a file named config which is the one described in
the wiki.

If you put a file called wpa in there, it is used as config-file for
wpa_supplicant. In addition to this you can put scripts called
connected/disconnected in the profile-directory. These are executed by the
wireless-script after dis-/connected to a net.

I you these files for dis-/connecting to a vpn. I think this is very
comfortable.

And here is the modified script:

# !/bin/sh
# ArchLinux Wireless Initialization [http://www.archlinux.org]
# - Aaron Griffin (phrakture) -

. /etc/rc.conf
. /etc/rc.d/functions

# wireless_up <profile_name>
wireless_up()
{
  if [ ! -f /etc/conf.d/wireless-profiles/${1}/config ]; then
    echo "Profile [$1] NOT found!"
    return 1
  fi

  . /etc/conf.d/wireless-profiles/${1}/config
  if [ ! -n "$INTERFACE" ]; then
    echo "Profile [$1] has no interface defined!"
    return 1
  elif [ -f /etc/dhcpc/dhcpcd-${INTERFACE}.pid ]; then
    echo "Interface $INTERFACE already active"
    return 1
  fi

  if [ -n "$INFO" ]; then
    stat_busy "Loading Wireless Profile [$INFO] on $INTERFACE"
  else
    stat_busy "Loading Wireless Profile [$1] on $INTERFACE"
  fi

  if [ -n "$ESSID" ]; then
    /usr/sbin/iwconfig $INTERFACE essid $ESSID
  fi

  if [ -n "$MODE" ]; then
    /usr/sbin/iwconfig $INTERFACE mode $MODE
  fi

  if [ -n "$NWID" ]; then
    /usr/sbin/iwconfig $INTERFACE nwid $NWID
  fi

  if [ -n "$FREQ" ]; then
    /usr/sbin/iwconfig $INTERFACE freq $FREQ
  elif [ -n "$CHANNEL" ]; then
    /usr/sbin/iwconfig $INTERFACE channel $CHANNEL
  fi

  if [ -n "$KEY" ]; then
    /usr/sbin/iwconfig $INTERFACE key $KEY
  fi

  if [ -n "$SENS" ]; then
    /usr/sbin/iwconfig $INTERFACE sens $SENS
  fi

  if [ -n "$RATE" ] ; then
    /usr/sbin/iwconfig $INTERFACE rate $RATE
  fi

  if [ -n "$RTS" ]; then
    /usr/sbin/iwconfig $INTERFACE rts $RTS
  fi

  if [ -n "$FRAG" ]; then
    /usr/sbin/iwconfig $INTERFACE frag $FRAG
  fi

  if [ -n "$PARAMS" ]; then
    /usr/sbin/iwconfig $INTERFACE $PARAMS
  fi

  /sbin/ifconfig $INTERFACE up
#PS
  if [ -f /etc/conf.d/wireless-profiles/${1}/wpa ]; then
    /usr/bin/wpa_supplicant -wB -i$INTERFACE -c/etc/conf.d/wireless-profiles/${1}/wpa
    sleep 10 #I don't know how
  fi
#/PS
  if [ "$IFOPTS" = "dhcp" ]; then
    rm -f /etc/dhcpc/dhcpcd-${INTERFACE}.{pid,cache} >/dev/null 2>&1
    /usr/sbin/dhcpcd -t 10 -h $HOSTNAME $INTERFACE
  else
    /sbin/ifconfig $IFOPTS
  fi
#PS
  if [ -x /etc/conf.d/wireless-profiles/${1}/connected ]; then
   /etc/conf.d/wireless-profiles/${1}/connected
  fi
#/PS
  return $?
}

# wireless_down <profile_name>
wireless_down()
{
  if [ ! -f /etc/conf.d/wireless-profiles/${1}/config ]; then
    echo "Profile [$1] NOT found!"
    return 1
  fi

  . /etc/conf.d/wireless-profiles/${1}/config

  if [ -n "$INFO" ]; then
    stat_busy "Stopping Wireless Profile [$INFO] on $INTERFACE"
  else
    stat_busy "Stopping Wireless Profile [$1] on $INTERFACE"
  fi

#PS
  if [ -f /etc/conf.d/wireless-profiles/${1}/wpa ]; then
    killall wpa_supplicant
  fi
#/PS

  if [ "$IFOPTS" = "dhcp" ]; then
    if [ -f /etc/dhcpc/dhcpcd-${INTERFACE}.pid ]; then
      /bin/kill `cat /etc/dhcpc/dhcpcd-${INTERFACE}.pid`
    fi
  fi

  /sbin/ifconfig $INTERFACE down
#PS
  if [ -x /etc/conf.d/wireless-profiles/${1}/disconnected ]; then
   /etc/conf.d/wireless-profiles/${1}/disconnected
  fi
#/PS
  return $?
}

case "$1" in
  start)
    for profile in ${WIRELESS_PROFILES[@]}; do
      if ! ck_daemon wireless_${profile}; then
        echo "Profile [$profile] is already up"
      else
        wireless_up $profile
        if [ $? -eq 0 ]; then
          add_daemon wireless_${profile}
          stat_done
        else
          stat_fail
        fi
      fi
    done
    ;;
  stop)
    for profile in ${WIRELESS_PROFILES[@]}; do
      if ck_daemon wireless_${profile}; then
        echo "Profile [$profile] is not up"
      else
        rm_daemon wireless_${profile}
        wireless_down $profile
        if [ $? -eq 0 ]; then
          stat_done
        else
          stat_fail
        fi
      fi
    done
    ;;
  restart)
    $0 stop
    sleep 2
    $0 start
    ;;
  profile)
    if [ "$3" = "up" ]; then
      if ! ck_daemon wireless_${2}; then
        echo "Profile [$2] is already up"
      else
        wireless_up $2
        if [ $? -eq 0 ]; then
          add_daemon wireless_${2}
          stat_done
        else
          stat_fail
        fi
      fi
    elif [ "$3" = "down" ]; then
      if ck_daemon wireless_${2}; then
        echo "Profile [$2] is not running"
      else
        wireless_down $2
        if [ $? -eq 0 ]; then
          rm_daemon wireless_${2}
          stat_done
        else
          stat_fail
        fi
      fi
    fi
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
    echo "usage: $0 profile <profile_name> {up|down}"
    ;;
esac

Offline

#17 2005-04-04 06:08:09

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

cool, hopefully this will snowball soon and the dev can decided the best way to implement this big_smile

Offline

#18 2005-04-04 06:11:50

miqorz
Member
Registered: 2004-12-31
Posts: 475

Re: rc.d/network - a few tweaks for verbosity and wifi

Hmm, this is interesting. I may consider going wireless soon now.


http://wiki2.archlinux.org/

Read it. Love it. Live it. Or die.

Offline

#19 2005-04-04 15:16:37

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

miqorz wrote:

Hmm, this is interesting. I may consider going wireless soon now.

yeah check the wiki page... not much has been added since I wrote it... and there's alot of "forthcoming" stuff.... someone added how to compile madwifi from cvs though... *shrug*

Offline

#20 2005-04-04 15:47:46

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,964
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

OK I see, we have at leest 3 or 4 different solutions for wireless-setup; and the one within the default network-scripts is nerly useless. ;-)

Offline

#21 2005-04-04 16:05:22

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

Pierre wrote:

OK I see, we have at leest 3 or 4 different solutions for wireless-setup; and the one within the default network-scripts is nerly useless. ;-)

naw, the default one works fine if you use your wireless connection in a similar manner as a wired connection (sitting at home, one essid) - I have a feeling judd doesn't use his wireless connection all that much (me, having a g connection @94mbps, it's almost worthless to use eth  lol )

so, don't get frustrated... let's be constructive and see what we can do to make the default better.

Offline

#22 2005-04-04 18:47:44

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,964
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

OK, perhaps we will have a more flexible solution for that. I have just mande some changes to the scripts and uploaded to http://files.laber-land.de/archlinux

Aaron Griffin gave me some tips for that on the mailinglist.

PS: You should not use these scripts ;-)

Offline

#23 2005-04-04 18:57:42

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

Pierre wrote:

Aaron Griffin gave me some tips for that on the mailinglist.

that's me 8)

Offline

#24 2005-04-04 19:32:52

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,964
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

OK, it`s confusing me if you are using different names in forum and ml ;-)

Offline

#25 2005-04-06 03:02:36

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: rc.d/network - a few tweaks for verbosity and wifi

LOL - that's a belter!

Phrak - i felt the one file for profiles using the case statement was more "the arch way", plus it makes it easier to edit.

And, yeah, i get the feeling the dev team don't do loads of wireless roaming

Offline

Board footer

Powered by FluxBB