Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I am designing a web page for my product to display network interface information. My product is linux based having ethernet(eth0) and wireless lan(eth1) interfaces. When I cat /proc/net/dev, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Location
    Harrisburg, PA, USA
    Posts
    56

    Reading and Parsing Data from /proc/net/dev


    Hi,

    I am designing a web page for my product to display network interface information. My product is linux based having ethernet(eth0) and wireless lan(eth1) interfaces.

    When I cat /proc/net/dev, I see following information:
    Inter-| Receive | Transmit
    face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
    lo: 405513 7108 0 0 0 0 0 0 405513 7108 0 0 0 0 0 0
    eth0: 165194 1594 2 0 2 0 0 681 607273 809 0 0 0 0 0 0
    eth1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

    Sorry for this data distortion. Now I want to read packets received, sent, errors, dropped packets count for both the interfaces and display it on my web page. I have a C program as my web page backend. What is the best way to read and parse this data? Are there ioctls available for this?

    Regards,
    Sumit
    Last edited by sumitv; 12-08-2010 at 06:42 PM.

  2. #2
    Just Joined!
    Join Date
    Oct 2009
    Posts
    85
    Oh.. this is the same what I want.. both have the same requirement...
    do u have any ioctls or some c-fucntions to get the list interfaces and their details like ipaddress, gateway, route etc...

  3. #3
    Just Joined!
    Join Date
    Nov 2006
    Location
    Harrisburg, PA, USA
    Posts
    56
    This is the ioctl that I used to get hardware address (mac address) of ethernet chip.

    ioctl(s, SIOCGIFHWADDR, &buffer);

    I am still finding ioctl to read number of packets received, dropped, transmitted, errors etc.
    You can get ioctls for ipaddress, gateway, route etc in your chip/module specific ioctl documentation. The vendor/manufacturer must have provided you with this documentation.

    Let me know if you find a suitable way to parse /proc/net/dev.

    Regards,
    Sumit

  4. #4
    Just Joined!
    Join Date
    Oct 2009
    Posts
    85
    Hey.. try this link.. whether if helpful :
    busybox-linux-e680.rar ifconfig.c

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •