[klibc] problems with ipconfig command (static config without interface configures "lo")

H. Peter Anvin hpa at zytor.com
Tue Aug 31 19:42:17 PDT 2004


Olaf Hering wrote:
> 
> Another bug is the required PROTO in ipconfig. Why does it default to
> dhcp?
> 

Seems like the obvious default when autoconfiguring (same as the kernel 
would use without an ip= option.)

> static unsigned int default_caps = CAP_DHCP | CAP_BOOTP | CAP_RARP;
> 
> 
> this should be enough to get the interface up:
> ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>

Indeed, which is why PXELINUX uses that particular form

> not 'ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:::none' like it is
> now. Even 'ip=<client-ip>' should be enough, but parse_device() would
> not like it:
> 
>         if (strchr(ip, ':') == NULL) {
>                 dev->name = ip;
>                 goto done;
>         }
> 
> how about this patch?
> It should fix 'ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>'

Looks good to me.  Feel a bit silly about the obviously reversed test... :^)

> diff -purNx linux klibc1.170/ipconfig/main.c klibc-0.170.ipconfig/ipconfig/main.c
> --- klibc-0.170/ipconfig/main.c 2004-08-19 18:19:42.000000000 +0200
> +++ klibc-0.170.ipconfig/ipconfig/main.c        2004-08-31 20:32:57.945353784 +0200
> @@ -474,6 +474,7 @@ static int parse_device(struct netdev *d
>                 switch (opt) {
>                 case 0:
>                         parse_addr(&dev->ip_addr, ip);
> +                       dev->caps = 0;
>                         break;
>                 case 1:
>                         parse_addr(&dev->ip_server, ip);
> @@ -612,10 +613,11 @@ static int add_all_devices(struct netdev
>                    logic the in-kernel ipconfig uses... */
>                 if ( !(flags & IFF_LOOPBACK) &&
>                      (flags & (IFF_BROADCAST|IFF_POINTOPOINT)) )
> -                       continue;
> +               {
>                 if ((dev = add_device(de->d_name)) == NULL)
>                         continue;
>                 bringup_one_dev(template, dev);
> +               }
>         }
>         closedir(d);
>         return 1;
> 



More information about the klibc mailing list