← Back to team overview

hipl-core team mailing list archive

[trunk]4908: Clear ctx->error to 0 prior to processing each socket.

 

  Clear ctx->error to 0 prior to processing each socket.
  
  Maybe that's the wrong place to patch so here's some background info.
  
  I stumbled upon this while testing hipd via two VMs, i.e. running hipd on
  both of them and ping6-ing the respective HITs. On some machines it worked
  right away but on two setups it didn't because R2 packets were perfectly
  received (i.e. HIT-to-IP resolution worked) but not processed. Turns out
  ctx->error was set to -1 before any processing even took place, so of
  course the packet was dropped at hip_run_handle_functions. As far as I can
  tell, even though ctx is bound per-packet it's a stack-allocated struct in
  hipd_main that's reused all the time so it must be cleared at one point or
  another.
  
  Well anyway, this patch solved my problems so far.

=== modified file 'hipd/hip_socket.c'
--- hipd/hip_socket.c	2010-07-07 16:42:17 +0000
+++ hipd/hip_socket.c	2010-08-20 14:59:41 +0000
@@ -276,6 +276,7 @@
             socketfd = ((struct socketfd*) iter->ptr)->fd;
 
             if (FD_ISSET(socketfd, read_fdset)) {
+                ctx->error = 0;
                 ((struct socketfd*) iter->ptr)->func_ptr(ctx);
             }
         }