[Xorp-hackers] Xorp FEA crash

Pavlin Radoslavov pavlin at ICSI.Berkeley.EDU
Fri Jul 18 11:33:08 PDT 2008


Ben Greear <greearb at candelatech.com> wrote:

> Ben Greear wrote:
> > NOTE:  This is with my patches applied, so it could
> > be my fault.  But, it looks like it could be a generic
> > problem.
> 
> I added some more debugging.  It is hitting the assert at the end
> of this code.  It looks like we should not be doing the CMSG_NXTHDR
> if neither of the #ifdefs in this section are defined?

Ben,

The only reason I can think of that CMSG_NXTHDR() returns NULL is if
the _sndmh.msg_controllen value is too small to accomodate all the
options.
For sending purpose, the _sndmh.msg_controllen value is set to
"ctllen" which is precomputed on-the-fly before the ancillary data
is setup.
If the problem is indeed a small _sndmh.msg_controllen, then
"ctllen" wasn't calculated properly, which is a bug in that part of
the code.

Could you add some debug statements to print the value of
_sndmh.msg_controllen and the calculation of "ctllen".

Also, it will be helpful if you can try the same setup with vanilla
XORP source code. In any case, could you send your OS and kernel
version, and your XORP configuration file so I can also try to
replicate and debug the problem.

Thanks,
Pavlin

> 	//
> 	// Include the Router Alert option if needed
> 	//
> 	if (ip_router_alert) {
> #ifdef HAVE_RFC3542
> 	    int currentlen;
> 	    void *hbhbuf, *optp = NULL;
> 	
> 	    cmsgp->cmsg_len   = CMSG_LEN(hbhlen);
> 	    cmsgp->cmsg_level = IPPROTO_IPV6;
> 	    cmsgp->cmsg_type  = IPV6_HOPOPTS;
> 	    hbhbuf = CMSG_DATA(cmsgp);
> 	    currentlen = inet6_opt_init(hbhbuf, hbhlen);
> 	    if (currentlen == -1) {
> 		error_msg = c_format("inet6_opt_init(len = %d) failed",
> 				     hbhlen);
> 		return (XORP_ERROR);
> 	    }
> 	    currentlen = inet6_opt_append(hbhbuf, hbhlen, currentlen,
> 					  IP6OPT_ROUTER_ALERT, 2, 2, &optp);
> 	    if (currentlen == -1) {
> 		error_msg = c_format("inet6_opt_append(len = %d) failed",
> 				     currentlen);
> 		return (XORP_ERROR);
> 	    }
> 	    inet6_opt_set_val(optp, 0, &rtalert_code6, sizeof(rtalert_code6));
> 	    if (inet6_opt_finish(hbhbuf, hbhlen, currentlen) == -1) {
> 		error_msg = c_format("inet6_opt_finish(len = %d) failed",
> 				     currentlen);
> 		return (XORP_ERROR);
> 	    }
> 	
> #else  // ! HAVE_RFC3542 (i.e., the old advanced API)
> 
> #ifdef HAVE_IPV6_MULTICAST_ROUTING
> 	    //
> 	    // TODO: XXX: temporary use HAVE_IPV6_MULTICAST_ROUTING
> 	    // to conditionally compile, because Linux doesn't
> 	    // have inet6_option_*
> 	    //
> 	    if (inet6_option_init((void *)cmsgp, &cmsgp, IPV6_HOPOPTS)) {
> 		error_msg = c_format("inet6_option_init(IPV6_HOPOPTS) failed");
> 		return (XORP_ERROR);
> 	    }
> 	    assert(cmsgp);
> 	    if (inet6_option_append(cmsgp, ra_opt6, 4, 0)) {
> 		error_msg = c_format("inet6_option_append(Router Alert) failed");
> 		return (XORP_ERROR);
> 	    }
> 	    assert(cmsgp);
> #endif // HAVE_IPV6_MULTICAST_ROUTING
> 	
> #endif // ! HAVE_RFC3542
> 	    assert(cmsgp);
> 	    cmsgp = CMSG_NXTHDR(&_sndmh, cmsgp);
> 	    assert(cmsgp);
> 	}
> 
> 
> -- 
> Ben Greear <greearb at candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
> 
> _______________________________________________
> Xorp-hackers mailing list
> Xorp-hackers at icir.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers



More information about the Xorp-hackers mailing list