PATCH: ifupdown.c, udhcpc, and standalone shell

Denis Vlasenko vda.linux at googlemail.com
Thu Sep 28 22:27:19 UTC 2006


On Thursday 28 September 2006 18:34, Gabriel L. Somlo wrote:
> Here's my proposal:
> 
> static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
> {
>     int i;
> 
>     for (i = 0; i < ifd->n_options; i++) {
>         if (strcmp(ifd->option[i].name, "dhcp-start-cmd") == 0) {
>             return execute(ifd->option[i].value, ifd, exec);
>         }
>     }
> 
>     /* old calls for "blessed" clients may or may not go here for
>        backward compatibility */
> 
>     return 0;
> }
> 
> static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
> {
>     int i;
> 
>     for (i = 0; i < ifd->n_options; i++) {
>         if (strcmp(ifd->option[i].name, "dhcp-stop-cmd") == 0) {
>             return execute(ifd->option[i].value, ifd, exec);
>         }
>     }
> 
>     /* old calls for "blessed" clients may or may not go here for
>        backward compatibility */
> 
>     return static_down(ifd, exec);
> }
> 
> My /etc/network/interfaces file looks like this:
> 
> auto lo
> iface lo inet loopback
> 
> auto eth0
> iface eth0 inet dhcp
>   dhcp-start-cmd udhcpc -s /etc/network/udhcpc.script -n -p /var/run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] [[-c %clientid%]]
>   dhcp-stop-cmd kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null ; sleep 2 ; kill -TERM `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null
> 
> This also solves my other problem (that I hate having udhcpc look for
> its script in /usr/share/udhcpc/default.script). Now I can simply pass
> '-s path/to/script' in /etc/network/interfaces...
> 
> The old 'Let's all go down the list of blessed clients' code may or
> may not be included for backward compatibility...
> 
> I've attached my version of ifupdown.c.gz, check it out and let me
> know if it's palatable :)

Applied.
--
vda



More information about the busybox mailing list