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

Michael Gellman m.gellman at imperial.ac.uk
Mon Apr 3 05:46:18 EDT 2006


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);


More information about the click mailing list