Commit 352321cb authored by Herbert Xu's avatar Herbert Xu Committed by Hideaki Yoshifuji

[XFRM] Set SA saddr correctly

The source address of an SA is not necessarily equal to the source address
in the selector.  This patch addresses this problem.
parent 7e229d15
...@@ -155,6 +155,7 @@ enum xfrm_attr_type_t { ...@@ -155,6 +155,7 @@ enum xfrm_attr_type_t {
struct xfrm_usersa_info { struct xfrm_usersa_info {
struct xfrm_selector sel; struct xfrm_selector sel;
struct xfrm_id id; struct xfrm_id id;
xfrm_address_t saddr;
struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cfg lft;
struct xfrm_lifetime_cur curlft; struct xfrm_lifetime_cur curlft;
struct xfrm_stats stats; struct xfrm_stats stats;
......
...@@ -200,7 +200,7 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info * ...@@ -200,7 +200,7 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
x->props.replay_window = p->replay_window; x->props.replay_window = p->replay_window;
x->props.reqid = p->reqid; x->props.reqid = p->reqid;
x->props.family = p->family; x->props.family = p->family;
x->props.saddr = x->sel.saddr; x->props.saddr = p->saddr;
} }
static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p, static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p,
...@@ -296,6 +296,7 @@ static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p) ...@@ -296,6 +296,7 @@ static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p)
memcpy(&p->lft, &x->lft, sizeof(p->lft)); memcpy(&p->lft, &x->lft, sizeof(p->lft));
memcpy(&p->curlft, &x->curlft, sizeof(p->curlft)); memcpy(&p->curlft, &x->curlft, sizeof(p->curlft));
memcpy(&p->stats, &x->stats, sizeof(p->stats)); memcpy(&p->stats, &x->stats, sizeof(p->stats));
p->saddr = x->props.saddr;
p->mode = x->props.mode; p->mode = x->props.mode;
p->replay_window = x->props.replay_window; p->replay_window = x->props.replay_window;
p->reqid = x->props.reqid; p->reqid = x->props.reqid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment