Project

General

Profile

Actions

Bug #929

closed

Prevent network.subr from trashing certain ifconfig(8) arguments

Added by frank almost 17 years ago. Updated almost 17 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

For a 802.11 wireless interface, say ral0, it is admissible to supply

ifconfig ral0 [<other options>] authmode wpa

on the command line. On the other hand, correspondingly setting

ifconfig_ral0="[<other options>] authmode wpa"

in /etc/rc.conf should not be done, because /etc/network.subr strips all
occurrences of "wpa" from the argument list and takes it as an invitation
to call wpa_supplicant. This is for sure not an enormous problem for most
users, but a sort of inconsistency which as well could easily be avoided.
In case this looks worth to be fixed, there is a patch below to propose a
strategy how this can be accomplished.

Oh course, this issue exists likewise for FreeBSD, but I didn't look into
the details. So it's posted here; this one was more seriously tested.

Regards,
Frank Josellis

--- patch begins here ---
--- etc/network.subr.orig 2007-07-11 00:36:01.000000000 0200
++ etc/network.subr 2008-01-25 11:22:01.000000000 +0100
@ -136,16 +136,27 @
fi
_args=

+ is_optarg=no
for _arg in $_tmpargs; do
- case $_arg in
- [Dd][Hh][Cc][Pp])
- ;;
- [Ww][Pp][Aa])
- ;;
- *)
+ if [ "$is_optarg" = "no" ]; then
+ case $_arg in
+ [Dd][Hh][Cc][Pp])
+ ;;
+ [Ww][Pp][Aa])
+ ;;
+ *)
+ _args="$_args $_arg"
+ case $_arg in
+ authmode)
+ is_optarg=yes
+ ;;
+ esac
+ ;;
+ esac
+ else
_args="$_args $_arg"
- ;;
- esac
+ is_optarg=no
+ fi
done

echo $_args
@ -171,12 +182,20 @
wpaif() {
_tmpargs=`_ifconfig_getargs $1`
+ is_optarg=no
for _arg in $_tmpargs; do
- case $_arg in
- [Ww][Pp][Aa])
- return 0
- ;;
- esac
+ if [ "$is_optarg" = "no" ]; then
+ case $_arg in
+ [Ww][Pp][Aa])
+ return 0
+ ;;
+ authmode)
+ is_optarg=yes
+ ;;
+ esac
+ else
+ is_optarg=no
+ fi
done
return 1
}
--- patch ends here ---
Actions

Also available in: Atom PDF