diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2005-06-19 01:44:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-19 01:44:37 -0400 |
commit | f60f6b8f70c756fc786d68f02ec17a1e84db645f (patch) | |
tree | 8eee05de129439e4ffde876d2208a613178acfe3 /net | |
parent | e7443892f656d760ec1b9d92567178c87e100f4a (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')
-rw-r--r-- | net/key/af_key.c | 60 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 4 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 63 |
3 files changed, 50 insertions, 77 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 * | |||
1248 | static inline int event2poltype(int event) | 1248 | static 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) | |||
1267 | static inline int event2keytype(int event) | 1267 | static 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) | |||
2479 | static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c) | 2479 | static 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) | |||
2498 | static int pfkey_send_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c) | 2498 | static 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); |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index e068bd721050..2537f26f097c 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -836,7 +836,7 @@ static void km_state_expired(struct xfrm_state *x, int hard) | |||
836 | struct km_event c; | 836 | struct km_event c; |
837 | 837 | ||
838 | c.data.hard = hard; | 838 | c.data.hard = hard; |
839 | c.event = XFRM_SAP_EXPIRED; | 839 | c.event = XFRM_MSG_EXPIRE; |
840 | km_state_notify(x, &c); | 840 | km_state_notify(x, &c); |
841 | 841 | ||
842 | if (hard) | 842 | if (hard) |
@@ -884,7 +884,7 @@ void km_policy_expired(struct xfrm_policy *pol, int dir, int hard) | |||
884 | struct km_event c; | 884 | struct km_event c; |
885 | 885 | ||
886 | c.data.hard = hard; | 886 | c.data.hard = hard; |
887 | c.event = XFRM_SAP_EXPIRED; | 887 | c.event = XFRM_MSG_POLEXPIRE; |
888 | km_policy_notify(pol, dir, &c); | 888 | km_policy_notify(pol, dir, &c); |
889 | 889 | ||
890 | if (hard) | 890 | if (hard) |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index ff6fc610730e..bc4fd7456873 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -301,10 +301,7 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfrma) | |||
301 | 301 | ||
302 | c.seq = nlh->nlmsg_seq; | 302 | c.seq = nlh->nlmsg_seq; |
303 | c.pid = nlh->nlmsg_pid; | 303 | c.pid = nlh->nlmsg_pid; |
304 | if (nlh->nlmsg_type == XFRM_MSG_NEWSA) | 304 | c.event = nlh->nlmsg_type; |
305 | c.event = XFRM_SAP_ADDED; | ||
306 | else | ||
307 | c.event = XFRM_SAP_UPDATED; | ||
308 | 305 | ||
309 | km_state_notify(x, &c); | 306 | km_state_notify(x, &c); |
310 | xfrm_state_put(x); | 307 | xfrm_state_put(x); |
@@ -336,7 +333,7 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfrma) | |||
336 | 333 | ||
337 | c.seq = nlh->nlmsg_seq; | 334 | c.seq = nlh->nlmsg_seq; |
338 | c.pid = nlh->nlmsg_pid; | 335 | c.pid = nlh->nlmsg_pid; |
339 | c.event = XFRM_SAP_DELETED; | 336 | c.event = nlh->nlmsg_type; |
340 | km_state_notify(x, &c); | 337 | km_state_notify(x, &c); |
341 | xfrm_state_put(x); | 338 | xfrm_state_put(x); |
342 | 339 | ||
@@ -728,11 +725,7 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr | |||
728 | return err; | 725 | return err; |
729 | } | 726 | } |
730 | 727 | ||
731 | if (!excl) | 728 | c.event = nlh->nlmsg_type; |
732 | c.event = XFRM_SAP_UPDATED; | ||
733 | else | ||
734 | c.event = XFRM_SAP_ADDED; | ||
735 | |||
736 | c.seq = nlh->nlmsg_seq; | 729 | c.seq = nlh->nlmsg_seq; |
737 | c.pid = nlh->nlmsg_pid; | 730 | c.pid = nlh->nlmsg_pid; |
738 | km_policy_notify(xp, p->dir, &c); | 731 | km_policy_notify(xp, p->dir, &c); |
@@ -884,7 +877,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr | |||
884 | } | 877 | } |
885 | } else { | 878 | } else { |
886 | c.data.byid = p->index; | 879 | c.data.byid = p->index; |
887 | c.event = XFRM_SAP_DELETED; | 880 | c.event = nlh->nlmsg_type; |
888 | c.seq = nlh->nlmsg_seq; | 881 | c.seq = nlh->nlmsg_seq; |
889 | c.pid = nlh->nlmsg_pid; | 882 | c.pid = nlh->nlmsg_pid; |
890 | km_policy_notify(xp, p->dir, &c); | 883 | km_policy_notify(xp, p->dir, &c); |
@@ -902,7 +895,7 @@ static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfrma | |||
902 | 895 | ||
903 | xfrm_state_flush(p->proto); | 896 | xfrm_state_flush(p->proto); |
904 | c.data.proto = p->proto; | 897 | c.data.proto = p->proto; |
905 | c.event = XFRM_SAP_FLUSHED; | 898 | c.event = nlh->nlmsg_type; |
906 | c.seq = nlh->nlmsg_seq; | 899 | c.seq = nlh->nlmsg_seq; |
907 | c.pid = nlh->nlmsg_pid; | 900 | c.pid = nlh->nlmsg_pid; |
908 | km_state_notify(NULL, &c); | 901 | km_state_notify(NULL, &c); |
@@ -915,7 +908,7 @@ static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **x | |||
915 | struct km_event c; | 908 | struct km_event c; |
916 | 909 | ||
917 | xfrm_policy_flush(); | 910 | xfrm_policy_flush(); |
918 | c.event = XFRM_SAP_FLUSHED; | 911 | c.event = nlh->nlmsg_type; |
919 | c.seq = nlh->nlmsg_seq; | 912 | c.seq = nlh->nlmsg_seq; |
920 | c.pid = nlh->nlmsg_pid; | 913 | c.pid = nlh->nlmsg_pid; |
921 | km_policy_notify(NULL, 0, &c); | 914 | km_policy_notify(NULL, 0, &c); |
@@ -1193,7 +1186,6 @@ static int xfrm_notify_sa(struct xfrm_state *x, struct km_event *c) | |||
1193 | struct xfrm_usersa_info *p; | 1186 | struct xfrm_usersa_info *p; |
1194 | struct nlmsghdr *nlh; | 1187 | struct nlmsghdr *nlh; |
1195 | struct sk_buff *skb; | 1188 | struct sk_buff *skb; |
1196 | u32 nlt; | ||
1197 | unsigned char *b; | 1189 | unsigned char *b; |
1198 | int len = xfrm_sa_len(x); | 1190 | int len = xfrm_sa_len(x); |
1199 | 1191 | ||
@@ -1202,16 +1194,7 @@ static int xfrm_notify_sa(struct xfrm_state *x, struct km_event *c) | |||
1202 | return -ENOMEM; | 1194 | return -ENOMEM; |
1203 | b = skb->tail; | 1195 | b = skb->tail; |
1204 | 1196 | ||
1205 | if (c->event == XFRM_SAP_ADDED) | 1197 | nlh = NLMSG_PUT(skb, c->pid, c->seq, c->event, sizeof(*p)); |
1206 | nlt = XFRM_MSG_NEWSA; | ||
1207 | else if (c->event == XFRM_SAP_UPDATED) | ||
1208 | nlt = XFRM_MSG_UPDSA; | ||
1209 | else if (c->event == XFRM_SAP_DELETED) | ||
1210 | nlt = XFRM_MSG_DELSA; | ||
1211 | else | ||
1212 | goto nlmsg_failure; | ||
1213 | |||
1214 | nlh = NLMSG_PUT(skb, c->pid, c->seq, nlt, sizeof(*p)); | ||
1215 | nlh->nlmsg_flags = 0; | 1198 | nlh->nlmsg_flags = 0; |
1216 | 1199 | ||
1217 | p = NLMSG_DATA(nlh); | 1200 | p = NLMSG_DATA(nlh); |
@@ -1243,13 +1226,13 @@ static int xfrm_send_state_notify(struct xfrm_state *x, struct km_event *c) | |||
1243 | { | 1226 | { |
1244 | 1227 | ||
1245 | switch (c->event) { | 1228 | switch (c->event) { |
1246 | case XFRM_SAP_EXPIRED: | 1229 | case XFRM_MSG_EXPIRE: |
1247 | return xfrm_exp_state_notify(x, c); | 1230 | return xfrm_exp_state_notify(x, c); |
1248 | case XFRM_SAP_DELETED: | 1231 | case XFRM_MSG_DELSA: |
1249 | case XFRM_SAP_UPDATED: | 1232 | case XFRM_MSG_UPDSA: |
1250 | case XFRM_SAP_ADDED: | 1233 | case XFRM_MSG_NEWSA: |
1251 | return xfrm_notify_sa(x, c); | 1234 | return xfrm_notify_sa(x, c); |
1252 | case XFRM_SAP_FLUSHED: | 1235 | case XFRM_MSG_FLUSHSA: |
1253 | return xfrm_notify_sa_flush(c); | 1236 | return xfrm_notify_sa_flush(c); |
1254 | default: | 1237 | default: |
1255 | printk("xfrm_user: Unknown SA event %d\n", c->event); | 1238 | printk("xfrm_user: Unknown SA event %d\n", c->event); |
@@ -1417,7 +1400,6 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, struct km_event * | |||
1417 | struct xfrm_userpolicy_info *p; | 1400 | struct xfrm_userpolicy_info *p; |
1418 | struct nlmsghdr *nlh; | 1401 | struct nlmsghdr *nlh; |
1419 | struct sk_buff *skb; | 1402 | struct sk_buff *skb; |
1420 | u32 nlt = 0 ; | ||
1421 | unsigned char *b; | 1403 | unsigned char *b; |
1422 | int len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); | 1404 | int len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); |
1423 | len += NLMSG_SPACE(sizeof(struct xfrm_userpolicy_info)); | 1405 | len += NLMSG_SPACE(sizeof(struct xfrm_userpolicy_info)); |
@@ -1427,16 +1409,7 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, struct km_event * | |||
1427 | return -ENOMEM; | 1409 | return -ENOMEM; |
1428 | b = skb->tail; | 1410 | b = skb->tail; |
1429 | 1411 | ||
1430 | if (c->event == XFRM_SAP_ADDED) | 1412 | nlh = NLMSG_PUT(skb, c->pid, c->seq, c->event, sizeof(*p)); |
1431 | nlt = XFRM_MSG_NEWPOLICY; | ||
1432 | else if (c->event == XFRM_SAP_UPDATED) | ||
1433 | nlt = XFRM_MSG_UPDPOLICY; | ||
1434 | else if (c->event == XFRM_SAP_DELETED) | ||
1435 | nlt = XFRM_MSG_DELPOLICY; | ||
1436 | else | ||
1437 | goto nlmsg_failure; | ||
1438 | |||
1439 | nlh = NLMSG_PUT(skb, c->pid, c->seq, nlt, sizeof(*p)); | ||
1440 | 1413 | ||
1441 | p = NLMSG_DATA(nlh); | 1414 | p = NLMSG_DATA(nlh); |
1442 | 1415 | ||
@@ -1483,13 +1456,13 @@ static int xfrm_send_policy_notify(struct xfrm_policy *xp, int dir, struct km_ev | |||
1483 | { | 1456 | { |
1484 | 1457 | ||
1485 | switch (c->event) { | 1458 | switch (c->event) { |
1486 | case XFRM_SAP_ADDED: | 1459 | case XFRM_MSG_NEWPOLICY: |
1487 | case XFRM_SAP_UPDATED: | 1460 | case XFRM_MSG_UPDPOLICY: |
1488 | case XFRM_SAP_DELETED: | 1461 | case XFRM_MSG_DELPOLICY: |
1489 | return xfrm_notify_policy(xp, dir, c); | 1462 | return xfrm_notify_policy(xp, dir, c); |
1490 | case XFRM_SAP_FLUSHED: | 1463 | case XFRM_MSG_FLUSHPOLICY: |
1491 | return xfrm_notify_policy_flush(c); | 1464 | return xfrm_notify_policy_flush(c); |
1492 | case XFRM_SAP_EXPIRED: | 1465 | case XFRM_MSG_POLEXPIRE: |
1493 | return xfrm_exp_policy_notify(xp, dir, c); | 1466 | return xfrm_exp_policy_notify(xp, dir, c); |
1494 | default: | 1467 | default: |
1495 | printk("xfrm_user: Unknown Policy event %d\n", c->event); | 1468 | printk("xfrm_user: Unknown Policy event %d\n", c->event); |