diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-24 00:28:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-24 02:07:41 -0500 |
commit | 183cad12785ffc036571c4b789dc084ec61a1bad (patch) | |
tree | 85cdd5f0952b9404c24dcfae77f2f2158e19c8ad | |
parent | dd701754e7d230330adc0e212b94106bbfd34841 (diff) |
xfrm: Const'ify pointer args to km_migrate() and implementations.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/xfrm.h | 12 | ||||
-rw-r--r-- | net/key/af_key.c | 22 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 6 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 24 |
4 files changed, 34 insertions, 30 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index b60f9564fb8d..17b296b19982 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -556,7 +556,11 @@ struct xfrm_mgr { | |||
556 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); | 556 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); |
557 | int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c); | 557 | int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c); |
558 | int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); | 558 | int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); |
559 | int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k); | 559 | int (*migrate)(const struct xfrm_selector *sel, |
560 | u8 dir, u8 type, | ||
561 | const struct xfrm_migrate *m, | ||
562 | int num_bundles, | ||
563 | const struct xfrm_kmaddress *k); | ||
560 | }; | 564 | }; |
561 | 565 | ||
562 | extern int xfrm_register_km(struct xfrm_mgr *km); | 566 | extern int xfrm_register_km(struct xfrm_mgr *km); |
@@ -1483,9 +1487,9 @@ struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, | |||
1483 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 1487 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
1484 | 1488 | ||
1485 | #ifdef CONFIG_XFRM_MIGRATE | 1489 | #ifdef CONFIG_XFRM_MIGRATE |
1486 | extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 1490 | extern int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, |
1487 | struct xfrm_migrate *m, int num_bundles, | 1491 | const struct xfrm_migrate *m, int num_bundles, |
1488 | struct xfrm_kmaddress *k); | 1492 | const struct xfrm_kmaddress *k); |
1489 | extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); | 1493 | extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); |
1490 | extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, | 1494 | extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, |
1491 | struct xfrm_migrate *m); | 1495 | struct xfrm_migrate *m); |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 7c5e101e7c28..56372853142a 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -690,7 +690,7 @@ static inline int pfkey_mode_to_xfrm(int mode) | |||
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | static unsigned int pfkey_sockaddr_fill(xfrm_address_t *xaddr, __be16 port, | 693 | static unsigned int pfkey_sockaddr_fill(const xfrm_address_t *xaddr, __be16 port, |
694 | struct sockaddr *sa, | 694 | struct sockaddr *sa, |
695 | unsigned short family) | 695 | unsigned short family) |
696 | { | 696 | { |
@@ -3318,7 +3318,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, | |||
3318 | 3318 | ||
3319 | #ifdef CONFIG_NET_KEY_MIGRATE | 3319 | #ifdef CONFIG_NET_KEY_MIGRATE |
3320 | static int set_sadb_address(struct sk_buff *skb, int sasize, int type, | 3320 | static int set_sadb_address(struct sk_buff *skb, int sasize, int type, |
3321 | struct xfrm_selector *sel) | 3321 | const struct xfrm_selector *sel) |
3322 | { | 3322 | { |
3323 | struct sadb_address *addr; | 3323 | struct sadb_address *addr; |
3324 | addr = (struct sadb_address *)skb_put(skb, sizeof(struct sadb_address) + sasize); | 3324 | addr = (struct sadb_address *)skb_put(skb, sizeof(struct sadb_address) + sasize); |
@@ -3348,7 +3348,7 @@ static int set_sadb_address(struct sk_buff *skb, int sasize, int type, | |||
3348 | } | 3348 | } |
3349 | 3349 | ||
3350 | 3350 | ||
3351 | static int set_sadb_kmaddress(struct sk_buff *skb, struct xfrm_kmaddress *k) | 3351 | static int set_sadb_kmaddress(struct sk_buff *skb, const struct xfrm_kmaddress *k) |
3352 | { | 3352 | { |
3353 | struct sadb_x_kmaddress *kma; | 3353 | struct sadb_x_kmaddress *kma; |
3354 | u8 *sa; | 3354 | u8 *sa; |
@@ -3376,7 +3376,7 @@ static int set_sadb_kmaddress(struct sk_buff *skb, struct xfrm_kmaddress *k) | |||
3376 | static int set_ipsecrequest(struct sk_buff *skb, | 3376 | static int set_ipsecrequest(struct sk_buff *skb, |
3377 | uint8_t proto, uint8_t mode, int level, | 3377 | uint8_t proto, uint8_t mode, int level, |
3378 | uint32_t reqid, uint8_t family, | 3378 | uint32_t reqid, uint8_t family, |
3379 | xfrm_address_t *src, xfrm_address_t *dst) | 3379 | const xfrm_address_t *src, const xfrm_address_t *dst) |
3380 | { | 3380 | { |
3381 | struct sadb_x_ipsecrequest *rq; | 3381 | struct sadb_x_ipsecrequest *rq; |
3382 | u8 *sa; | 3382 | u8 *sa; |
@@ -3404,9 +3404,9 @@ static int set_ipsecrequest(struct sk_buff *skb, | |||
3404 | #endif | 3404 | #endif |
3405 | 3405 | ||
3406 | #ifdef CONFIG_NET_KEY_MIGRATE | 3406 | #ifdef CONFIG_NET_KEY_MIGRATE |
3407 | static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 3407 | static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, |
3408 | struct xfrm_migrate *m, int num_bundles, | 3408 | const struct xfrm_migrate *m, int num_bundles, |
3409 | struct xfrm_kmaddress *k) | 3409 | const struct xfrm_kmaddress *k) |
3410 | { | 3410 | { |
3411 | int i; | 3411 | int i; |
3412 | int sasize_sel; | 3412 | int sasize_sel; |
@@ -3415,7 +3415,7 @@ static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | |||
3415 | struct sk_buff *skb; | 3415 | struct sk_buff *skb; |
3416 | struct sadb_msg *hdr; | 3416 | struct sadb_msg *hdr; |
3417 | struct sadb_x_policy *pol; | 3417 | struct sadb_x_policy *pol; |
3418 | struct xfrm_migrate *mp; | 3418 | const struct xfrm_migrate *mp; |
3419 | 3419 | ||
3420 | if (type != XFRM_POLICY_TYPE_MAIN) | 3420 | if (type != XFRM_POLICY_TYPE_MAIN) |
3421 | return 0; | 3421 | return 0; |
@@ -3513,9 +3513,9 @@ err: | |||
3513 | return -EINVAL; | 3513 | return -EINVAL; |
3514 | } | 3514 | } |
3515 | #else | 3515 | #else |
3516 | static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 3516 | static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, |
3517 | struct xfrm_migrate *m, int num_bundles, | 3517 | const struct xfrm_migrate *m, int num_bundles, |
3518 | struct xfrm_kmaddress *k) | 3518 | const struct xfrm_kmaddress *k) |
3519 | { | 3519 | { |
3520 | return -ENOPROTOOPT; | 3520 | return -ENOPROTOOPT; |
3521 | } | 3521 | } |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 7028f063f093..555beddb63f0 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1819,9 +1819,9 @@ void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid) | |||
1819 | EXPORT_SYMBOL(km_policy_expired); | 1819 | EXPORT_SYMBOL(km_policy_expired); |
1820 | 1820 | ||
1821 | #ifdef CONFIG_XFRM_MIGRATE | 1821 | #ifdef CONFIG_XFRM_MIGRATE |
1822 | int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 1822 | int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, |
1823 | struct xfrm_migrate *m, int num_migrate, | 1823 | const struct xfrm_migrate *m, int num_migrate, |
1824 | struct xfrm_kmaddress *k) | 1824 | const struct xfrm_kmaddress *k) |
1825 | { | 1825 | { |
1826 | int err = -EINVAL; | 1826 | int err = -EINVAL; |
1827 | int ret; | 1827 | int ret; |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 2cc9dab29887..b43c1b1240d4 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1986,7 +1986,7 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1986 | #endif | 1986 | #endif |
1987 | 1987 | ||
1988 | #ifdef CONFIG_XFRM_MIGRATE | 1988 | #ifdef CONFIG_XFRM_MIGRATE |
1989 | static int copy_to_user_migrate(struct xfrm_migrate *m, struct sk_buff *skb) | 1989 | static int copy_to_user_migrate(const struct xfrm_migrate *m, struct sk_buff *skb) |
1990 | { | 1990 | { |
1991 | struct xfrm_user_migrate um; | 1991 | struct xfrm_user_migrate um; |
1992 | 1992 | ||
@@ -2004,7 +2004,7 @@ static int copy_to_user_migrate(struct xfrm_migrate *m, struct sk_buff *skb) | |||
2004 | return nla_put(skb, XFRMA_MIGRATE, sizeof(um), &um); | 2004 | return nla_put(skb, XFRMA_MIGRATE, sizeof(um), &um); |
2005 | } | 2005 | } |
2006 | 2006 | ||
2007 | static int copy_to_user_kmaddress(struct xfrm_kmaddress *k, struct sk_buff *skb) | 2007 | static int copy_to_user_kmaddress(const struct xfrm_kmaddress *k, struct sk_buff *skb) |
2008 | { | 2008 | { |
2009 | struct xfrm_user_kmaddress uk; | 2009 | struct xfrm_user_kmaddress uk; |
2010 | 2010 | ||
@@ -2025,11 +2025,11 @@ static inline size_t xfrm_migrate_msgsize(int num_migrate, int with_kma) | |||
2025 | + userpolicy_type_attrsize(); | 2025 | + userpolicy_type_attrsize(); |
2026 | } | 2026 | } |
2027 | 2027 | ||
2028 | static int build_migrate(struct sk_buff *skb, struct xfrm_migrate *m, | 2028 | static int build_migrate(struct sk_buff *skb, const struct xfrm_migrate *m, |
2029 | int num_migrate, struct xfrm_kmaddress *k, | 2029 | int num_migrate, const struct xfrm_kmaddress *k, |
2030 | struct xfrm_selector *sel, u8 dir, u8 type) | 2030 | const struct xfrm_selector *sel, u8 dir, u8 type) |
2031 | { | 2031 | { |
2032 | struct xfrm_migrate *mp; | 2032 | const struct xfrm_migrate *mp; |
2033 | struct xfrm_userpolicy_id *pol_id; | 2033 | struct xfrm_userpolicy_id *pol_id; |
2034 | struct nlmsghdr *nlh; | 2034 | struct nlmsghdr *nlh; |
2035 | int i; | 2035 | int i; |
@@ -2061,9 +2061,9 @@ nlmsg_failure: | |||
2061 | return -EMSGSIZE; | 2061 | return -EMSGSIZE; |
2062 | } | 2062 | } |
2063 | 2063 | ||
2064 | static int xfrm_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 2064 | static int xfrm_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, |
2065 | struct xfrm_migrate *m, int num_migrate, | 2065 | const struct xfrm_migrate *m, int num_migrate, |
2066 | struct xfrm_kmaddress *k) | 2066 | const struct xfrm_kmaddress *k) |
2067 | { | 2067 | { |
2068 | struct net *net = &init_net; | 2068 | struct net *net = &init_net; |
2069 | struct sk_buff *skb; | 2069 | struct sk_buff *skb; |
@@ -2079,9 +2079,9 @@ static int xfrm_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | |||
2079 | return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_MIGRATE, GFP_ATOMIC); | 2079 | return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_MIGRATE, GFP_ATOMIC); |
2080 | } | 2080 | } |
2081 | #else | 2081 | #else |
2082 | static int xfrm_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 2082 | static int xfrm_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, |
2083 | struct xfrm_migrate *m, int num_migrate, | 2083 | const struct xfrm_migrate *m, int num_migrate, |
2084 | struct xfrm_kmaddress *k) | 2084 | const struct xfrm_kmaddress *k) |
2085 | { | 2085 | { |
2086 | return -ENOPROTOOPT; | 2086 | return -ENOPROTOOPT; |
2087 | } | 2087 | } |