Skip to content

Commit

Permalink
Do not allow agent to modify a "NEW" flow
Browse files Browse the repository at this point in the history
The "NEW" flag is set whenever a flow becomes active and is in
the transient state. If agent tries to modify the entry in that
state, a possibility because of reuse of an entry due to
eviction, a condition could happen where the flags used by datapath
could come from the flags set by agent, more specifically the
Modified flag, and thus be in a state where nothing can be done
in the entry. Hence, prevent agent from acting upon NEW flows.

Change-Id: I017fd7d32f0488cef90a17c491c6021bbdd181c7
Closes-BUG: #1580855
  • Loading branch information
anandhk-juniper committed Jul 19, 2016
1 parent ad180ee commit 4a5554e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dp-core/vr_flow.c
Expand Up @@ -343,7 +343,8 @@ vr_flow_start_modify(struct vrouter *router, struct vr_flow_entry *fe)
unsigned short flags;

flags = fe->fe_flags;
if (!(flags & (VR_FLOW_FLAG_MODIFIED | VR_FLOW_FLAG_EVICTED))) {
if (!(flags & (VR_FLOW_FLAG_MODIFIED | VR_FLOW_FLAG_EVICTED |
VR_FLOW_FLAG_NEW_FLOW))) {
if (__sync_bool_compare_and_swap(&fe->fe_flags, flags,
flags | VR_FLOW_FLAG_MODIFIED)) {
return true;
Expand Down
3 changes: 2 additions & 1 deletion include/vr_flow.h
Expand Up @@ -34,7 +34,8 @@ typedef enum {

#define VR_FLOW_FLAG_DP_FLAGS (VR_FLOW_FLAG_EVICT_CANDIDATE |\
VR_FLOW_FLAG_EVICTED |\
VR_FLOW_FLAG_NEW_FLOW)
VR_FLOW_FLAG_NEW_FLOW |\
VR_FLOW_FLAG_MODIFIED)

#define VR_FLOW_FLAG_DP_BITS(fe) (((fe)->fe_flags) &\
(VR_FLOW_FLAG_DP_FLAGS))
Expand Down

0 comments on commit 4a5554e

Please sign in to comment.