aboutsummaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-06-19 01:44:37 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-19 01:44:37 -0400
commitf60f6b8f70c756fc786d68f02ec17a1e84db645f (patch)
tree8eee05de129439e4ffde876d2208a613178acfe3 /net/key
parente7443892f656d760ec1b9d92567178c87e100f4a (diff)
[IPSEC] Use XFRM_MSG_* instead of XFRM_SAP_*
This patch removes XFRM_SAP_* and converts them over to XFRM_MSG_*. The netlink interface is meant to map directly onto the underlying xfrm subsystem. Therefore rather than using a new independent representation for the events we can simply use the existing ones from xfrm_user. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'net/key')
-rw-r--r--net/key/af_key.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 3fae5c4b48f6..577f0bb5bb31 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1248,13 +1248,13 @@ static int pfkey_acquire(struct sock *sk, struct sk_buff *skb, struct sadb_msg *
1248static inline int event2poltype(int event) 1248static inline int event2poltype(int event)
1249{ 1249{
1250 switch (event) { 1250 switch (event) {
1251 case XFRM_SAP_DELETED: 1251 case XFRM_MSG_DELPOLICY:
1252 return SADB_X_SPDDELETE; 1252 return SADB_X_SPDDELETE;
1253 case XFRM_SAP_ADDED: 1253 case XFRM_MSG_NEWPOLICY:
1254 return SADB_X_SPDADD; 1254 return SADB_X_SPDADD;
1255 case XFRM_SAP_UPDATED: 1255 case XFRM_MSG_UPDPOLICY:
1256 return SADB_X_SPDUPDATE; 1256 return SADB_X_SPDUPDATE;
1257 case XFRM_SAP_EXPIRED: 1257 case XFRM_MSG_POLEXPIRE:
1258 // return SADB_X_SPDEXPIRE; 1258 // return SADB_X_SPDEXPIRE;
1259 default: 1259 default:
1260 printk("pfkey: Unknown policy event %d\n", event); 1260 printk("pfkey: Unknown policy event %d\n", event);
@@ -1267,13 +1267,13 @@ static inline int event2poltype(int event)
1267static inline int event2keytype(int event) 1267static inline int event2keytype(int event)
1268{ 1268{
1269 switch (event) { 1269 switch (event) {
1270 case XFRM_SAP_DELETED: 1270 case XFRM_MSG_DELSA:
1271 return SADB_DELETE; 1271 return SADB_DELETE;
1272 case XFRM_SAP_ADDED: 1272 case XFRM_MSG_NEWSA:
1273 return SADB_ADD; 1273 return SADB_ADD;
1274 case XFRM_SAP_UPDATED: 1274 case XFRM_MSG_UPDSA:
1275 return SADB_UPDATE; 1275 return SADB_UPDATE;
1276 case XFRM_SAP_EXPIRED: 1276 case XFRM_MSG_EXPIRE:
1277 return SADB_EXPIRE; 1277 return SADB_EXPIRE;
1278 default: 1278 default:
1279 printk("pfkey: Unknown SA event %d\n", event); 1279 printk("pfkey: Unknown SA event %d\n", event);
@@ -1290,7 +1290,7 @@ static int key_notify_sa(struct xfrm_state *x, struct km_event *c)
1290 struct sadb_msg *hdr; 1290 struct sadb_msg *hdr;
1291 int hsc = 3; 1291 int hsc = 3;
1292 1292
1293 if (c->event == XFRM_SAP_DELETED) 1293 if (c->event == XFRM_MSG_DELSA)
1294 hsc = 0; 1294 hsc = 0;
1295 1295
1296 skb = pfkey_xfrm_state2msg(x, 0, hsc); 1296 skb = pfkey_xfrm_state2msg(x, 0, hsc);
@@ -1337,9 +1337,9 @@ static int pfkey_add(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
1337 } 1337 }
1338 1338
1339 if (hdr->sadb_msg_type == SADB_ADD) 1339 if (hdr->sadb_msg_type == SADB_ADD)
1340 c.event = XFRM_SAP_ADDED; 1340 c.event = XFRM_MSG_NEWSA;
1341 else 1341 else
1342 c.event = XFRM_SAP_UPDATED; 1342 c.event = XFRM_MSG_UPDSA;
1343 c.seq = hdr->sadb_msg_seq; 1343 c.seq = hdr->sadb_msg_seq;
1344 c.pid = hdr->sadb_msg_pid; 1344 c.pid = hdr->sadb_msg_pid;
1345 km_state_notify(x, &c); 1345 km_state_notify(x, &c);
@@ -1376,7 +1376,7 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1376 1376
1377 c.seq = hdr->sadb_msg_seq; 1377 c.seq = hdr->sadb_msg_seq;
1378 c.pid = hdr->sadb_msg_pid; 1378 c.pid = hdr->sadb_msg_pid;
1379 c.event = XFRM_SAP_DELETED; 1379 c.event = XFRM_MSG_DELSA;
1380 km_state_notify(x, &c); 1380 km_state_notify(x, &c);
1381 xfrm_state_put(x); 1381 xfrm_state_put(x);
1382 1382
@@ -1552,7 +1552,7 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
1552 c.data.proto = proto; 1552 c.data.proto = proto;
1553 c.seq = hdr->sadb_msg_seq; 1553 c.seq = hdr->sadb_msg_seq;
1554 c.pid = hdr->sadb_msg_pid; 1554 c.pid = hdr->sadb_msg_pid;
1555 c.event = XFRM_SAP_FLUSHED; 1555 c.event = XFRM_MSG_FLUSHSA;
1556 km_state_notify(NULL, &c); 1556 km_state_notify(NULL, &c);
1557 1557
1558 return 0; 1558 return 0;
@@ -1962,7 +1962,7 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
1962 out_hdr = (struct sadb_msg *) out_skb->data; 1962 out_hdr = (struct sadb_msg *) out_skb->data;
1963 out_hdr->sadb_msg_version = PF_KEY_V2; 1963 out_hdr->sadb_msg_version = PF_KEY_V2;
1964 1964
1965 if (c->data.byid && c->event == XFRM_SAP_DELETED) 1965 if (c->data.byid && c->event == XFRM_MSG_DELPOLICY)
1966 out_hdr->sadb_msg_type = SADB_X_SPDDELETE2; 1966 out_hdr->sadb_msg_type = SADB_X_SPDDELETE2;
1967 else 1967 else
1968 out_hdr->sadb_msg_type = event2poltype(c->event); 1968 out_hdr->sadb_msg_type = event2poltype(c->event);
@@ -2058,9 +2058,9 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2058 } 2058 }
2059 2059
2060 if (hdr->sadb_msg_type == SADB_X_SPDUPDATE) 2060 if (hdr->sadb_msg_type == SADB_X_SPDUPDATE)
2061 c.event = XFRM_SAP_UPDATED; 2061 c.event = XFRM_MSG_UPDPOLICY;
2062 else 2062 else
2063 c.event = XFRM_SAP_ADDED; 2063 c.event = XFRM_MSG_NEWPOLICY;
2064 2064
2065 c.seq = hdr->sadb_msg_seq; 2065 c.seq = hdr->sadb_msg_seq;
2066 c.pid = hdr->sadb_msg_pid; 2066 c.pid = hdr->sadb_msg_pid;
@@ -2118,7 +2118,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
2118 2118
2119 c.seq = hdr->sadb_msg_seq; 2119 c.seq = hdr->sadb_msg_seq;
2120 c.pid = hdr->sadb_msg_pid; 2120 c.pid = hdr->sadb_msg_pid;
2121 c.event = XFRM_SAP_DELETED; 2121 c.event = XFRM_MSG_DELPOLICY;
2122 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); 2122 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c);
2123 2123
2124 xfrm_pol_put(xp); 2124 xfrm_pol_put(xp);
@@ -2174,7 +2174,7 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2174 c.pid = hdr->sadb_msg_pid; 2174 c.pid = hdr->sadb_msg_pid;
2175 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) { 2175 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) {
2176 c.data.byid = 1; 2176 c.data.byid = 1;
2177 c.event = XFRM_SAP_DELETED; 2177 c.event = XFRM_MSG_DELPOLICY;
2178 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); 2178 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c);
2179 } else { 2179 } else {
2180 err = key_pol_get_resp(sk, xp, hdr, pol->sadb_x_policy_dir-1); 2180 err = key_pol_get_resp(sk, xp, hdr, pol->sadb_x_policy_dir-1);
@@ -2238,7 +2238,7 @@ static int pfkey_spdflush(struct sock *sk, struct sk_buff *skb, struct sadb_msg
2238 struct km_event c; 2238 struct km_event c;
2239 2239
2240 xfrm_policy_flush(); 2240 xfrm_policy_flush();
2241 c.event = XFRM_SAP_FLUSHED; 2241 c.event = XFRM_MSG_FLUSHPOLICY;
2242 c.pid = hdr->sadb_msg_pid; 2242 c.pid = hdr->sadb_msg_pid;
2243 c.seq = hdr->sadb_msg_seq; 2243 c.seq = hdr->sadb_msg_seq;
2244 km_policy_notify(NULL, 0, &c); 2244 km_policy_notify(NULL, 0, &c);
@@ -2479,13 +2479,13 @@ static int key_notify_sa_expire(struct xfrm_state *x, struct km_event *c)
2479static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c) 2479static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c)
2480{ 2480{
2481 switch (c->event) { 2481 switch (c->event) {
2482 case XFRM_SAP_EXPIRED: 2482 case XFRM_MSG_EXPIRE:
2483 return key_notify_sa_expire(x, c); 2483 return key_notify_sa_expire(x, c);
2484 case XFRM_SAP_DELETED: 2484 case XFRM_MSG_DELSA:
2485 case XFRM_SAP_ADDED: 2485 case XFRM_MSG_NEWSA:
2486 case XFRM_SAP_UPDATED: 2486 case XFRM_MSG_UPDSA:
2487 return key_notify_sa(x, c); 2487 return key_notify_sa(x, c);
2488 case XFRM_SAP_FLUSHED: 2488 case XFRM_MSG_FLUSHSA:
2489 return key_notify_sa_flush(c); 2489 return key_notify_sa_flush(c);
2490 default: 2490 default:
2491 printk("pfkey: Unknown SA event %d\n", c->event); 2491 printk("pfkey: Unknown SA event %d\n", c->event);
@@ -2498,13 +2498,13 @@ static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c)
2498static int pfkey_send_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c) 2498static int pfkey_send_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c)
2499{ 2499{
2500 switch (c->event) { 2500 switch (c->event) {
2501 case XFRM_SAP_EXPIRED: 2501 case XFRM_MSG_POLEXPIRE:
2502 return key_notify_policy_expire(xp, c); 2502 return key_notify_policy_expire(xp, c);
2503 case XFRM_SAP_DELETED: 2503 case XFRM_MSG_DELPOLICY:
2504 case XFRM_SAP_ADDED: 2504 case XFRM_MSG_NEWPOLICY:
2505 case XFRM_SAP_UPDATED: 2505 case XFRM_MSG_UPDPOLICY:
2506 return key_notify_policy(xp, dir, c); 2506 return key_notify_policy(xp, dir, c);
2507 case XFRM_SAP_FLUSHED: 2507 case XFRM_MSG_FLUSHPOLICY:
2508 return key_notify_policy_flush(c); 2508 return key_notify_policy_flush(c);
2509 default: 2509 default:
2510 printk("pfkey: Unknown policy event %d\n", c->event); 2510 printk("pfkey: Unknown policy event %d\n", c->event);