On Sat, Dec 02, 2000 at 12:31:27PM -0600, Daniel E Baumann wrote:
> I have writen the function to create an iface startuct in PPP using several 
> SIOC* ioctl glibc calls. This is the first time I've used this so I am 
> posting it for inspection, comments and all that.

>   struct ifreq *ifr;

You don't need to dynamically allocate this. Just define it as

struct ifreq ifr;

and set

strncpy (ifr.name, name, IFNAMSIZ);

etc

This way, the program flow is a bit simpler, too.

>   ioctl(s, SIOCGIFFLAGS, &ifr);

We have this, but ifr isn't initialized yet! You need to set the name.
Also, the second argument is a struct ifreq **, while you need a struct
ifreq *. But if you change ifr as above, the code gets correct again :)

>   flags = ifr->ifr_flags;
> 
>   iface->flags = flags; 

What about

iface->flags = ifr.ifr_flags;

and drop flags?

The rest might be okay, if that is what an iface should look like (haven't
checked). We definitely will have the ioctls.

Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org [EMAIL PROTECTED]
Marcus Brinkmann              GNU    http://www.gnu.org    [EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.marcus-brinkmann.de

_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd

Reply via email to