Implement subnet mask matching in OpenFlow.
[sliver-openvswitch.git] / datapath / datapath.c
index 7c26493..5c3a84c 100644 (file)
@@ -1153,7 +1153,7 @@ static int flow_stats_dump_callback(struct sw_flow *flow, void *private)
        ofs->length          = htons(length);
        ofs->table_id        = s->table_idx;
        ofs->pad             = 0;
-       ofs->match.wildcards = htons(flow->key.wildcards);
+       ofs->match.wildcards = htonl(flow->key.wildcards);
        ofs->match.in_port   = flow->key.in_port;
        memcpy(ofs->match.dl_src, flow->key.dl_src, ETH_ALEN);
        memcpy(ofs->match.dl_dst, flow->key.dl_dst, ETH_ALEN);
@@ -1162,7 +1162,7 @@ static int flow_stats_dump_callback(struct sw_flow *flow, void *private)
        ofs->match.nw_src    = flow->key.nw_src;
        ofs->match.nw_dst    = flow->key.nw_dst;
        ofs->match.nw_proto  = flow->key.nw_proto;
-       memset(ofs->match.pad, 0, sizeof ofs->match.pad);
+       ofs->match.pad       = 0;
        ofs->match.tp_src    = flow->key.tp_src;
        ofs->match.tp_dst    = flow->key.tp_dst;
        ofs->duration        = htonl((jiffies - flow->init_time) / HZ);
@@ -1279,11 +1279,11 @@ static int table_stats_dump(struct datapath *dp, void *state,
                            void *body, int *body_len)
 {
        struct ofp_table_stats *ots;
-       int nbytes = dp->chain->n_tables * sizeof *ots;
+       int n_bytes = dp->chain->n_tables * sizeof *ots;
        int i;
-       if (nbytes > *body_len)
+       if (n_bytes > *body_len)
                return -ENOBUFS;
-       *body_len = nbytes;
+       *body_len = n_bytes;
        for (i = 0, ots = body; i < dp->chain->n_tables; i++, ots++) {
                struct sw_table_stats stats;
                dp->chain->tables[i]->stats(dp->chain->tables[i], &stats);