Skip to content

Commit

Permalink
[IPSEC]: Make xfrm_lookup flags argument a bit-field
Browse files Browse the repository at this point in the history
This patch introduces an enum for bits in the flags argument of xfrm_lookup.
This is so that we can cram more information into it later.

Since all current users use just the values 0 and 1, XFRM_LOOKUP_WAIT has
been added with the value 1 << 0 to represent the current meaning of flags.

The test in __xfrm_lookup has been changed accordingly.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jan 28, 2008
1 parent 3f71c81 commit 815f4e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions include/net/dst.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)

extern void dst_init(void);

/* Flags for xfrm_lookup flags argument. */
enum {
XFRM_LOOKUP_WAIT = 1 << 0,
};

struct flowi;
#ifndef CONFIG_XFRM
static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
Expand Down
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
xfrm_pol_put(policy);
return -EREMOTE;
}
if (err == -EAGAIN && flags) {
if (err == -EAGAIN && (flags & XFRM_LOOKUP_WAIT)) {
DECLARE_WAITQUEUE(wait, current);

add_wait_queue(&km_waitq, &wait);
Expand Down

0 comments on commit 815f4e5

Please sign in to comment.