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

maximilian attems max at stro.at
Mon Mar 28 04:44:39 PDT 2011


On Mon, Mar 28, 2011 at 03:02:11AM +0200, Ulrich Dangel wrote:
> * 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.

at a quick look I'd prefer to go the proper road and not band-aiding.
could you post this suggested patch as follow-up on top of the "proper one"
so it can be bisected if any would be a trouble.

thank you

-- 
maks



More information about the klibc mailing list