Getting IP in a script

Deepak Saxena deepak@csociety.purdue.edu
Tue, 13 Mar 2001 13:50:29 -0700


No, wrong.  Looks like the ioctl takes a struct ifr, defined in 
<linux/include.h>.  Put the device name into the name field,
send the ioctl, and the addrs comes back in the ifru_addr field,
which will be of type sockaddr_in.

struct ifreq
{
#define IFHWADDRLEN     6
#define IFNAMSIZ        16
        union
        {
                char    ifrn_name[IFNAMSIZ];  /* if name, e.g. "en0" */
        } ifr_ifrn;

        union {
                struct  sockaddr ifru_addr;
                struct  sockaddr ifru_dstaddr;
                struct  sockaddr ifru_broadaddr;
                struct  sockaddr ifru_netmask;
                struct  sockaddr ifru_hwaddr;
                short   ifru_flags;
                int     ifru_ivalue;
                int     ifru_mtu;
                struct  ifmap ifru_map;
                char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
                char    ifru_newname[IFNAMSIZ];
                char *  ifru_data;
        } ifr_ifru;
}


On Mar 13 2001, at 13:45, Deepak Saxena was caught saying:
> 
> sockaddr_in
> 
> -- 
> Deepak Saxena - deepak@csociety.purdue.edu - phone://602.790.0500
> 
> Code Monkey, MontaVista Software, Inc. - THE Embedded Linux Experts
> 
> call me 'evil' call me 'tide is on your side' anything that you want
> anybody knows you can conjure anything by the dark of the moon
>   - Tori Amos, "Suede"
> 
> _______________________________________________
> Plug-devel mailing list  -  Plug-devel@lists.PLUG.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-devel

-- 
Deepak Saxena - deepak@csociety.purdue.edu - phone://602.790.0500

Code Monkey, MontaVista Software, Inc. - THE Embedded Linux Experts

call me 'evil' call me 'tide is on your side' anything that you want
anybody knows you can conjure anything by the dark of the moon
  - Tori Amos, "Suede"