aboutsummaryrefslogtreecommitdiffstats
path: root/net/key/af_key.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-06-19 01:44:00 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-19 01:44:00 -0400
commitbf08867f91a43aa3ba2e4598c06c4769a6cdddf6 (patch)
tree316504b4756a32d802ea037815f2d9022ab88bfe /net/key/af_key.c
parent4f09f0bbc1cb3c74e8f2047ad4be201a059829ee (diff)
[IPSEC] Turn km_event.data into a union
This patch turns km_event.data into a union. This makes code that uses it clearer. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'net/key/af_key.c')
-rw-r--r--net/key/af_key.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 560c93c10890..3fae5c4b48f6 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1293,13 +1293,6 @@ static int key_notify_sa(struct xfrm_state *x, struct km_event *c)
1293 if (c->event == XFRM_SAP_DELETED) 1293 if (c->event == XFRM_SAP_DELETED)
1294 hsc = 0; 1294 hsc = 0;
1295 1295
1296 if (c->event == XFRM_SAP_EXPIRED) {
1297 if (c->data)
1298 hsc = 2;
1299 else
1300 hsc = 1;
1301 }
1302
1303 skb = pfkey_xfrm_state2msg(x, 0, hsc); 1296 skb = pfkey_xfrm_state2msg(x, 0, hsc);
1304 1297
1305 if (IS_ERR(skb)) 1298 if (IS_ERR(skb))
@@ -1534,7 +1527,7 @@ static int key_notify_sa_flush(struct km_event *c)
1534 if (!skb) 1527 if (!skb)
1535 return -ENOBUFS; 1528 return -ENOBUFS;
1536 hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); 1529 hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg));
1537 hdr->sadb_msg_satype = pfkey_proto2satype(c->data); 1530 hdr->sadb_msg_satype = pfkey_proto2satype(c->data.proto);
1538 hdr->sadb_msg_seq = c->seq; 1531 hdr->sadb_msg_seq = c->seq;
1539 hdr->sadb_msg_pid = c->pid; 1532 hdr->sadb_msg_pid = c->pid;
1540 hdr->sadb_msg_version = PF_KEY_V2; 1533 hdr->sadb_msg_version = PF_KEY_V2;
@@ -1556,7 +1549,7 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
1556 return -EINVAL; 1549 return -EINVAL;
1557 1550
1558 xfrm_state_flush(proto); 1551 xfrm_state_flush(proto);
1559 c.data = proto; 1552 c.data.proto = proto;
1560 c.seq = hdr->sadb_msg_seq; 1553 c.seq = hdr->sadb_msg_seq;
1561 c.pid = hdr->sadb_msg_pid; 1554 c.pid = hdr->sadb_msg_pid;
1562 c.event = XFRM_SAP_FLUSHED; 1555 c.event = XFRM_SAP_FLUSHED;
@@ -1969,7 +1962,7 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
1969 out_hdr = (struct sadb_msg *) out_skb->data; 1962 out_hdr = (struct sadb_msg *) out_skb->data;
1970 out_hdr->sadb_msg_version = PF_KEY_V2; 1963 out_hdr->sadb_msg_version = PF_KEY_V2;
1971 1964
1972 if (c->data && c->event == XFRM_SAP_DELETED) 1965 if (c->data.byid && c->event == XFRM_SAP_DELETED)
1973 out_hdr->sadb_msg_type = SADB_X_SPDDELETE2; 1966 out_hdr->sadb_msg_type = SADB_X_SPDDELETE2;
1974 else 1967 else
1975 out_hdr->sadb_msg_type = event2poltype(c->event); 1968 out_hdr->sadb_msg_type = event2poltype(c->event);
@@ -2180,7 +2173,7 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2180 c.seq = hdr->sadb_msg_seq; 2173 c.seq = hdr->sadb_msg_seq;
2181 c.pid = hdr->sadb_msg_pid; 2174 c.pid = hdr->sadb_msg_pid;
2182 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) { 2175 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) {
2183 c.data = 1; // to signal pfkey of SADB_X_SPDDELETE2 2176 c.data.byid = 1;
2184 c.event = XFRM_SAP_DELETED; 2177 c.event = XFRM_SAP_DELETED;
2185 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); 2178 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c);
2186 } else { 2179 } else {
@@ -2460,7 +2453,7 @@ static int key_notify_sa_expire(struct xfrm_state *x, struct km_event *c)
2460 int hard; 2453 int hard;
2461 int hsc; 2454 int hsc;
2462 2455
2463 hard = c->data; 2456 hard = c->data.hard;
2464 if (hard) 2457 if (hard)
2465 hsc = 2; 2458 hsc = 2;
2466 else 2459 else