[klibc] [PATCH] Only peek and discard packets from specified device.

Ulrich Dangel uli at spamt.net
Sun Mar 27 18:02:11 PDT 2011


* Ulrich Dangel wrote [28.03.11 02:30]:
Hi,

>  static int do_pkt_recv(int pkt_fd, time_t now)
>  {
> -	int ifindex, ret;
> +	int ret = 0;
>  	struct state *s;
>  
> -	ret = packet_peek(&ifindex);
> -	if (ret == 0)
> -		return ret;
> -
>  	for (s = slist; s; s = s->next) {
> -		if (s->dev->ifindex == ifindex) {
> +		ret = packet_peek(s->dev);
> +		if (ret) {
>  			ret = process_receive_event(s, now);
> +			if (ret == 0) {
> +				packet_discard(s->dev);
> +			}
>  			break;
>  		}
>  	}

If you use this patch then packet_peek could get removed as well as it does
basically nothing. I did not integrate this as i wanted to be as less as
invasive as possible. But removing packet_peek would make do_pkt_recv
simpler and easier.

Ulrich
-- 
twitter: @mr_ud  | identica: @mru
IRCNet:  mru     | freenode: mrud



More information about the klibc mailing list