Date: Fri, 5 Aug 2016 14:11:24 GMT From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307237 - soc2016/vincenzo/head/usr.sbin/bhyve Message-ID: <201608051411.u75EBOlX009833@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vincenzo Date: Fri Aug 5 14:11:23 2016 New Revision: 307237 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307237 Log: bhyve: netmap_init: distinguish ptnetmap checking for NULL callback Modified: soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.c soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c Modified: soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.c ============================================================================== --- soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.c Fri Aug 5 14:09:12 2016 (r307236) +++ soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.c Fri Aug 5 14:11:23 2016 (r307237) @@ -210,6 +210,11 @@ int opt = 1; struct tap_priv *priv; + if (cb == NULL) { + WPRINTF(("TAP backend requires non-NULL callback\n")); + return -1; + } + priv = calloc(1, sizeof(struct tap_priv)); if (priv == NULL) { WPRINTF(("tap_priv alloc failed\n")); @@ -559,7 +564,7 @@ const char *ndname = "/dev/netmap"; struct netmap_priv *priv = NULL; struct nmreq req; - int ptnetmap = 0; + int ptnetmap = (cb == NULL); priv = calloc(1, sizeof(struct netmap_priv)); if (priv == NULL) { Modified: soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c ============================================================================== --- soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c Fri Aug 5 14:09:12 2016 (r307236) +++ soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c Fri Aug 5 14:11:23 2016 (r307237) @@ -340,7 +340,8 @@ net_genmac(pi, macaddr); } - /* Initialize backend. */ + /* Initialize backend. A NULL callback is used here to tell + * the ask the netmap backend to use ptnetmap. */ sc->be = netbe_init(devname, NULL, sc); if (!sc->be) { fprintf(stderr, "net backend initialization failed\n");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608051411.u75EBOlX009833>