NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/39937: rc.d/network per interface flags enhancement for dhcpcd



>Number:         39937
>Category:       bin
>Synopsis:       rc.d/network per interface flags enhancement for dhcpcd
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 17 00:05:00 +0000 2008
>Originator:     Robert Elz
>Release:        NetBSD current
>Organization:
        Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 4.0_STABLE NetBSD 4.0_STABLE 
(JADE-1.696-20080517) #9: Fri May 23 18:55:13 ICT 2008 
kre%jade.coe.psu.ac.th@localhost:/usr/obj/4/kernels/JADE i386
Architecture: i386
Machine: i386
>Description:
        There is no way to set different options for dhcpcd for
        different interfaces.

>How-To-Repeat:
        By inspection.

>Fix:
        Apply one of the following two patches - not both, they're
        not cumulative.   Alternatively do something similar in a
        different way.

        The first patch allows the variable dhcpcd_flags_$int
        (for any relevant value of $int) to be set in rc.conf
        and uses that (if set) instead of dhcpdc_flags.
        (It can of course be set as ...
                dhcpcd_flags_ex0="$dhcpdc_flags -b"
        or something if the objective is to have mostly common
        flags but just add something).

        Note that there is (very deliberately) no ':' before the '-'
        in the expansion of ${dhcpcd_flags_$int} - $dhcpcd_flags is only
        to be used if ${dhcpcd_flags_$int} not if it is set but empty.
        That allows
                dhcpcd_flags_ex0=""
        to override the default $dhcpcd_flags setting.

--- network.original    2008-11-17 06:36:29.000000000 +0700
+++ network.simplemod   2008-11-17 06:36:33.000000000 +0700
@@ -266,7 +266,7 @@
                                        ( eval "${args#*!}" )
                                        ;;
                                dhcp)
-                                       /sbin/dhcpcd -n ${dhcpcd_flags} $int
+                                       eval /sbin/dhcpcd -n 
\${dhcpcd_flags_$int-\${dhcpcd_flags}} \$int
                                        ;;
                                *)
                                        # Pass args to ifconfig.  Note


        The second patch has the same change, but also allows flags to
        be set in /etc/ifconfig.$int on the end of the "dhcp" magic line
        that causes dhcpcd to be invoked (the same should be true of the
        rc.conf variable that can be used instead, but I haven't tested
        that variation - I can't see how it would be any different though).

        That is, with this patch, ifconfig.ex0 could contain
                dhcp ${dhcpcd_flags} -b
        or something like that (I haven't tested with "${dhcpcd_flags}"
        in there, but I think it should work).

--- network.original    2008-11-17 06:36:29.000000000 +0700
+++ network.biggermod   2008-11-17 06:38:28.000000000 +0700
@@ -266,7 +266,14 @@
                                        ( eval "${args#*!}" )
                                        ;;
                                dhcp)
-                                       /sbin/dhcpcd -n ${dhcpcd_flags} $int
+                                       eval /sbin/dhcpcd -n 
\${dhcpcd_flags_$int-\${dhcpcd_flags}} \$int
+                                       ;;
+                               dhcp*)
+                                       (
+                                               set -o noglob
+                                               eval set -- ${args#dhcp}
+                                               /sbin/dhcpcd -n "$@" $int
+                                       )
                                        ;;
                                *)
                                        # Pass args to ifconfig.  Note



Home | Main Index | Thread Index | Old Index