/*
- * Copyright (c) 2011, 2013 Gaetano Catalli.
+ * Copyright (c) 2011, 2013, 2014 Gaetano Catalli.
* Copyright (c) 2013, 2014 YAMAMOTO Takashi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/sockio.h>
+#include <net/bpf.h>
#include <ifaddrs.h>
#include <pcap/pcap.h>
#include <net/if.h>
}
}
} else if (retval != size) {
- VLOG_WARN_RL(&rl, "sent partial Ethernet packet (%"PRIuSIZE"d bytes of "
+ VLOG_WARN_RL(&rl, "sent partial Ethernet packet (%"PRIuSIZE" bytes of "
"%"PRIuSIZE") on %s", retval, size, name);
error = EMSGSIZE;
} else {
}
ovs_mutex_unlock(&netdev->mutex);
- return 0;
+ return error;
}
static int
netdev_get_name(netdev_), ovs_strerror(errno));
return errno;
} else if (!strcmp(ifmd.ifmd_name, netdev_get_name(netdev_))) {
- convert_stats(netdev, stats, &ifdr.ifdr_data);
+ convert_stats(netdev_, stats, &ifmd.ifmd_data);
break;
}
}
ifr_get_flags(const struct ifreq *ifr)
{
#ifdef HAVE_STRUCT_IFREQ_IFR_FLAGSHIGH
- return (ifr->ifr_flagshigh << 16) | ifr->ifr_flags;
+ return (ifr->ifr_flagshigh << 16) | (ifr->ifr_flags & 0xffff);
#else
return ifr->ifr_flags;
#endif
static void
ifr_set_flags(struct ifreq *ifr, int flags)
{
- ifr->ifr_flags = flags;
#ifdef HAVE_STRUCT_IFREQ_IFR_FLAGSHIGH
+ ifr->ifr_flags = flags & 0xffff;
ifr->ifr_flagshigh = flags >> 16;
+#else
+ ifr->ifr_flags = flags;
#endif
}
+#if defined(__NetBSD__)
/* Calls ioctl() on an AF_LINK sock, passing the specified 'command' and
* 'arg'. Returns 0 if successful, otherwise a positive errno value. */
int
: ioctl(sock, command, arg) == -1 ? errno
: 0);
}
+#endif