SIOCFIGGLAGS: Why does it not report right?
dave at mudsite.com
Mon Apr 10 17:15:40 UTC 2006
I am having a problem, (and have scoured over google) but was not able
to find something that, either gave me a good enough answer, or I am
Ok so the problem I am having is with DHCPv6c. I am trying to get the
DHCP client for ipv6 to work. (dhcpv6.sf.net) Granted this program is
not Ubuntu specific but in a test case I wrote I found the same problem.
So I start my machine w/o network cable connected. Dhclient fails to
get an address and so on.
Below is code, that should get the devices on the system (to the best of
my knowledge), and what is happening is that ETH0 is not detected as a
device. The loop in get_devices only find 'lo'. However, the following
code DOES detect eth0 when I reconnect the cable, run dhclient and get
the address. I am also able to stop dhclient and release my ipv4
address, and still detect eth0 with the code below.
int get_devices ()
struct ifconf ifc;
struct ifreq *ifr;
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (ioctl(sock, SIOCGIFCONF, &ifc) < 0)
//Bork bork bork
ifr = ifc.ifc_req;
for (i = ifc.ifc_len / sizeof(struct ifreq);
--i >=0 && num_device < MAX_DEVICE;
continue; //We dont care about loopback
// Process other devices ... eg eth0
Any help or ideas?
More information about the ubuntu-users