#716 wrong ifonfig using

open
Volker
Interface (97)
5
2012-10-28
2009-11-12
No

in FreeBSD ifconfig cannot setup and configure interface with some extra parameters
example: ifconfig xl0 inet 192.168.1.1/24 ether aa:bb:cc:dd:..... will lead to error
correct way:
ifconfig xl0 inet 192.168.1.1/24
in rc.conf
AND additional interface configure in
/etc/start_if.xl0
ifconfig xl0 ether ether aa:bb:cc:dd:.....

patch:
--- newsvn/etc/rc.d/rcconf.sh.orig 2009-11-12 17:10:55.000000000 +0000
+++ newsvn/etc/rc.d/rcconf.sh 2009-11-02 16:32:19.000000000 +0000
@@ -72,7 +72,6 @@
-i "wakeon[. = 'off']" -o " -wol " -b \ -i "count(polling) > 0" -o " polling" -b \ -i "string-length(mtu) > 0" -v "concat(' mtu ',mtu)" -b \ - -i "string-length(extraoptions) > 0" -v "concat(' ',extraoptions)" -b \ -m "wireless" \ -v "concat(' ssid ',ssid,' channel ',channel)" \ -i "string-length(standard) > 0" -v "concat(' mode ',standard)" -b \ @@ -98,10 +97,22 @@
-b \ ${configxml_file} | /usr/local/bin/xml unesc`

  • _ifconfig_extra_options=`/usr/local/bin/xml sel -t -m "//interfaces/lan" \
  • -i "string-length(extraoptions) > 0" -v "concat(' ',extraoptions)" -b \
  • ${configxml_file} | /usr/local/bin/xml unesc`
    +
    +
    if [ -n "${_ifconfig_args}" ]; then
    eval /usr/local/sbin/rconf attribute set "ifconfig_${_ifn}" "${_ifconfig_args}"
    fi

  • if [ -n "${_ifconfig_extra_options}" ]; then

  • /usr/bin/printf "ifconfig ${_ifn} ${_ifconfig_extra_options}\n" > /etc/start_if.${_ifn}
  • else
  • /bin/rm -f /etc/start_if.${_ifn}
  • fi
    +
    +
    # Set gateway.
    _ipaddr=configxml_get "//interfaces/lan/ipaddr"
    _gateway=configxml_get "//interfaces/lan/gateway"
    @@ -123,7 +134,6 @@
    -i "wakeon[. = 'off']" -o " -wol " -b \ -i "count(polling) > 0" -o " polling" -b \ -i "string-length(mtu) > 0" -v "concat(' mtu ',mtu)" -b \
  • -i "string-length(extraoptions) > 0" -v "concat(' ',extraoptions)" -b \ -m "wireless" \ -v "concat(' ssid ',ssid,' channel ',channel)" \ -i "string-length(standard) > 0" -v "concat(' mode ',standard)" -b \ @@ -149,11 +159,23 @@
    -b \ ${configxml_file} | /usr/local/bin/xml unesc`

  • _ifconfig_extra_options=`/usr/local/bin/xml sel -t -m "//interfaces/*[name() = 'opt${_id}']" \

  • -i "string-length(extraoptions) > 0" -v "concat(' ',extraoptions)" -b \
  • ${configxml_file} | /usr/local/bin/xml unesc`
    +
    if [ -n "${_ifconfig_args}" ]; then
    eval /usr/local/sbin/rconf attribute set "ifconfig_${_ifn}" "${_ifconfig_args}"
    fi
    +
  • if [ -n "${_ifconfig_extra_options}" ]; then
  • /usr/bin/printf "ifconfig ${_ifn} ${_ifconfig_extra_options}\n" > /etc/start_if.${_ifn}
  • else
  • /bin/rm -f /etc/start_if.${_ifn}
  • fi
    +
    else
    eval /usr/local/sbin/rconf attribute remove "ifconfig_${_ifn}"
  • /bin/rm -f /etc/start_if.${_ifn}
    fi

            _id=$(( ${_id} - 1 ))
    

Discussion

  • Volker

    Volker - 2009-11-12

    Is this patch for 0.7 or trunk (0.8)?

     
  • Volker

    Volker - 2009-11-13

    This is for 0.8 (FreeBSD 8.0) but will be switched to Linux very soon.

     
  • Alexandr Miasnikov

    uname -r

    7.2-RELEASE

    ifconfig em0 inet 10.7.12.30/24 ether 08:00:27:ee:86:3e

    ifconfig: ether: bad value

    ifconfig em0 inet 10.7.12.30/24

    grep start_if /etc/network.subr

        if [ -r /etc/start_if.$1 ]; then
                . /etc/start_if.$1
    

    I think this is a patch for 0.7 too.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks