summaryrefslogtreecommitdiff
path: root/lib/cfm.c
diff options
context:
space:
mode:
authorJarno Rajahalme <jrajahalme@nicira.com>2014-04-02 15:44:21 -0700
committerJarno Rajahalme <jrajahalme@nicira.com>2014-04-03 11:51:59 -0700
commitcf3b7538666cd1efa314ce4944e4efdf3dd81d99 (patch)
treec7272f8d75909ce3e2270b36b5f412c00318bcab /lib/cfm.c
parent6b8c377a6e25b18da473c3a24dfad8ec9e01ad7f (diff)
downloadopenvswitch-cf3b7538666cd1efa314ce4944e4efdf3dd81d99.tar.gz
ofpbuf: Abstract 'l2' pointer and document usage conventions.
Rename 'l2' to 'frame' and add new ofpbuf_set_frame() and ofpbuf_l2(). ofpbuf_set_frame() alse resets all the layer offsets. ofpbuf_l2() returns NULL if the packet has no Ethernet header, as indicated either by unset l3 offset or NULL frame pointer. Callers of ofpbuf_l2() are supposed to check the return value, unless they can otherwise be sure that the packet has a valid Ethernet header. The recent commit 437d0d22 made some assumptions that were not valid regarding the use of the 'l2' pointer in rconn module and by compose_rarp(). This is now fixed as follows: rconn now relies on the fact that once OpenFlow messages are given to rconn for transport, the frame pointer is no longer needed to refer to the OpenFlow header; and compose_rarp() now sets the frame pointer and offsets as expected. In addition to storing network frames, ofpbufs are also used for handling OpenFlow messages and action lists. lib/ofpbuf.h now has a comment documenting the current usage conventions and invariants. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/cfm.c')
-rw-r--r--lib/cfm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cfm.c b/lib/cfm.c
index bdc79bd6c..ce0c471e3 100644
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -718,7 +718,7 @@ cfm_process_heartbeat(struct cfm *cfm, const struct ofpbuf *p)
ovs_mutex_lock(&mutex);
- eth = p->l2;
+ eth = ofpbuf_l2(p);
ccm = ofpbuf_at(p, (uint8_t *)ofpbuf_l3(p) - (uint8_t *)ofpbuf_data(p),
CCM_ACCEPT_LEN);