Get 'ifconfig' information via Python

David N. Welton dwelton at
Thu Aug 5 00:25:50 CEST 1999

Ivan Van Laningham <ivanlan at> writes:

> Hi All--
> "M.-A. Lemburg" wrote:
> > 
> > David N. Welton wrote:

> > > res = fcntl.ioctl(s, IN.SIOCSIFHWADDR, ??????)

> > Building these structs can be done using the Python struct
> > module... playing around with this can probably crash your system
> > though.

> > In the end, I think you're better off hacking together a
> > new extension module.

This is what I've been working towards... seems easier than futzing
with the 'struct' module stuff.

> Why on earth would reading this information into a struct crash his
> system?  Or am I missing something here?  At worst, writing a
> messed-up struct might hose his ethernet connection, but I really
> doubt that he would be any more likely to crash his system using
> Python than C.

I made a mistake and put SIOC*S*IFHWADDR instead of SIOC*G*IFHWADDR,
which is what I really meant.  

David N. Welton, Web Engineer, Linuxcare, Inc.
415.354.4878 x241 tel, 415.701.7457 fax
dwelton at,
Linuxcare. At the center of Linux.

More information about the Python-list mailing list