Networking Forums

Networking Forums > Computer Networking > Linux Networking > How to find number of messages buffered in an interface?

Reply
Thread Tools Display Modes

How to find number of messages buffered in an interface?

 
 
gregflies1@yahoo.com
Guest
Posts: n/a

 
      12-11-2004, 06:40 PM
I'm experimenting with low-level I/O on interfaces on a small Linux
inside
the Linksys WRT54G wireless router. Doing this sort of thing:

dev1_socket = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));

sprintf(get_index.ifr_name, "eth0");
result = ioctl(dev1_socket, SIOCGIFINDEX, &get_index);

bind_arg.sll_family = AF_PACKET;
bind_arg.sll_ifindex = get_index.ifr_ifindex;
bind_arg.sll_protocol = htons(protocol);
result = bind(dev1_socket, (struct sockaddr *) &bind_arg,
sizeof(bind_arg));

On that box, the behavior of interfaces seems to be this:
If no process has a socket open on an interface, packets sent to
the interface fall on the floor.

If a process has a socket open on an interface, but does not read from
the interface for whatever reason, 16 incoming messages are queued, and
any subsequent messages fall on the floor.

So, it looks like the kernel maintains a circular buffer of length 16
to
hold incoming messages. If that buffer is full, any arriving messages
are ignored.

Here's my question: How do I ask the kernel how many messages are in
the
queue for a given interface? I am doing things like setting up eth0,
eth0:1,
eth0:2 etc., and using bind to have incoming messages of different
protocols
go to different interfaces.

I'd like to be able to use an ioctl, or some file in /proc, or
whatever,
and ask the kernel, "OK - how many packets are in the incoming queue
for device
eth0:2?" The number would be 0 .. 16 in the case of this box.
Thanks a million for any help or suggestions,

Greg

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Couldn't find interface ppp0: No such device abelard Linux Networking 1 09-16-2007 05:26 PM
Find out Driver Version Number and Info shrin Linux Networking 3 07-20-2007 10:04 PM
WAP number - how to find it? Martin ©¿©¬ somewhere@in-time.invalid Broadband 11 11-13-2006 05:49 PM
Find IPv4 address(es) for an interface Spoon Linux Networking 4 06-07-2006 01:04 AM
How do I find out the IP of my VPN server on the private interface? dave@softwareonline.com Windows Networking 4 07-23-2005 01:25 AM



1 2 3 4 5 6 7 8 9 10 11