kern/154302: better do-something-smart.patch

Janne Snabb snabb at epipe.com
Sun May 22 09:20:14 UTC 2011


The following reply was made to PR kern/154302; it has been noted by GNATS.

From: Janne Snabb <snabb at epipe.com>
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: kern/154302: better do-something-smart.patch
Date: Sun, 22 May 2011 09:16:19 +0000 (UTC)

 Here is a new patch which is hopefully neat enough to be committed. 
 
 Could someone with a commit bit consider this? Lots of people are
 having trouble beacuse of this bug. It can be argued that the bug
 is in Xen and not in FreeBSD, but in reality we do need a work-around
 in FreeBSD. (Or if not, the panic message should be "something
 smarter". :)
 
 --- do-something-smart.patch begins here ---
 Index: sys/dev/xen/netfront/netfront.c
 ===================================================================
 --- sys/dev/xen/netfront/netfront.c	(revision 222131)
 +++ sys/dev/xen/netfront/netfront.c	(working copy)
 @@ -408,9 +408,27 @@
  
  	error = xs_read(XST_NIL, xenbus_get_node(dev), "mac", NULL,
  	    (void **) &macstr);
 -	if (error)
 -		return (error);
  
 +	if (error) {
 +		/*
 +		 * Try to read the 'mac' node from the backend side in case
 +		 * it does not exist (ENOENT) in the frontend side. This
 +		 * happens with various Xen versions if 'type=ioemu' is set
 +		 * in the vif configuration. See PR 154302 for more details.
 +		 * Otherwise return the error to the caller.
 +		 */
 +		if (error != ENOENT)
 +			return (error);
 +
 +		if (xs_read(XST_NIL, xenbus_get_otherend_path(dev), "mac",
 +		    NULL, (void **) &macstr) != 0)
 +			/*
 +			 * Return the error code of the frontend read (it
 +			 * is always ENOENT at this point).
 +			 */
 +			return (error);
 +	}
 +
  	s = macstr;
  	for (i = 0; i < ETHER_ADDR_LEN; i++) {
  		mac[i] = strtoul(s, &e, 16);
 --- do-something-smart.patch ends here ---
 
 --
 Janne Snabb / EPIPE Communications
 snabb at epipe.com - http://epipe.com/


More information about the freebsd-xen mailing list