FreeBSD 10.3 HVM Xen guest

I found the following error trying to log in by ssh to a FreeBSD 10.3  HVM Xen guest.

xn_txeof: WARNING: response is -1!

The fix for this is to apply this patch

https://svnweb.freebsd.org/base?view=revision&revision=299542

Author: royger
Date: Thu May 12 16:18:02 2016 UTC (6 weeks, 6 days ago)
Changed paths: 1
Log Message:
xen-netfront: fix feature detection

Current netfront code relies on xs_scanf returning a value < 0 on error,
which is not right, xs_scanf returns a positive value on error.

MFC after:	3 days
Tested by:	Stephen Jones <StephenJo@LivingComputerMuseum.org>
Sponsored by:	Citrix Systems R&D

You need to choose install sources when installing FreeBSD as with this bug networking does not work to fetch the source code.

Apply the patch to /usr/src/sys/dev/xen/netfront/netfront.c, or just search for xs_scanf and change the condition from < 0 to !=0.

from

«feature-sg», NULL, «%d», &val) < 0)

to

«feature-sg», NULL, «%d», &val)  !=0)

 

revision 299541 by sephe, Fri Apr 1 06:28:33 2016 UTC revision 299542 by royger, Thu May 12 16:18:02 2016 UTC
# Line 2016  xn_query_features(struct netfront_info * Line 2016  xn_query_features(struct netfront_info *
2016          device_printf(np->xbdev, «backend features:»);          device_printf(np->xbdev, «backend features:»);
2017
2018          if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev),          if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev),
2019                  «feature-sg», NULL, «%d», &val) < 0)                  «feature-sg», NULL, «%d», &val) != 0)
2020                  val = 0;                  val = 0;
2021
2022          np->maxfrags = 1;          np->maxfrags = 1;
# Line 2026  xn_query_features(struct netfront_info * Line 2026  xn_query_features(struct netfront_info *
2026          }          }
2027
2028          if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev),          if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev),
2029                  «feature-gso-tcpv4», NULL, «%d», &val) < 0)                  «feature-gso-tcpv4», NULL, «%d», &val) != 0)
2030                  val = 0;                  val = 0;
2031
2032          np->xn_ifp->if_capabilities &= ~(IFCAP_TSO4|IFCAP_LRO);          np->xn_ifp->if_capabilities &= ~(IFCAP_TSO4|IFCAP_LRO);

Then rebuild your kernel as usual.

# make buildkernel KERNCONF=GENERIC

# make installkernel KERNCONF=GENERIC

# reboot

now boot with the new kernel

Now connectivity to your Xen guest should work 🙂