[Top][All Lists]

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

Re: PPP port: iface_Create

From: Marcus Brinkmann
Subject: Re: PPP port: iface_Create
Date: Sat, 2 Dec 2000 20:52:42 +0100
User-agent: Mutt/1.1.4i

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);


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.


`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]