[Click] Infinite loop on RawSocket errors [PATCH ATTACHED]

Eddie Kohler kohler at cs.ucla.edu
Mon Apr 3 11:44:33 EDT 2006


Thanks very much for this patch!  Applied.

Especially for Mark: There is something a little weird here -- I'm surprised 
that RawSockets, when given a very long packet, might send that packet *in 
chunks*, since the RawSockets on the other side will interpret this as 
multiple packets.  Perhaps the "p->pull(len)" should just break the loop as 
well, even if the packet is truncated?

Eddie


Michael Gellman wrote:
> In the RawSocket element, I have found that occasionally the sendto call
> returns an error message (e.g. permissions error, message too big,
> etc.). When this happens, the element infinite-loops trying the failed
> call again and again.
> 
> The attached 1-line patch adds a break call to the while loop around the
> sendto call in the case of an error condition. After the break, a kill()
> is issued on the packet, so I do not believe this will leak any
> resources. It also appears to be the action taken by other elements
> using the sendto call.
> 
> Sincerely,
> 
> Michael Gellman
> --
> Intelligent Systems & Networks Group
> Dept of Electrical & Electronic Engineering
> Imperial College London
> London SW7 2BT
> 
> Index: elements/userlevel/rawsocket.cc
> ===================================================================
> RCS file: /cvs/click/release/one/elements/userlevel/rawsocket.cc,v
> retrieving revision 1.3
> diff -u -r1.3 rawsocket.cc
> --- elements/userlevel/rawsocket.cc     27 Sep 2005 19:56:11 -0000
> 1.3
> +++ elements/userlevel/rawsocket.cc     9 Nov 2005 17:22:24 -0000
> @@ -240,6 +240,7 @@
>             } else {
>               // unexpected error
>               errh->error("sendto: %s", strerror(errno));
> +             break;
>             }
>           } else {
>             p->pull(len);
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list