#include "netlink.h"
#include "ofpbuf.h"
#include "openflow/openflow.h"
-#include "openvswitch/gre.h"
#include "packets.h"
#include "poll-loop.h"
#include "port-array.h"
#include "socket-util.h"
#include "shash.h"
#include "svec.h"
-
-#define THIS_MODULE VLM_netdev_linux
#include "vlog.h"
+
+VLOG_DEFINE_THIS_MODULE(netdev_linux)
\f
/* These were introduced in Linux 2.6.14, so they might be missing if we have
* old headers. */
if (!(netdev_dev->cache_valid & VALID_IS_PSEUDO)) {
const char *name = netdev_dev_get_name(&netdev_dev->netdev_dev);
const char *type = netdev_dev_get_type(&netdev_dev->netdev_dev);
-
+
netdev_dev->is_tap = !strcmp(type, "tap");
netdev_dev->is_internal = false;
if (!netdev_dev->is_tap) {
struct tcmsg *tcmsg;
tcmsg = tc_make_request(netdev, RTM_GETTCLASS, 0, &request);
- tcmsg->tcm_parent = TC_H_ROOT;
+ tcmsg->tcm_parent = 0;
nl_dump_start(dump, rtnl_sock, &request);
ofpbuf_uninit(&request);
}
if (file != NULL) {
const char *name = netdev_get_name(netdev_);
while (fgets(line, sizeof line, file)) {
- struct in6_addr in6;
+ struct in6_addr in6_tmp;
char ifname[16 + 1];
- if (parse_if_inet6_line(line, &in6, ifname)
+ if (parse_if_inet6_line(line, &in6_tmp, ifname)
&& !strcmp(name, ifname))
{
- netdev_dev->in6 = in6;
+ netdev_dev->in6 = in6_tmp;
break;
}
}
iface, &dest, &gateway, &flags, &refcnt,
&use, &metric, &mask, &mtu, &window, &irtt) != 11) {
- VLOG_WARN_RL(&rl, "%s: could not parse line %d: %s",
+ VLOG_WARN_RL(&rl, "%s: could not parse line %d: %s",
fn, ln, line);
continue;
}
}
/* The output of 'dest', 'mask', and 'gateway' were given in
- * network byte order, so we don't need need any endian
+ * network byte order, so we don't need need any endian
* conversions here. */
if ((dest & mask) == (host->s_addr & mask)) {
if (!gateway) {
error = tc_parse_class(tcmsg, &handle, &nl_options, stats);
if (!error && queue_id) {
- if (tc_get_major(handle) == 1 && tc_get_minor(handle) < HTB_N_QUEUES) {
- *queue_id = tc_get_minor(handle);
+ unsigned int major = tc_get_major(handle);
+ unsigned int minor = tc_get_minor(handle);
+ if (major == 1 && minor > 0 && minor <= HTB_N_QUEUES) {
+ *queue_id = minor - 1;
} else {
error = EPROTO;
}
return error;
}
- error = htb_setup_class__(netdev, tc_make_handle(1, queue_id),
+ error = htb_setup_class__(netdev, tc_make_handle(1, queue_id + 1),
tc_make_handle(1, 0xfffe), &hc);
if (error) {
return error;
hc = port_array_get(&htb->tc.queues, queue_id);
assert(hc != NULL);
- error = tc_delete_class(netdev, tc_make_handle(1, queue_id));
+ error = tc_delete_class(netdev, tc_make_handle(1, queue_id + 1));
if (!error) {
free(hc);
port_array_delete(&htb->tc.queues, queue_id);
htb_class_get_stats(const struct netdev *netdev, unsigned int queue_id,
struct netdev_queue_stats *stats)
{
- return htb_query_class__(netdev, tc_make_handle(1, queue_id),
+ return htb_query_class__(netdev, tc_make_handle(1, queue_id + 1),
tc_make_handle(1, 0xfffe), NULL, stats);
}
netdev_dump_queue_stats_cb *cb, void *aux)
{
struct netdev_queue_stats stats;
- unsigned int handle;
+ unsigned int handle, major, minor;
int error;
error = tc_parse_class(nlmsg, &handle, NULL, &stats);
return error;
}
- if (tc_get_major(handle) == 1 && tc_get_minor(handle) < HTB_N_QUEUES) {
+ major = tc_get_major(handle);
+ minor = tc_get_minor(handle);
+ if (major == 1 && minor > 0 && minor <= HTB_N_QUEUES) {
(*cb)(tc_get_minor(handle), &stats, aux);
}
return 0;