Diff for /qemu/net/tap-bsd.c between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2018/04/24 18:42:29 version 1.1.1.4, 2018/04/24 19:32:57
Line 28 Line 28
 #include "qemu-error.h"  #include "qemu-error.h"
   
 #ifdef __NetBSD__  #ifdef __NetBSD__
   #include <sys/ioctl.h>
   #include <net/if.h>
 #include <net/if_tap.h>  #include <net/if_tap.h>
 #endif  #endif
   
Line 40 Line 42
 int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)  int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
 {  {
     int fd;      int fd;
   #ifdef TAPGIFNAME
       struct ifreq ifr;
   #else
     char *dev;      char *dev;
     struct stat s;      struct stat s;
   #endif
   
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)  #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
     /* if no ifname is given, always start the search from tap0/tun0. */      /* if no ifname is given, always start the search from tap0/tun0. */
Line 77  int tap_open(char *ifname, int ifname_si Line 83  int tap_open(char *ifname, int ifname_si
 #else  #else
     TFR(fd = open("/dev/tap", O_RDWR));      TFR(fd = open("/dev/tap", O_RDWR));
     if (fd < 0) {      if (fd < 0) {
         fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");          fprintf(stderr,
               "warning: could not open /dev/tap: no virtual network emulation: %s\n",
               strerror(errno));
         return -1;          return -1;
     }      }
 #endif  #endif
   
     fstat(fd, &s);  #ifdef TAPGIFNAME
       if (ioctl(fd, TAPGIFNAME, (void *)&ifr) < 0) {
           fprintf(stderr, "warning: could not get tap name: %s\n",
               strerror(errno));
           return -1;
       }
       pstrcpy(ifname, ifname_size, ifr.ifr_name);
   #else
       if (fstat(fd, &s) < 0) {
           fprintf(stderr,
               "warning: could not stat /dev/tap: no virtual network emulation: %s\n",
               strerror(errno));
           return -1;
       }
     dev = devname(s.st_rdev, S_IFCHR);      dev = devname(s.st_rdev, S_IFCHR);
     pstrcpy(ifname, ifname_size, dev);      pstrcpy(ifname, ifname_size, dev);
   #endif
   
     if (*vnet_hdr) {      if (*vnet_hdr) {
         /* BSD doesn't have IFF_VNET_HDR */          /* BSD doesn't have IFF_VNET_HDR */

Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4


unix.superglobalmegacorp.com