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

autoconfiguration of network


  I'm thinking about a way to fill the fields of the boxes in the network
configuration step with good default values.  They are actually static values,
like for inet addr.
As many sparc are installed from network (rarp, bootp, tftp) the net device is
already configured and I guess this configuration could be extracted.
However I don't have much experience on net programming, so I would want to
know how I could get this configuration from the kernel.  I would want to do
something like ifconfig does when displaying net device informations.

I started with the following block of code:

#include "net/if.h"
struct ifreq ifrs;
int fd = socket(AF_INET,SOCK_DGRAM,0);

Then I could get inet addr from "ifrs.ifr_addr" but it's sockattr structure.
How do I convert it to quad dotted string format ?

The next step could be doing NIS requests to get hostname & domainname.

Any pointers greatly appreciated.
Thanks in advance.

 Eric Delaunay                 | "La guerre justifie l'existence des militaires.
 delaunay@lix.polytechnique.fr | En les supprimant." Henri Jeanson (1900-1970)

Reply to: