projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
netdev-vport: Use vport set_stats instead of internal dev.
[openvswitch]
/
lib
/
flow.c
diff --git
a/lib/flow.c
b/lib/flow.c
index fb7cf32a5bed2fc8de94db586aeb49de4251c6aa..7ae90d2b56f8c7210238aeaf4cbc33ca11f800fa 100644
(file)
--- a/
lib/flow.c
+++ b/
lib/flow.c
@@
-27,6
+27,7
@@
#include "openflow/openflow.h"
#include "openvswitch/datapath-protocol.h"
#include "packets.h"
#include "openflow/openflow.h"
#include "openvswitch/datapath-protocol.h"
#include "packets.h"
+#include "unaligned.h"
#include "xtoxll.h"
#include "vlog.h"
#include "xtoxll.h"
#include "vlog.h"
@@
-154,8
+155,8
@@
flow_extract(struct ofpbuf *packet, uint32_t tun_id, uint16_t in_port,
if (flow->dl_type == htons(ETH_TYPE_IP)) {
const struct ip_header *nh = pull_ip(&b);
if (nh) {
if (flow->dl_type == htons(ETH_TYPE_IP)) {
const struct ip_header *nh = pull_ip(&b);
if (nh) {
- flow->nw_src =
nh->ip_src
;
- flow->nw_dst =
nh->ip_dst
;
+ flow->nw_src =
get_unaligned_u32(&nh->ip_src)
;
+ flow->nw_dst =
get_unaligned_u32(&nh->ip_dst)
;
flow->nw_tos = nh->ip_tos & IP_DSCP_MASK;
flow->nw_proto = nh->ip_proto;
packet->l4 = b.data;
flow->nw_tos = nh->ip_tos & IP_DSCP_MASK;
flow->nw_proto = nh->ip_proto;
packet->l4 = b.data;
@@
-272,20
+273,16
@@
flow_to_match(const flow_t *flow, uint32_t wildcards, bool tun_id_from_cookie,
void
flow_from_match(const struct ofp_match *match, bool tun_id_from_cookie,
void
flow_from_match(const struct ofp_match *match, bool tun_id_from_cookie,
- uint64_t cookie, flow_t *flow, uint32_t *wildcards)
+ uint64_t cookie, flow_t *flow, uint32_t *
flow_
wildcards)
{
{
- if (wildcards) {
- *wildcards = ntohl(match->wildcards);
+ uint32_t wildcards = ntohl(match->wildcards);
- if (!tun_id_from_cookie) {
- *wildcards |= NXFW_TUN_ID;
- }
- }
flow->nw_src = match->nw_src;
flow->nw_dst = match->nw_dst;
flow->nw_src = match->nw_src;
flow->nw_dst = match->nw_dst;
- if (tun_id_from_cookie) {
+ if (tun_id_from_cookie
&& !(wildcards & NXFW_TUN_ID)
) {
flow->tun_id = htonl(ntohll(cookie) >> 32);
} else {
flow->tun_id = htonl(ntohll(cookie) >> 32);
} else {
+ wildcards |= NXFW_TUN_ID;
flow->tun_id = 0;
}
flow->in_port = (match->in_port == htons(OFPP_LOCAL) ? ODPP_LOCAL
flow->tun_id = 0;
}
flow->in_port = (match->in_port == htons(OFPP_LOCAL) ? ODPP_LOCAL
@@
-300,6
+297,10
@@
flow_from_match(const struct ofp_match *match, bool tun_id_from_cookie,
flow->nw_tos = match->nw_tos;
flow->nw_proto = match->nw_proto;
memset(flow->reserved, 0, sizeof flow->reserved);
flow->nw_tos = match->nw_tos;
flow->nw_proto = match->nw_proto;
memset(flow->reserved, 0, sizeof flow->reserved);
+
+ if (flow_wildcards) {
+ *flow_wildcards = wildcards;
+ }
}
char *
}
char *