diff options
Diffstat (limited to 'include/net')
69 files changed, 2019 insertions, 1152 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h index 11e9eaf79f5a..8b06c2f3657f 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
| @@ -8,70 +8,110 @@ | |||
| 8 | #include <net/sch_generic.h> | 8 | #include <net/sch_generic.h> |
| 9 | #include <net/pkt_sched.h> | 9 | #include <net/pkt_sched.h> |
| 10 | 10 | ||
| 11 | #define tca_gen(name) \ | 11 | struct tcf_common { |
| 12 | struct tcf_##name *next; \ | 12 | struct tcf_common *tcfc_next; |
| 13 | u32 index; \ | 13 | u32 tcfc_index; |
| 14 | int refcnt; \ | 14 | int tcfc_refcnt; |
| 15 | int bindcnt; \ | 15 | int tcfc_bindcnt; |
| 16 | u32 capab; \ | 16 | u32 tcfc_capab; |
| 17 | int action; \ | 17 | int tcfc_action; |
| 18 | struct tcf_t tm; \ | 18 | struct tcf_t tcfc_tm; |
| 19 | struct gnet_stats_basic bstats; \ | 19 | struct gnet_stats_basic tcfc_bstats; |
| 20 | struct gnet_stats_queue qstats; \ | 20 | struct gnet_stats_queue tcfc_qstats; |
| 21 | struct gnet_stats_rate_est rate_est; \ | 21 | struct gnet_stats_rate_est tcfc_rate_est; |
| 22 | spinlock_t *stats_lock; \ | 22 | spinlock_t *tcfc_stats_lock; |
| 23 | spinlock_t lock | 23 | spinlock_t tcfc_lock; |
| 24 | 24 | }; | |
| 25 | struct tcf_police | 25 | #define tcf_next common.tcfc_next |
| 26 | { | 26 | #define tcf_index common.tcfc_index |
| 27 | tca_gen(police); | 27 | #define tcf_refcnt common.tcfc_refcnt |
| 28 | int result; | 28 | #define tcf_bindcnt common.tcfc_bindcnt |
| 29 | u32 ewma_rate; | 29 | #define tcf_capab common.tcfc_capab |
| 30 | u32 burst; | 30 | #define tcf_action common.tcfc_action |
| 31 | u32 mtu; | 31 | #define tcf_tm common.tcfc_tm |
| 32 | u32 toks; | 32 | #define tcf_bstats common.tcfc_bstats |
| 33 | u32 ptoks; | 33 | #define tcf_qstats common.tcfc_qstats |
| 34 | psched_time_t t_c; | 34 | #define tcf_rate_est common.tcfc_rate_est |
| 35 | struct qdisc_rate_table *R_tab; | 35 | #define tcf_stats_lock common.tcfc_stats_lock |
| 36 | struct qdisc_rate_table *P_tab; | 36 | #define tcf_lock common.tcfc_lock |
| 37 | |||
| 38 | struct tcf_police { | ||
| 39 | struct tcf_common common; | ||
| 40 | int tcfp_result; | ||
| 41 | u32 tcfp_ewma_rate; | ||
| 42 | u32 tcfp_burst; | ||
| 43 | u32 tcfp_mtu; | ||
| 44 | u32 tcfp_toks; | ||
| 45 | u32 tcfp_ptoks; | ||
| 46 | psched_time_t tcfp_t_c; | ||
| 47 | struct qdisc_rate_table *tcfp_R_tab; | ||
| 48 | struct qdisc_rate_table *tcfp_P_tab; | ||
| 37 | }; | 49 | }; |
| 50 | #define to_police(pc) \ | ||
| 51 | container_of(pc, struct tcf_police, common) | ||
| 52 | |||
| 53 | struct tcf_hashinfo { | ||
| 54 | struct tcf_common **htab; | ||
| 55 | unsigned int hmask; | ||
| 56 | rwlock_t *lock; | ||
| 57 | }; | ||
| 58 | |||
| 59 | static inline unsigned int tcf_hash(u32 index, unsigned int hmask) | ||
| 60 | { | ||
| 61 | return index & hmask; | ||
| 62 | } | ||
| 38 | 63 | ||
| 39 | #ifdef CONFIG_NET_CLS_ACT | 64 | #ifdef CONFIG_NET_CLS_ACT |
| 40 | 65 | ||
| 41 | #define ACT_P_CREATED 1 | 66 | #define ACT_P_CREATED 1 |
| 42 | #define ACT_P_DELETED 1 | 67 | #define ACT_P_DELETED 1 |
| 43 | 68 | ||
| 44 | struct tcf_act_hdr | 69 | struct tcf_act_hdr { |
| 45 | { | 70 | struct tcf_common common; |
| 46 | tca_gen(act_hdr); | ||
| 47 | }; | 71 | }; |
| 48 | 72 | ||
| 49 | struct tc_action | 73 | struct tc_action { |
| 50 | { | 74 | void *priv; |
| 51 | void *priv; | 75 | struct tc_action_ops *ops; |
| 52 | struct tc_action_ops *ops; | 76 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ |
| 53 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ | 77 | __u32 order; |
| 54 | __u32 order; | 78 | struct tc_action *next; |
| 55 | struct tc_action *next; | ||
| 56 | }; | 79 | }; |
| 57 | 80 | ||
| 58 | #define TCA_CAP_NONE 0 | 81 | #define TCA_CAP_NONE 0 |
| 59 | struct tc_action_ops | 82 | struct tc_action_ops { |
| 60 | { | ||
| 61 | struct tc_action_ops *next; | 83 | struct tc_action_ops *next; |
| 84 | struct tcf_hashinfo *hinfo; | ||
| 62 | char kind[IFNAMSIZ]; | 85 | char kind[IFNAMSIZ]; |
| 63 | __u32 type; /* TBD to match kind */ | 86 | __u32 type; /* TBD to match kind */ |
| 64 | __u32 capab; /* capabilities includes 4 bit version */ | 87 | __u32 capab; /* capabilities includes 4 bit version */ |
| 65 | struct module *owner; | 88 | struct module *owner; |
| 66 | int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); | 89 | int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); |
| 67 | int (*get_stats)(struct sk_buff *, struct tc_action *); | 90 | int (*get_stats)(struct sk_buff *, struct tc_action *); |
| 68 | int (*dump)(struct sk_buff *, struct tc_action *,int , int); | 91 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); |
| 69 | int (*cleanup)(struct tc_action *, int bind); | 92 | int (*cleanup)(struct tc_action *, int bind); |
| 70 | int (*lookup)(struct tc_action *, u32 ); | 93 | int (*lookup)(struct tc_action *, u32); |
| 71 | int (*init)(struct rtattr *,struct rtattr *,struct tc_action *, int , int ); | 94 | int (*init)(struct rtattr *, struct rtattr *, struct tc_action *, int , int); |
| 72 | int (*walk)(struct sk_buff *, struct netlink_callback *, int , struct tc_action *); | 95 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); |
| 73 | }; | 96 | }; |
| 74 | 97 | ||
| 98 | extern struct tcf_common *tcf_hash_lookup(u32 index, | ||
| 99 | struct tcf_hashinfo *hinfo); | ||
| 100 | extern void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo); | ||
| 101 | extern int tcf_hash_release(struct tcf_common *p, int bind, | ||
| 102 | struct tcf_hashinfo *hinfo); | ||
| 103 | extern int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb, | ||
| 104 | int type, struct tc_action *a); | ||
| 105 | extern u32 tcf_hash_new_index(u32 *idx_gen, struct tcf_hashinfo *hinfo); | ||
| 106 | extern int tcf_hash_search(struct tc_action *a, u32 index); | ||
| 107 | extern struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, | ||
| 108 | int bind, struct tcf_hashinfo *hinfo); | ||
| 109 | extern struct tcf_common *tcf_hash_create(u32 index, struct rtattr *est, | ||
| 110 | struct tc_action *a, int size, | ||
| 111 | int bind, u32 *idx_gen, | ||
| 112 | struct tcf_hashinfo *hinfo); | ||
| 113 | extern void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo); | ||
| 114 | |||
| 75 | extern int tcf_register_action(struct tc_action_ops *a); | 115 | extern int tcf_register_action(struct tc_action_ops *a); |
| 76 | extern int tcf_unregister_action(struct tc_action_ops *a); | 116 | extern int tcf_unregister_action(struct tc_action_ops *a); |
| 77 | extern void tcf_action_destroy(struct tc_action *a, int bind); | 117 | extern void tcf_action_destroy(struct tc_action *a, int bind); |
| @@ -96,17 +136,17 @@ tcf_police_release(struct tcf_police *p, int bind) | |||
| 96 | int ret = 0; | 136 | int ret = 0; |
| 97 | #ifdef CONFIG_NET_CLS_ACT | 137 | #ifdef CONFIG_NET_CLS_ACT |
| 98 | if (p) { | 138 | if (p) { |
| 99 | if (bind) { | 139 | if (bind) |
| 100 | p->bindcnt--; | 140 | p->tcf_bindcnt--; |
| 101 | } | 141 | |
| 102 | p->refcnt--; | 142 | p->tcf_refcnt--; |
| 103 | if (p->refcnt <= 0 && !p->bindcnt) { | 143 | if (p->tcf_refcnt <= 0 && !p->tcf_bindcnt) { |
| 104 | tcf_police_destroy(p); | 144 | tcf_police_destroy(p); |
| 105 | ret = 1; | 145 | ret = 1; |
| 106 | } | 146 | } |
| 107 | } | 147 | } |
| 108 | #else | 148 | #else |
| 109 | if (p && --p->refcnt == 0) | 149 | if (p && --p->tcf_refcnt == 0) |
| 110 | tcf_police_destroy(p); | 150 | tcf_police_destroy(p); |
| 111 | 151 | ||
| 112 | #endif /* CONFIG_NET_CLS_ACT */ | 152 | #endif /* CONFIG_NET_CLS_ACT */ |
diff --git a/include/net/act_generic.h b/include/net/act_generic.h deleted file mode 100644 index c9daa7e52300..000000000000 --- a/include/net/act_generic.h +++ /dev/null | |||
| @@ -1,142 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/net/act_generic.h | ||
| 3 | * | ||
| 4 | */ | ||
| 5 | #ifndef _NET_ACT_GENERIC_H | ||
| 6 | #define _NET_ACT_GENERIC_H | ||
| 7 | static inline int tcf_defact_release(struct tcf_defact *p, int bind) | ||
| 8 | { | ||
| 9 | int ret = 0; | ||
| 10 | if (p) { | ||
| 11 | if (bind) { | ||
| 12 | p->bindcnt--; | ||
| 13 | } | ||
| 14 | p->refcnt--; | ||
| 15 | if (p->bindcnt <= 0 && p->refcnt <= 0) { | ||
| 16 | kfree(p->defdata); | ||
| 17 | tcf_hash_destroy(p); | ||
| 18 | ret = 1; | ||
| 19 | } | ||
| 20 | } | ||
| 21 | return ret; | ||
| 22 | } | ||
| 23 | |||
| 24 | static inline int | ||
| 25 | alloc_defdata(struct tcf_defact *p, u32 datalen, void *defdata) | ||
| 26 | { | ||
| 27 | p->defdata = kmalloc(datalen, GFP_KERNEL); | ||
| 28 | if (p->defdata == NULL) | ||
| 29 | return -ENOMEM; | ||
| 30 | p->datalen = datalen; | ||
| 31 | memcpy(p->defdata, defdata, datalen); | ||
| 32 | return 0; | ||
| 33 | } | ||
| 34 | |||
| 35 | static inline int | ||
| 36 | realloc_defdata(struct tcf_defact *p, u32 datalen, void *defdata) | ||
| 37 | { | ||
| 38 | /* safer to be just brute force for now */ | ||
| 39 | kfree(p->defdata); | ||
| 40 | return alloc_defdata(p, datalen, defdata); | ||
| 41 | } | ||
| 42 | |||
| 43 | static inline int | ||
| 44 | tcf_defact_init(struct rtattr *rta, struct rtattr *est, | ||
| 45 | struct tc_action *a, int ovr, int bind) | ||
| 46 | { | ||
| 47 | struct rtattr *tb[TCA_DEF_MAX]; | ||
| 48 | struct tc_defact *parm; | ||
| 49 | struct tcf_defact *p; | ||
| 50 | void *defdata; | ||
| 51 | u32 datalen = 0; | ||
| 52 | int ret = 0; | ||
| 53 | |||
| 54 | if (rta == NULL || rtattr_parse_nested(tb, TCA_DEF_MAX, rta) < 0) | ||
| 55 | return -EINVAL; | ||
| 56 | |||
| 57 | if (tb[TCA_DEF_PARMS - 1] == NULL || | ||
| 58 | RTA_PAYLOAD(tb[TCA_DEF_PARMS - 1]) < sizeof(*parm)) | ||
| 59 | return -EINVAL; | ||
| 60 | |||
| 61 | parm = RTA_DATA(tb[TCA_DEF_PARMS - 1]); | ||
| 62 | defdata = RTA_DATA(tb[TCA_DEF_DATA - 1]); | ||
| 63 | if (defdata == NULL) | ||
| 64 | return -EINVAL; | ||
| 65 | |||
| 66 | datalen = RTA_PAYLOAD(tb[TCA_DEF_DATA - 1]); | ||
| 67 | if (datalen <= 0) | ||
| 68 | return -EINVAL; | ||
| 69 | |||
| 70 | p = tcf_hash_check(parm->index, a, ovr, bind); | ||
| 71 | if (p == NULL) { | ||
| 72 | p = tcf_hash_create(parm->index, est, a, sizeof(*p), ovr, bind); | ||
| 73 | if (p == NULL) | ||
| 74 | return -ENOMEM; | ||
| 75 | |||
| 76 | ret = alloc_defdata(p, datalen, defdata); | ||
| 77 | if (ret < 0) { | ||
| 78 | kfree(p); | ||
| 79 | return ret; | ||
| 80 | } | ||
| 81 | ret = ACT_P_CREATED; | ||
| 82 | } else { | ||
| 83 | if (!ovr) { | ||
| 84 | tcf_defact_release(p, bind); | ||
| 85 | return -EEXIST; | ||
| 86 | } | ||
| 87 | realloc_defdata(p, datalen, defdata); | ||
| 88 | } | ||
| 89 | |||
| 90 | spin_lock_bh(&p->lock); | ||
| 91 | p->action = parm->action; | ||
| 92 | spin_unlock_bh(&p->lock); | ||
| 93 | if (ret == ACT_P_CREATED) | ||
| 94 | tcf_hash_insert(p); | ||
| 95 | return ret; | ||
| 96 | } | ||
| 97 | |||
| 98 | static inline int tcf_defact_cleanup(struct tc_action *a, int bind) | ||
| 99 | { | ||
| 100 | struct tcf_defact *p = PRIV(a, defact); | ||
| 101 | |||
| 102 | if (p != NULL) | ||
| 103 | return tcf_defact_release(p, bind); | ||
| 104 | return 0; | ||
| 105 | } | ||
| 106 | |||
| 107 | static inline int | ||
| 108 | tcf_defact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | ||
| 109 | { | ||
| 110 | unsigned char *b = skb->tail; | ||
| 111 | struct tc_defact opt; | ||
| 112 | struct tcf_defact *p = PRIV(a, defact); | ||
| 113 | struct tcf_t t; | ||
| 114 | |||
| 115 | opt.index = p->index; | ||
| 116 | opt.refcnt = p->refcnt - ref; | ||
| 117 | opt.bindcnt = p->bindcnt - bind; | ||
| 118 | opt.action = p->action; | ||
| 119 | RTA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); | ||
| 120 | RTA_PUT(skb, TCA_DEF_DATA, p->datalen, p->defdata); | ||
| 121 | t.install = jiffies_to_clock_t(jiffies - p->tm.install); | ||
| 122 | t.lastuse = jiffies_to_clock_t(jiffies - p->tm.lastuse); | ||
| 123 | t.expires = jiffies_to_clock_t(p->tm.expires); | ||
| 124 | RTA_PUT(skb, TCA_DEF_TM, sizeof(t), &t); | ||
| 125 | return skb->len; | ||
| 126 | |||
| 127 | rtattr_failure: | ||
| 128 | skb_trim(skb, b - skb->data); | ||
| 129 | return -1; | ||
| 130 | } | ||
| 131 | |||
| 132 | #define tca_use_default_ops \ | ||
| 133 | .dump = tcf_defact_dump, \ | ||
| 134 | .cleanup = tcf_defact_cleanup, \ | ||
| 135 | .init = tcf_defact_init, \ | ||
| 136 | .walk = tcf_generic_walker, \ | ||
| 137 | |||
| 138 | #define tca_use_default_defines(name) \ | ||
| 139 | static u32 idx_gen; \ | ||
| 140 | static struct tcf_defact *tcf_##name_ht[MY_TAB_SIZE]; \ | ||
| 141 | static DEFINE_RWLOCK(##name_lock); | ||
| 142 | #endif /* _NET_ACT_GENERIC_H */ | ||
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 3d71251b3eca..44f1b673f916 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
| @@ -61,6 +61,9 @@ extern int addrconf_set_dstaddr(void __user *arg); | |||
| 61 | extern int ipv6_chk_addr(struct in6_addr *addr, | 61 | extern int ipv6_chk_addr(struct in6_addr *addr, |
| 62 | struct net_device *dev, | 62 | struct net_device *dev, |
| 63 | int strict); | 63 | int strict); |
| 64 | #ifdef CONFIG_IPV6_MIP6 | ||
| 65 | extern int ipv6_chk_home_addr(struct in6_addr *addr); | ||
| 66 | #endif | ||
| 64 | extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, | 67 | extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, |
| 65 | struct net_device *dev, | 68 | struct net_device *dev, |
| 66 | int strict); | 69 | int strict); |
| @@ -126,20 +129,18 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb); | |||
| 126 | static inline struct inet6_dev * | 129 | static inline struct inet6_dev * |
| 127 | __in6_dev_get(struct net_device *dev) | 130 | __in6_dev_get(struct net_device *dev) |
| 128 | { | 131 | { |
| 129 | return (struct inet6_dev *)dev->ip6_ptr; | 132 | return rcu_dereference(dev->ip6_ptr); |
| 130 | } | 133 | } |
| 131 | 134 | ||
| 132 | extern rwlock_t addrconf_lock; | ||
| 133 | |||
| 134 | static inline struct inet6_dev * | 135 | static inline struct inet6_dev * |
| 135 | in6_dev_get(struct net_device *dev) | 136 | in6_dev_get(struct net_device *dev) |
| 136 | { | 137 | { |
| 137 | struct inet6_dev *idev = NULL; | 138 | struct inet6_dev *idev = NULL; |
| 138 | read_lock(&addrconf_lock); | 139 | rcu_read_lock(); |
| 139 | idev = dev->ip6_ptr; | 140 | idev = __in6_dev_get(dev); |
| 140 | if (idev) | 141 | if (idev) |
| 141 | atomic_inc(&idev->refcnt); | 142 | atomic_inc(&idev->refcnt); |
| 142 | read_unlock(&addrconf_lock); | 143 | rcu_read_unlock(); |
| 143 | return idev; | 144 | return idev; |
| 144 | } | 145 | } |
| 145 | 146 | ||
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 795f81f9ec7f..c0398f5a8cb9 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
| @@ -53,14 +53,21 @@ struct unix_address { | |||
| 53 | struct unix_skb_parms { | 53 | struct unix_skb_parms { |
| 54 | struct ucred creds; /* Skb credentials */ | 54 | struct ucred creds; /* Skb credentials */ |
| 55 | struct scm_fp_list *fp; /* Passed files */ | 55 | struct scm_fp_list *fp; /* Passed files */ |
| 56 | #ifdef CONFIG_SECURITY_NETWORK | ||
| 57 | u32 secid; /* Security ID */ | ||
| 58 | #endif | ||
| 56 | }; | 59 | }; |
| 57 | 60 | ||
| 58 | #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) | 61 | #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) |
| 59 | #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) | 62 | #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) |
| 63 | #define UNIXSID(skb) (&UNIXCB((skb)).secid) | ||
| 60 | 64 | ||
| 61 | #define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) | 65 | #define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) |
| 62 | #define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) | 66 | #define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) |
| 63 | #define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) | 67 | #define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) |
| 68 | #define unix_state_wlock_nested(s) \ | ||
| 69 | spin_lock_nested(&unix_sk(s)->lock, \ | ||
| 70 | SINGLE_DEPTH_NESTING) | ||
| 64 | #define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) | 71 | #define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) |
| 65 | 72 | ||
| 66 | #ifdef __KERNEL__ | 73 | #ifdef __KERNEL__ |
diff --git a/include/net/ah.h b/include/net/ah.h index ceff00afae09..8f257c159902 100644 --- a/include/net/ah.h +++ b/include/net/ah.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _NET_AH_H | 1 | #ifndef _NET_AH_H |
| 2 | #define _NET_AH_H | 2 | #define _NET_AH_H |
| 3 | 3 | ||
| 4 | #include <linux/crypto.h> | ||
| 4 | #include <net/xfrm.h> | 5 | #include <net/xfrm.h> |
| 5 | 6 | ||
| 6 | /* This is the maximum truncated ICV length that we know of. */ | 7 | /* This is the maximum truncated ICV length that we know of. */ |
| @@ -14,22 +15,29 @@ struct ah_data | |||
| 14 | int icv_full_len; | 15 | int icv_full_len; |
| 15 | int icv_trunc_len; | 16 | int icv_trunc_len; |
| 16 | 17 | ||
| 17 | void (*icv)(struct ah_data*, | 18 | struct crypto_hash *tfm; |
| 18 | struct sk_buff *skb, u8 *icv); | ||
| 19 | |||
| 20 | struct crypto_tfm *tfm; | ||
| 21 | }; | 19 | }; |
| 22 | 20 | ||
| 23 | static inline void | 21 | static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb, |
| 24 | ah_hmac_digest(struct ah_data *ahp, struct sk_buff *skb, u8 *auth_data) | 22 | u8 *auth_data) |
| 25 | { | 23 | { |
| 26 | struct crypto_tfm *tfm = ahp->tfm; | 24 | struct hash_desc desc; |
| 25 | int err; | ||
| 26 | |||
| 27 | desc.tfm = ahp->tfm; | ||
| 28 | desc.flags = 0; | ||
| 27 | 29 | ||
| 28 | memset(auth_data, 0, ahp->icv_trunc_len); | 30 | memset(auth_data, 0, ahp->icv_trunc_len); |
| 29 | crypto_hmac_init(tfm, ahp->key, &ahp->key_len); | 31 | err = crypto_hash_init(&desc); |
| 30 | skb_icv_walk(skb, tfm, 0, skb->len, crypto_hmac_update); | 32 | if (unlikely(err)) |
| 31 | crypto_hmac_final(tfm, ahp->key, &ahp->key_len, ahp->work_icv); | 33 | goto out; |
| 32 | memcpy(auth_data, ahp->work_icv, ahp->icv_trunc_len); | 34 | err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update); |
| 35 | if (unlikely(err)) | ||
| 36 | goto out; | ||
| 37 | err = crypto_hash_final(&desc, ahp->work_icv); | ||
| 38 | |||
| 39 | out: | ||
| 40 | return err; | ||
| 33 | } | 41 | } |
| 34 | 42 | ||
| 35 | #endif | 43 | #endif |
diff --git a/include/net/arp.h b/include/net/arp.h index 643bded9f557..6a3d9a7d302b 100644 --- a/include/net/arp.h +++ b/include/net/arp.h | |||
| @@ -12,15 +12,15 @@ extern struct neigh_table arp_tbl; | |||
| 12 | extern void arp_init(void); | 12 | extern void arp_init(void); |
| 13 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); | 13 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); |
| 14 | extern int arp_ioctl(unsigned int cmd, void __user *arg); | 14 | extern int arp_ioctl(unsigned int cmd, void __user *arg); |
| 15 | extern void arp_send(int type, int ptype, u32 dest_ip, | 15 | extern void arp_send(int type, int ptype, __be32 dest_ip, |
| 16 | struct net_device *dev, u32 src_ip, | 16 | struct net_device *dev, __be32 src_ip, |
| 17 | unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); | 17 | unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); |
| 18 | extern int arp_bind_neighbour(struct dst_entry *dst); | 18 | extern int arp_bind_neighbour(struct dst_entry *dst); |
| 19 | extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir); | 19 | extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir); |
| 20 | extern void arp_ifdown(struct net_device *dev); | 20 | extern void arp_ifdown(struct net_device *dev); |
| 21 | 21 | ||
| 22 | extern struct sk_buff *arp_create(int type, int ptype, u32 dest_ip, | 22 | extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, |
| 23 | struct net_device *dev, u32 src_ip, | 23 | struct net_device *dev, __be32 src_ip, |
| 24 | unsigned char *dest_hw, unsigned char *src_hw, | 24 | unsigned char *dest_hw, unsigned char *src_hw, |
| 25 | unsigned char *target_hw); | 25 | unsigned char *target_hw); |
| 26 | extern void arp_xmit(struct sk_buff *skb); | 26 | extern void arp_xmit(struct sk_buff *skb); |
diff --git a/include/net/ax25.h b/include/net/ax25.h index 7cd528e9d668..69374cd1a857 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
| @@ -182,14 +182,26 @@ typedef struct { | |||
| 182 | 182 | ||
| 183 | typedef struct ax25_route { | 183 | typedef struct ax25_route { |
| 184 | struct ax25_route *next; | 184 | struct ax25_route *next; |
| 185 | atomic_t ref; | 185 | atomic_t refcount; |
| 186 | ax25_address callsign; | 186 | ax25_address callsign; |
| 187 | struct net_device *dev; | 187 | struct net_device *dev; |
| 188 | ax25_digi *digipeat; | 188 | ax25_digi *digipeat; |
| 189 | char ip_mode; | 189 | char ip_mode; |
| 190 | struct timer_list timer; | ||
| 191 | } ax25_route; | 190 | } ax25_route; |
| 192 | 191 | ||
| 192 | static inline void ax25_hold_route(ax25_route *ax25_rt) | ||
| 193 | { | ||
| 194 | atomic_inc(&ax25_rt->refcount); | ||
| 195 | } | ||
| 196 | |||
| 197 | extern void __ax25_put_route(ax25_route *ax25_rt); | ||
| 198 | |||
| 199 | static inline void ax25_put_route(ax25_route *ax25_rt) | ||
| 200 | { | ||
| 201 | if (atomic_dec_and_test(&ax25_rt->refcount)) | ||
| 202 | __ax25_put_route(ax25_rt); | ||
| 203 | } | ||
| 204 | |||
| 193 | typedef struct { | 205 | typedef struct { |
| 194 | char slave; /* slave_mode? */ | 206 | char slave; /* slave_mode? */ |
| 195 | struct timer_list slave_timer; /* timeout timer */ | 207 | struct timer_list slave_timer; /* timeout timer */ |
| @@ -348,17 +360,11 @@ extern int ax25_check_iframes_acked(ax25_cb *, unsigned short); | |||
| 348 | extern void ax25_rt_device_down(struct net_device *); | 360 | extern void ax25_rt_device_down(struct net_device *); |
| 349 | extern int ax25_rt_ioctl(unsigned int, void __user *); | 361 | extern int ax25_rt_ioctl(unsigned int, void __user *); |
| 350 | extern struct file_operations ax25_route_fops; | 362 | extern struct file_operations ax25_route_fops; |
| 363 | extern ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev); | ||
| 351 | extern int ax25_rt_autobind(ax25_cb *, ax25_address *); | 364 | extern int ax25_rt_autobind(ax25_cb *, ax25_address *); |
| 352 | extern ax25_route *ax25_rt_find_route(ax25_route *, ax25_address *, | ||
| 353 | struct net_device *); | ||
| 354 | extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); | 365 | extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); |
| 355 | extern void ax25_rt_free(void); | 366 | extern void ax25_rt_free(void); |
| 356 | 367 | ||
| 357 | static inline void ax25_put_route(ax25_route *ax25_rt) | ||
| 358 | { | ||
| 359 | atomic_dec(&ax25_rt->ref); | ||
| 360 | } | ||
| 361 | |||
| 362 | /* ax25_std_in.c */ | 368 | /* ax25_std_in.c */ |
| 363 | extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); | 369 | extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); |
| 364 | 370 | ||
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 911ceb5cd263..771d17783c18 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -175,6 +175,6 @@ extern int hci_sock_cleanup(void); | |||
| 175 | extern int bt_sysfs_init(void); | 175 | extern int bt_sysfs_init(void); |
| 176 | extern void bt_sysfs_cleanup(void); | 176 | extern void bt_sysfs_cleanup(void); |
| 177 | 177 | ||
| 178 | extern struct class bt_class; | 178 | extern struct class *bt_class; |
| 179 | 179 | ||
| 180 | #endif /* __BLUETOOTH_H */ | 180 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index b06a2d2f63d2..10a3eec191fd 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -44,17 +44,19 @@ | |||
| 44 | #define HCI_NOTIFY_VOICE_SETTING 3 | 44 | #define HCI_NOTIFY_VOICE_SETTING 3 |
| 45 | 45 | ||
| 46 | /* HCI device types */ | 46 | /* HCI device types */ |
| 47 | #define HCI_VHCI 0 | 47 | #define HCI_VIRTUAL 0 |
| 48 | #define HCI_USB 1 | 48 | #define HCI_USB 1 |
| 49 | #define HCI_PCCARD 2 | 49 | #define HCI_PCCARD 2 |
| 50 | #define HCI_UART 3 | 50 | #define HCI_UART 3 |
| 51 | #define HCI_RS232 4 | 51 | #define HCI_RS232 4 |
| 52 | #define HCI_PCI 5 | 52 | #define HCI_PCI 5 |
| 53 | #define HCI_SDIO 6 | ||
| 53 | 54 | ||
| 54 | /* HCI device quirks */ | 55 | /* HCI device quirks */ |
| 55 | enum { | 56 | enum { |
| 56 | HCI_QUIRK_RESET_ON_INIT, | 57 | HCI_QUIRK_RESET_ON_INIT, |
| 57 | HCI_QUIRK_RAW_DEVICE | 58 | HCI_QUIRK_RAW_DEVICE, |
| 59 | HCI_QUIRK_FIXUP_BUFFER_SIZE | ||
| 58 | }; | 60 | }; |
| 59 | 61 | ||
| 60 | /* HCI device flags */ | 62 | /* HCI device flags */ |
| @@ -100,9 +102,10 @@ enum { | |||
| 100 | #define HCIINQUIRY _IOR('H', 240, int) | 102 | #define HCIINQUIRY _IOR('H', 240, int) |
| 101 | 103 | ||
| 102 | /* HCI timeouts */ | 104 | /* HCI timeouts */ |
| 103 | #define HCI_CONN_TIMEOUT (HZ * 40) | 105 | #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ |
| 104 | #define HCI_DISCONN_TIMEOUT (HZ * 2) | 106 | #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ |
| 105 | #define HCI_CONN_IDLE_TIMEOUT (HZ * 60) | 107 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
| 108 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | ||
| 106 | 109 | ||
| 107 | /* HCI Packet types */ | 110 | /* HCI Packet types */ |
| 108 | #define HCI_COMMAND_PKT 0x01 | 111 | #define HCI_COMMAND_PKT 0x01 |
| @@ -144,7 +147,7 @@ enum { | |||
| 144 | #define LMP_TACCURACY 0x10 | 147 | #define LMP_TACCURACY 0x10 |
| 145 | #define LMP_RSWITCH 0x20 | 148 | #define LMP_RSWITCH 0x20 |
| 146 | #define LMP_HOLD 0x40 | 149 | #define LMP_HOLD 0x40 |
| 147 | #define LMP_SNIF 0x80 | 150 | #define LMP_SNIFF 0x80 |
| 148 | 151 | ||
| 149 | #define LMP_PARK 0x01 | 152 | #define LMP_PARK 0x01 |
| 150 | #define LMP_RSSI 0x02 | 153 | #define LMP_RSSI 0x02 |
| @@ -159,13 +162,21 @@ enum { | |||
| 159 | #define LMP_PSCHEME 0x02 | 162 | #define LMP_PSCHEME 0x02 |
| 160 | #define LMP_PCONTROL 0x04 | 163 | #define LMP_PCONTROL 0x04 |
| 161 | 164 | ||
| 165 | #define LMP_SNIFF_SUBR 0x02 | ||
| 166 | |||
| 167 | /* Connection modes */ | ||
| 168 | #define HCI_CM_ACTIVE 0x0000 | ||
| 169 | #define HCI_CM_HOLD 0x0001 | ||
| 170 | #define HCI_CM_SNIFF 0x0002 | ||
| 171 | #define HCI_CM_PARK 0x0003 | ||
| 172 | |||
| 162 | /* Link policies */ | 173 | /* Link policies */ |
| 163 | #define HCI_LP_RSWITCH 0x0001 | 174 | #define HCI_LP_RSWITCH 0x0001 |
| 164 | #define HCI_LP_HOLD 0x0002 | 175 | #define HCI_LP_HOLD 0x0002 |
| 165 | #define HCI_LP_SNIFF 0x0004 | 176 | #define HCI_LP_SNIFF 0x0004 |
| 166 | #define HCI_LP_PARK 0x0008 | 177 | #define HCI_LP_PARK 0x0008 |
| 167 | 178 | ||
| 168 | /* Link mode */ | 179 | /* Link modes */ |
| 169 | #define HCI_LM_ACCEPT 0x8000 | 180 | #define HCI_LM_ACCEPT 0x8000 |
| 170 | #define HCI_LM_MASTER 0x0001 | 181 | #define HCI_LM_MASTER 0x0001 |
| 171 | #define HCI_LM_AUTH 0x0002 | 182 | #define HCI_LM_AUTH 0x0002 |
| @@ -191,7 +202,7 @@ struct hci_rp_read_loc_version { | |||
| 191 | } __attribute__ ((packed)); | 202 | } __attribute__ ((packed)); |
| 192 | 203 | ||
| 193 | #define OCF_READ_LOCAL_FEATURES 0x0003 | 204 | #define OCF_READ_LOCAL_FEATURES 0x0003 |
| 194 | struct hci_rp_read_loc_features { | 205 | struct hci_rp_read_local_features { |
| 195 | __u8 status; | 206 | __u8 status; |
| 196 | __u8 features[8]; | 207 | __u8 features[8]; |
| 197 | } __attribute__ ((packed)); | 208 | } __attribute__ ((packed)); |
| @@ -286,6 +297,7 @@ struct hci_cp_host_buffer_size { | |||
| 286 | 297 | ||
| 287 | /* Link Control */ | 298 | /* Link Control */ |
| 288 | #define OGF_LINK_CTL 0x01 | 299 | #define OGF_LINK_CTL 0x01 |
| 300 | |||
| 289 | #define OCF_CREATE_CONN 0x0005 | 301 | #define OCF_CREATE_CONN 0x0005 |
| 290 | struct hci_cp_create_conn { | 302 | struct hci_cp_create_conn { |
| 291 | bdaddr_t bdaddr; | 303 | bdaddr_t bdaddr; |
| @@ -296,6 +308,11 @@ struct hci_cp_create_conn { | |||
| 296 | __u8 role_switch; | 308 | __u8 role_switch; |
| 297 | } __attribute__ ((packed)); | 309 | } __attribute__ ((packed)); |
| 298 | 310 | ||
| 311 | #define OCF_CREATE_CONN_CANCEL 0x0008 | ||
| 312 | struct hci_cp_create_conn_cancel { | ||
| 313 | bdaddr_t bdaddr; | ||
| 314 | } __attribute__ ((packed)); | ||
| 315 | |||
| 299 | #define OCF_ACCEPT_CONN_REQ 0x0009 | 316 | #define OCF_ACCEPT_CONN_REQ 0x0009 |
| 300 | struct hci_cp_accept_conn_req { | 317 | struct hci_cp_accept_conn_req { |
| 301 | bdaddr_t bdaddr; | 318 | bdaddr_t bdaddr; |
| @@ -329,6 +346,8 @@ struct hci_cp_inquiry { | |||
| 329 | 346 | ||
| 330 | #define OCF_INQUIRY_CANCEL 0x0002 | 347 | #define OCF_INQUIRY_CANCEL 0x0002 |
| 331 | 348 | ||
| 349 | #define OCF_EXIT_PERIODIC_INQ 0x0004 | ||
| 350 | |||
| 332 | #define OCF_LINK_KEY_REPLY 0x000B | 351 | #define OCF_LINK_KEY_REPLY 0x000B |
| 333 | struct hci_cp_link_key_reply { | 352 | struct hci_cp_link_key_reply { |
| 334 | bdaddr_t bdaddr; | 353 | bdaddr_t bdaddr; |
| @@ -375,17 +394,32 @@ struct hci_cp_change_conn_link_key { | |||
| 375 | } __attribute__ ((packed)); | 394 | } __attribute__ ((packed)); |
| 376 | 395 | ||
| 377 | #define OCF_READ_REMOTE_FEATURES 0x001B | 396 | #define OCF_READ_REMOTE_FEATURES 0x001B |
| 378 | struct hci_cp_read_rmt_features { | 397 | struct hci_cp_read_remote_features { |
| 379 | __le16 handle; | 398 | __le16 handle; |
| 380 | } __attribute__ ((packed)); | 399 | } __attribute__ ((packed)); |
| 381 | 400 | ||
| 382 | #define OCF_READ_REMOTE_VERSION 0x001D | 401 | #define OCF_READ_REMOTE_VERSION 0x001D |
| 383 | struct hci_cp_read_rmt_version { | 402 | struct hci_cp_read_remote_version { |
| 384 | __le16 handle; | 403 | __le16 handle; |
| 385 | } __attribute__ ((packed)); | 404 | } __attribute__ ((packed)); |
| 386 | 405 | ||
| 387 | /* Link Policy */ | 406 | /* Link Policy */ |
| 388 | #define OGF_LINK_POLICY 0x02 | 407 | #define OGF_LINK_POLICY 0x02 |
| 408 | |||
| 409 | #define OCF_SNIFF_MODE 0x0003 | ||
| 410 | struct hci_cp_sniff_mode { | ||
| 411 | __le16 handle; | ||
| 412 | __le16 max_interval; | ||
| 413 | __le16 min_interval; | ||
| 414 | __le16 attempt; | ||
| 415 | __le16 timeout; | ||
| 416 | } __attribute__ ((packed)); | ||
| 417 | |||
| 418 | #define OCF_EXIT_SNIFF_MODE 0x0004 | ||
| 419 | struct hci_cp_exit_sniff_mode { | ||
| 420 | __le16 handle; | ||
| 421 | } __attribute__ ((packed)); | ||
| 422 | |||
| 389 | #define OCF_ROLE_DISCOVERY 0x0009 | 423 | #define OCF_ROLE_DISCOVERY 0x0009 |
| 390 | struct hci_cp_role_discovery { | 424 | struct hci_cp_role_discovery { |
| 391 | __le16 handle; | 425 | __le16 handle; |
| @@ -406,7 +440,7 @@ struct hci_rp_read_link_policy { | |||
| 406 | __le16 policy; | 440 | __le16 policy; |
| 407 | } __attribute__ ((packed)); | 441 | } __attribute__ ((packed)); |
| 408 | 442 | ||
| 409 | #define OCF_SWITCH_ROLE 0x000B | 443 | #define OCF_SWITCH_ROLE 0x000B |
| 410 | struct hci_cp_switch_role { | 444 | struct hci_cp_switch_role { |
| 411 | bdaddr_t bdaddr; | 445 | bdaddr_t bdaddr; |
| 412 | __u8 role; | 446 | __u8 role; |
| @@ -422,6 +456,14 @@ struct hci_rp_write_link_policy { | |||
| 422 | __le16 handle; | 456 | __le16 handle; |
| 423 | } __attribute__ ((packed)); | 457 | } __attribute__ ((packed)); |
| 424 | 458 | ||
| 459 | #define OCF_SNIFF_SUBRATE 0x0011 | ||
| 460 | struct hci_cp_sniff_subrate { | ||
| 461 | __le16 handle; | ||
| 462 | __le16 max_latency; | ||
| 463 | __le16 min_remote_timeout; | ||
| 464 | __le16 min_local_timeout; | ||
| 465 | } __attribute__ ((packed)); | ||
| 466 | |||
| 425 | /* Status params */ | 467 | /* Status params */ |
| 426 | #define OGF_STATUS_PARAM 0x05 | 468 | #define OGF_STATUS_PARAM 0x05 |
| 427 | 469 | ||
| @@ -581,15 +623,15 @@ struct hci_ev_link_key_notify { | |||
| 581 | __u8 key_type; | 623 | __u8 key_type; |
| 582 | } __attribute__ ((packed)); | 624 | } __attribute__ ((packed)); |
| 583 | 625 | ||
| 584 | #define HCI_EV_RMT_FEATURES 0x0B | 626 | #define HCI_EV_REMOTE_FEATURES 0x0B |
| 585 | struct hci_ev_rmt_features { | 627 | struct hci_ev_remote_features { |
| 586 | __u8 status; | 628 | __u8 status; |
| 587 | __le16 handle; | 629 | __le16 handle; |
| 588 | __u8 features[8]; | 630 | __u8 features[8]; |
| 589 | } __attribute__ ((packed)); | 631 | } __attribute__ ((packed)); |
| 590 | 632 | ||
| 591 | #define HCI_EV_RMT_VERSION 0x0C | 633 | #define HCI_EV_REMOTE_VERSION 0x0C |
| 592 | struct hci_ev_rmt_version { | 634 | struct hci_ev_remote_version { |
| 593 | __u8 status; | 635 | __u8 status; |
| 594 | __le16 handle; | 636 | __le16 handle; |
| 595 | __u8 lmp_ver; | 637 | __u8 lmp_ver; |
| @@ -610,6 +652,16 @@ struct hci_ev_pscan_rep_mode { | |||
| 610 | __u8 pscan_rep_mode; | 652 | __u8 pscan_rep_mode; |
| 611 | } __attribute__ ((packed)); | 653 | } __attribute__ ((packed)); |
| 612 | 654 | ||
| 655 | #define HCI_EV_SNIFF_SUBRATE 0x2E | ||
| 656 | struct hci_ev_sniff_subrate { | ||
| 657 | __u8 status; | ||
| 658 | __le16 handle; | ||
| 659 | __le16 max_tx_latency; | ||
| 660 | __le16 max_rx_latency; | ||
| 661 | __le16 max_remote_timeout; | ||
| 662 | __le16 max_local_timeout; | ||
| 663 | } __attribute__ ((packed)); | ||
| 664 | |||
| 613 | /* Internal events generated by Bluetooth stack */ | 665 | /* Internal events generated by Bluetooth stack */ |
| 614 | #define HCI_EV_STACK_INTERNAL 0xFD | 666 | #define HCI_EV_STACK_INTERNAL 0xFD |
| 615 | struct hci_ev_stack_internal { | 667 | struct hci_ev_stack_internal { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index bb9f81dc8723..df22efcfcc0b 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -31,10 +31,7 @@ | |||
| 31 | #define HCI_PROTO_L2CAP 0 | 31 | #define HCI_PROTO_L2CAP 0 |
| 32 | #define HCI_PROTO_SCO 1 | 32 | #define HCI_PROTO_SCO 1 |
| 33 | 33 | ||
| 34 | #define HCI_INIT_TIMEOUT (HZ * 10) | ||
| 35 | |||
| 36 | /* HCI Core structures */ | 34 | /* HCI Core structures */ |
| 37 | |||
| 38 | struct inquiry_data { | 35 | struct inquiry_data { |
| 39 | bdaddr_t bdaddr; | 36 | bdaddr_t bdaddr; |
| 40 | __u8 pscan_rep_mode; | 37 | __u8 pscan_rep_mode; |
| @@ -75,12 +72,19 @@ struct hci_dev { | |||
| 75 | __u8 type; | 72 | __u8 type; |
| 76 | bdaddr_t bdaddr; | 73 | bdaddr_t bdaddr; |
| 77 | __u8 features[8]; | 74 | __u8 features[8]; |
| 75 | __u8 hci_ver; | ||
| 76 | __u16 hci_rev; | ||
| 77 | __u16 manufacturer; | ||
| 78 | __u16 voice_setting; | 78 | __u16 voice_setting; |
| 79 | 79 | ||
| 80 | __u16 pkt_type; | 80 | __u16 pkt_type; |
| 81 | __u16 link_policy; | 81 | __u16 link_policy; |
| 82 | __u16 link_mode; | 82 | __u16 link_mode; |
| 83 | 83 | ||
| 84 | __u32 idle_timeout; | ||
| 85 | __u16 sniff_min_interval; | ||
| 86 | __u16 sniff_max_interval; | ||
| 87 | |||
| 84 | unsigned long quirks; | 88 | unsigned long quirks; |
| 85 | 89 | ||
| 86 | atomic_t cmd_cnt; | 90 | atomic_t cmd_cnt; |
| @@ -123,7 +127,8 @@ struct hci_dev { | |||
| 123 | 127 | ||
| 124 | atomic_t promisc; | 128 | atomic_t promisc; |
| 125 | 129 | ||
| 126 | struct class_device class_dev; | 130 | struct device *parent; |
| 131 | struct device dev; | ||
| 127 | 132 | ||
| 128 | struct module *owner; | 133 | struct module *owner; |
| 129 | 134 | ||
| @@ -145,18 +150,28 @@ struct hci_conn { | |||
| 145 | bdaddr_t dst; | 150 | bdaddr_t dst; |
| 146 | __u16 handle; | 151 | __u16 handle; |
| 147 | __u16 state; | 152 | __u16 state; |
| 153 | __u8 mode; | ||
| 148 | __u8 type; | 154 | __u8 type; |
| 149 | __u8 out; | 155 | __u8 out; |
| 150 | __u8 dev_class[3]; | 156 | __u8 dev_class[3]; |
| 157 | __u8 features[8]; | ||
| 158 | __u16 interval; | ||
| 159 | __u16 link_policy; | ||
| 151 | __u32 link_mode; | 160 | __u32 link_mode; |
| 161 | __u8 power_save; | ||
| 152 | unsigned long pend; | 162 | unsigned long pend; |
| 153 | 163 | ||
| 154 | unsigned int sent; | 164 | unsigned int sent; |
| 155 | 165 | ||
| 156 | struct sk_buff_head data_q; | 166 | struct sk_buff_head data_q; |
| 157 | 167 | ||
| 158 | struct timer_list timer; | 168 | struct timer_list disc_timer; |
| 159 | 169 | struct timer_list idle_timer; | |
| 170 | |||
| 171 | struct work_struct work; | ||
| 172 | |||
| 173 | struct device dev; | ||
| 174 | |||
| 160 | struct hci_dev *hdev; | 175 | struct hci_dev *hdev; |
| 161 | void *l2cap_data; | 176 | void *l2cap_data; |
| 162 | void *sco_data; | 177 | void *sco_data; |
| @@ -211,7 +226,8 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); | |||
| 211 | enum { | 226 | enum { |
| 212 | HCI_CONN_AUTH_PEND, | 227 | HCI_CONN_AUTH_PEND, |
| 213 | HCI_CONN_ENCRYPT_PEND, | 228 | HCI_CONN_ENCRYPT_PEND, |
| 214 | HCI_CONN_RSWITCH_PEND | 229 | HCI_CONN_RSWITCH_PEND, |
| 230 | HCI_CONN_MODE_CHANGE_PEND, | ||
| 215 | }; | 231 | }; |
| 216 | 232 | ||
| 217 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | 233 | static inline void hci_conn_hash_init(struct hci_dev *hdev) |
| @@ -286,31 +302,30 @@ int hci_conn_encrypt(struct hci_conn *conn); | |||
| 286 | int hci_conn_change_link_key(struct hci_conn *conn); | 302 | int hci_conn_change_link_key(struct hci_conn *conn); |
| 287 | int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); | 303 | int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); |
| 288 | 304 | ||
| 289 | static inline void hci_conn_set_timer(struct hci_conn *conn, unsigned long timeout) | 305 | void hci_conn_enter_active_mode(struct hci_conn *conn); |
| 290 | { | 306 | void hci_conn_enter_sniff_mode(struct hci_conn *conn); |
| 291 | mod_timer(&conn->timer, jiffies + timeout); | ||
| 292 | } | ||
| 293 | |||
| 294 | static inline void hci_conn_del_timer(struct hci_conn *conn) | ||
| 295 | { | ||
| 296 | del_timer(&conn->timer); | ||
| 297 | } | ||
| 298 | 307 | ||
| 299 | static inline void hci_conn_hold(struct hci_conn *conn) | 308 | static inline void hci_conn_hold(struct hci_conn *conn) |
| 300 | { | 309 | { |
| 301 | atomic_inc(&conn->refcnt); | 310 | atomic_inc(&conn->refcnt); |
| 302 | hci_conn_del_timer(conn); | 311 | del_timer(&conn->disc_timer); |
| 303 | } | 312 | } |
| 304 | 313 | ||
| 305 | static inline void hci_conn_put(struct hci_conn *conn) | 314 | static inline void hci_conn_put(struct hci_conn *conn) |
| 306 | { | 315 | { |
| 307 | if (atomic_dec_and_test(&conn->refcnt)) { | 316 | if (atomic_dec_and_test(&conn->refcnt)) { |
| 317 | unsigned long timeo; | ||
| 308 | if (conn->type == ACL_LINK) { | 318 | if (conn->type == ACL_LINK) { |
| 309 | unsigned long timeo = (conn->out) ? | 319 | del_timer(&conn->idle_timer); |
| 310 | HCI_DISCONN_TIMEOUT : HCI_DISCONN_TIMEOUT * 2; | 320 | if (conn->state == BT_CONNECTED) { |
| 311 | hci_conn_set_timer(conn, timeo); | 321 | timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT); |
| 322 | if (!conn->out) | ||
| 323 | timeo *= 2; | ||
| 324 | } else | ||
| 325 | timeo = msecs_to_jiffies(10); | ||
| 312 | } else | 326 | } else |
| 313 | hci_conn_set_timer(conn, HZ / 100); | 327 | timeo = msecs_to_jiffies(10); |
| 328 | mod_timer(&conn->disc_timer, jiffies + timeo); | ||
| 314 | } | 329 | } |
| 315 | } | 330 | } |
| 316 | 331 | ||
| @@ -407,12 +422,16 @@ static inline int hci_recv_frame(struct sk_buff *skb) | |||
| 407 | 422 | ||
| 408 | int hci_register_sysfs(struct hci_dev *hdev); | 423 | int hci_register_sysfs(struct hci_dev *hdev); |
| 409 | void hci_unregister_sysfs(struct hci_dev *hdev); | 424 | void hci_unregister_sysfs(struct hci_dev *hdev); |
| 425 | void hci_conn_add_sysfs(struct hci_conn *conn); | ||
| 426 | void hci_conn_del_sysfs(struct hci_conn *conn); | ||
| 410 | 427 | ||
| 411 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->class_dev.dev = (pdev)) | 428 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) |
| 412 | 429 | ||
| 413 | /* ----- LMP capabilities ----- */ | 430 | /* ----- LMP capabilities ----- */ |
| 414 | #define lmp_rswitch_capable(dev) (dev->features[0] & LMP_RSWITCH) | 431 | #define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) |
| 415 | #define lmp_encrypt_capable(dev) (dev->features[0] & LMP_ENCRYPT) | 432 | #define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) |
| 433 | #define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) | ||
| 434 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) | ||
| 416 | 435 | ||
| 417 | /* ----- HCI protocols ----- */ | 436 | /* ----- HCI protocols ----- */ |
| 418 | struct hci_proto { | 437 | struct hci_proto { |
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h new file mode 100644 index 000000000000..718b4d9c891f --- /dev/null +++ b/include/net/cipso_ipv4.h | |||
| @@ -0,0 +1,254 @@ | |||
| 1 | /* | ||
| 2 | * CIPSO - Commercial IP Security Option | ||
| 3 | * | ||
| 4 | * This is an implementation of the CIPSO 2.2 protocol as specified in | ||
| 5 | * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in | ||
| 6 | * FIPS-188, copies of both documents can be found in the Documentation | ||
| 7 | * directory. While CIPSO never became a full IETF RFC standard many vendors | ||
| 8 | * have chosen to adopt the protocol and over the years it has become a | ||
| 9 | * de-facto standard for labeled networking. | ||
| 10 | * | ||
| 11 | * Author: Paul Moore <paul.moore@hp.com> | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | /* | ||
| 16 | * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 | ||
| 17 | * | ||
| 18 | * This program is free software; you can redistribute it and/or modify | ||
| 19 | * it under the terms of the GNU General Public License as published by | ||
| 20 | * the Free Software Foundation; either version 2 of the License, or | ||
| 21 | * (at your option) any later version. | ||
| 22 | * | ||
| 23 | * This program is distributed in the hope that it will be useful, | ||
| 24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
| 26 | * the GNU General Public License for more details. | ||
| 27 | * | ||
| 28 | * You should have received a copy of the GNU General Public License | ||
| 29 | * along with this program; if not, write to the Free Software | ||
| 30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 31 | * | ||
| 32 | */ | ||
| 33 | |||
| 34 | #ifndef _CIPSO_IPV4_H | ||
| 35 | #define _CIPSO_IPV4_H | ||
| 36 | |||
| 37 | #include <linux/types.h> | ||
| 38 | #include <linux/rcupdate.h> | ||
| 39 | #include <linux/list.h> | ||
| 40 | #include <linux/net.h> | ||
| 41 | #include <linux/skbuff.h> | ||
| 42 | #include <net/netlabel.h> | ||
| 43 | |||
| 44 | /* known doi values */ | ||
| 45 | #define CIPSO_V4_DOI_UNKNOWN 0x00000000 | ||
| 46 | |||
| 47 | /* tag types */ | ||
| 48 | #define CIPSO_V4_TAG_INVALID 0 | ||
| 49 | #define CIPSO_V4_TAG_RBITMAP 1 | ||
| 50 | #define CIPSO_V4_TAG_ENUM 2 | ||
| 51 | #define CIPSO_V4_TAG_RANGE 5 | ||
| 52 | #define CIPSO_V4_TAG_PBITMAP 6 | ||
| 53 | #define CIPSO_V4_TAG_FREEFORM 7 | ||
| 54 | |||
| 55 | /* doi mapping types */ | ||
| 56 | #define CIPSO_V4_MAP_UNKNOWN 0 | ||
| 57 | #define CIPSO_V4_MAP_STD 1 | ||
| 58 | #define CIPSO_V4_MAP_PASS 2 | ||
| 59 | |||
| 60 | /* limits */ | ||
| 61 | #define CIPSO_V4_MAX_REM_LVLS 256 | ||
| 62 | #define CIPSO_V4_INV_LVL 0x80000000 | ||
| 63 | #define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1) | ||
| 64 | #define CIPSO_V4_MAX_REM_CATS 65536 | ||
| 65 | #define CIPSO_V4_INV_CAT 0x80000000 | ||
| 66 | #define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1) | ||
| 67 | |||
| 68 | /* | ||
| 69 | * CIPSO DOI definitions | ||
| 70 | */ | ||
| 71 | |||
| 72 | /* DOI definition struct */ | ||
| 73 | #define CIPSO_V4_TAG_MAXCNT 5 | ||
| 74 | struct cipso_v4_doi { | ||
| 75 | u32 doi; | ||
| 76 | u32 type; | ||
| 77 | union { | ||
| 78 | struct cipso_v4_std_map_tbl *std; | ||
| 79 | } map; | ||
| 80 | u8 tags[CIPSO_V4_TAG_MAXCNT]; | ||
| 81 | |||
| 82 | u32 valid; | ||
| 83 | struct list_head list; | ||
| 84 | struct rcu_head rcu; | ||
| 85 | struct list_head dom_list; | ||
| 86 | }; | ||
| 87 | |||
| 88 | /* Standard CIPSO mapping table */ | ||
| 89 | /* NOTE: the highest order bit (i.e. 0x80000000) is an 'invalid' flag, if the | ||
| 90 | * bit is set then consider that value as unspecified, meaning the | ||
| 91 | * mapping for that particular level/category is invalid */ | ||
| 92 | struct cipso_v4_std_map_tbl { | ||
| 93 | struct { | ||
| 94 | u32 *cipso; | ||
| 95 | u32 *local; | ||
| 96 | u32 cipso_size; | ||
| 97 | u32 local_size; | ||
| 98 | } lvl; | ||
| 99 | struct { | ||
| 100 | u32 *cipso; | ||
| 101 | u32 *local; | ||
| 102 | u32 cipso_size; | ||
| 103 | u32 local_size; | ||
| 104 | } cat; | ||
| 105 | }; | ||
| 106 | |||
| 107 | /* | ||
| 108 | * Sysctl Variables | ||
| 109 | */ | ||
| 110 | |||
| 111 | #ifdef CONFIG_NETLABEL | ||
| 112 | extern int cipso_v4_cache_enabled; | ||
| 113 | extern int cipso_v4_cache_bucketsize; | ||
| 114 | extern int cipso_v4_rbm_optfmt; | ||
| 115 | extern int cipso_v4_rbm_strictvalid; | ||
| 116 | #endif | ||
| 117 | |||
| 118 | /* | ||
| 119 | * Helper Functions | ||
| 120 | */ | ||
| 121 | |||
| 122 | #define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) | ||
| 123 | #define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso) | ||
| 124 | |||
| 125 | /* | ||
| 126 | * DOI List Functions | ||
| 127 | */ | ||
| 128 | |||
| 129 | #ifdef CONFIG_NETLABEL | ||
| 130 | int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); | ||
| 131 | int cipso_v4_doi_remove(u32 doi, | ||
| 132 | struct netlbl_audit *audit_info, | ||
| 133 | void (*callback) (struct rcu_head * head)); | ||
| 134 | struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); | ||
| 135 | int cipso_v4_doi_walk(u32 *skip_cnt, | ||
| 136 | int (*callback) (struct cipso_v4_doi *doi_def, void *arg), | ||
| 137 | void *cb_arg); | ||
| 138 | int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain); | ||
| 139 | int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def, | ||
| 140 | const char *domain); | ||
| 141 | #else | ||
| 142 | static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def) | ||
| 143 | { | ||
| 144 | return -ENOSYS; | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline int cipso_v4_doi_remove(u32 doi, | ||
| 148 | struct netlbl_audit *audit_info, | ||
| 149 | void (*callback) (struct rcu_head * head)) | ||
| 150 | { | ||
| 151 | return 0; | ||
| 152 | } | ||
| 153 | |||
| 154 | static inline struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi) | ||
| 155 | { | ||
| 156 | return NULL; | ||
| 157 | } | ||
| 158 | |||
| 159 | static inline int cipso_v4_doi_walk(u32 *skip_cnt, | ||
| 160 | int (*callback) (struct cipso_v4_doi *doi_def, void *arg), | ||
| 161 | void *cb_arg) | ||
| 162 | { | ||
| 163 | return 0; | ||
| 164 | } | ||
| 165 | |||
| 166 | static inline int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, | ||
| 167 | const char *domain) | ||
| 168 | { | ||
| 169 | return -ENOSYS; | ||
| 170 | } | ||
| 171 | |||
| 172 | static inline int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def, | ||
| 173 | const char *domain) | ||
| 174 | { | ||
| 175 | return 0; | ||
| 176 | } | ||
| 177 | #endif /* CONFIG_NETLABEL */ | ||
| 178 | |||
| 179 | /* | ||
| 180 | * Label Mapping Cache Functions | ||
| 181 | */ | ||
| 182 | |||
| 183 | #ifdef CONFIG_NETLABEL | ||
| 184 | void cipso_v4_cache_invalidate(void); | ||
| 185 | int cipso_v4_cache_add(const struct sk_buff *skb, | ||
| 186 | const struct netlbl_lsm_secattr *secattr); | ||
| 187 | #else | ||
| 188 | static inline void cipso_v4_cache_invalidate(void) | ||
| 189 | { | ||
| 190 | return; | ||
| 191 | } | ||
| 192 | |||
| 193 | static inline int cipso_v4_cache_add(const struct sk_buff *skb, | ||
| 194 | const struct netlbl_lsm_secattr *secattr) | ||
| 195 | { | ||
| 196 | return 0; | ||
| 197 | } | ||
| 198 | #endif /* CONFIG_NETLABEL */ | ||
| 199 | |||
| 200 | /* | ||
| 201 | * Protocol Handling Functions | ||
| 202 | */ | ||
| 203 | |||
| 204 | #ifdef CONFIG_NETLABEL | ||
| 205 | void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway); | ||
| 206 | int cipso_v4_socket_setattr(const struct socket *sock, | ||
| 207 | const struct cipso_v4_doi *doi_def, | ||
| 208 | const struct netlbl_lsm_secattr *secattr); | ||
| 209 | int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr); | ||
| 210 | int cipso_v4_socket_getattr(const struct socket *sock, | ||
| 211 | struct netlbl_lsm_secattr *secattr); | ||
| 212 | int cipso_v4_skbuff_getattr(const struct sk_buff *skb, | ||
| 213 | struct netlbl_lsm_secattr *secattr); | ||
| 214 | int cipso_v4_validate(unsigned char **option); | ||
| 215 | #else | ||
| 216 | static inline void cipso_v4_error(struct sk_buff *skb, | ||
| 217 | int error, | ||
| 218 | u32 gateway) | ||
| 219 | { | ||
| 220 | return; | ||
| 221 | } | ||
| 222 | |||
| 223 | static inline int cipso_v4_socket_setattr(const struct socket *sock, | ||
| 224 | const struct cipso_v4_doi *doi_def, | ||
| 225 | const struct netlbl_lsm_secattr *secattr) | ||
| 226 | { | ||
| 227 | return -ENOSYS; | ||
| 228 | } | ||
| 229 | |||
| 230 | static inline int cipso_v4_sock_getattr(struct sock *sk, | ||
| 231 | struct netlbl_lsm_secattr *secattr) | ||
| 232 | { | ||
| 233 | return -ENOSYS; | ||
| 234 | } | ||
| 235 | |||
| 236 | static inline int cipso_v4_socket_getattr(const struct socket *sock, | ||
| 237 | struct netlbl_lsm_secattr *secattr) | ||
| 238 | { | ||
| 239 | return -ENOSYS; | ||
| 240 | } | ||
| 241 | |||
| 242 | static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb, | ||
| 243 | struct netlbl_lsm_secattr *secattr) | ||
| 244 | { | ||
| 245 | return -ENOSYS; | ||
| 246 | } | ||
| 247 | |||
| 248 | static inline int cipso_v4_validate(unsigned char **option) | ||
| 249 | { | ||
| 250 | return -ENOSYS; | ||
| 251 | } | ||
| 252 | #endif /* CONFIG_NETLABEL */ | ||
| 253 | |||
| 254 | #endif /* _CIPSO_IPV4_H */ | ||
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index a15dcf0d5c1e..f01626cbbed6 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
| @@ -22,7 +22,7 @@ struct dn_kern_rta | |||
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | struct dn_fib_res { | 24 | struct dn_fib_res { |
| 25 | struct dn_fib_rule *r; | 25 | struct fib_rule *r; |
| 26 | struct dn_fib_info *fi; | 26 | struct dn_fib_info *fi; |
| 27 | unsigned char prefixlen; | 27 | unsigned char prefixlen; |
| 28 | unsigned char nh_sel; | 28 | unsigned char nh_sel; |
| @@ -94,7 +94,8 @@ struct dn_fib_node { | |||
| 94 | 94 | ||
| 95 | 95 | ||
| 96 | struct dn_fib_table { | 96 | struct dn_fib_table { |
| 97 | int n; | 97 | struct hlist_node hlist; |
| 98 | u32 n; | ||
| 98 | 99 | ||
| 99 | int (*insert)(struct dn_fib_table *t, struct rtmsg *r, | 100 | int (*insert)(struct dn_fib_table *t, struct rtmsg *r, |
| 100 | struct dn_kern_rta *rta, struct nlmsghdr *n, | 101 | struct dn_kern_rta *rta, struct nlmsghdr *n, |
| @@ -130,14 +131,11 @@ extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); | |||
| 130 | extern void dn_fib_flush(void); | 131 | extern void dn_fib_flush(void); |
| 131 | extern void dn_fib_select_multipath(const struct flowi *fl, | 132 | extern void dn_fib_select_multipath(const struct flowi *fl, |
| 132 | struct dn_fib_res *res); | 133 | struct dn_fib_res *res); |
| 133 | extern int dn_fib_sync_down(__le16 local, struct net_device *dev, | ||
| 134 | int force); | ||
| 135 | extern int dn_fib_sync_up(struct net_device *dev); | ||
| 136 | 134 | ||
| 137 | /* | 135 | /* |
| 138 | * dn_tables.c | 136 | * dn_tables.c |
| 139 | */ | 137 | */ |
| 140 | extern struct dn_fib_table *dn_fib_get_table(int n, int creat); | 138 | extern struct dn_fib_table *dn_fib_get_table(u32 n, int creat); |
| 141 | extern struct dn_fib_table *dn_fib_empty_table(void); | 139 | extern struct dn_fib_table *dn_fib_empty_table(void); |
| 142 | extern void dn_fib_table_init(void); | 140 | extern void dn_fib_table_init(void); |
| 143 | extern void dn_fib_table_cleanup(void); | 141 | extern void dn_fib_table_cleanup(void); |
| @@ -147,10 +145,8 @@ extern void dn_fib_table_cleanup(void); | |||
| 147 | */ | 145 | */ |
| 148 | extern void dn_fib_rules_init(void); | 146 | extern void dn_fib_rules_init(void); |
| 149 | extern void dn_fib_rules_cleanup(void); | 147 | extern void dn_fib_rules_cleanup(void); |
| 150 | extern void dn_fib_rule_put(struct dn_fib_rule *); | ||
| 151 | extern __le16 dn_fib_rules_policy(__le16 saddr, struct dn_fib_res *res, unsigned *flags); | ||
| 152 | extern unsigned dnet_addr_type(__le16 addr); | 148 | extern unsigned dnet_addr_type(__le16 addr); |
| 153 | extern int dn_fib_lookup(const struct flowi *fl, struct dn_fib_res *res); | 149 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); |
| 154 | 150 | ||
| 155 | /* | 151 | /* |
| 156 | * rtnetlink interface | 152 | * rtnetlink interface |
| @@ -176,11 +172,9 @@ static inline void dn_fib_res_put(struct dn_fib_res *res) | |||
| 176 | if (res->fi) | 172 | if (res->fi) |
| 177 | dn_fib_info_put(res->fi); | 173 | dn_fib_info_put(res->fi); |
| 178 | if (res->r) | 174 | if (res->r) |
| 179 | dn_fib_rule_put(res->r); | 175 | fib_rule_put(res->r); |
| 180 | } | 176 | } |
| 181 | 177 | ||
| 182 | extern struct dn_fib_table *dn_fib_tables[]; | ||
| 183 | |||
| 184 | #else /* Endnode */ | 178 | #else /* Endnode */ |
| 185 | 179 | ||
| 186 | #define dn_fib_init() do { } while(0) | 180 | #define dn_fib_init() do { } while(0) |
diff --git a/include/net/dst.h b/include/net/dst.h index 36d54fc248b0..e156e38e4ac3 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -54,6 +54,7 @@ struct dst_entry | |||
| 54 | unsigned long expires; | 54 | unsigned long expires; |
| 55 | 55 | ||
| 56 | unsigned short header_len; /* more space at head required */ | 56 | unsigned short header_len; /* more space at head required */ |
| 57 | unsigned short nfheader_len; /* more non-fragment space at head required */ | ||
| 57 | unsigned short trailer_len; /* space to reserve at tail */ | 58 | unsigned short trailer_len; /* space to reserve at tail */ |
| 58 | 59 | ||
| 59 | u32 metrics[RTAX_MAX]; | 60 | u32 metrics[RTAX_MAX]; |
| @@ -83,7 +84,7 @@ struct dst_entry | |||
| 83 | struct dst_ops | 84 | struct dst_ops |
| 84 | { | 85 | { |
| 85 | unsigned short family; | 86 | unsigned short family; |
| 86 | unsigned short protocol; | 87 | __be16 protocol; |
| 87 | unsigned gc_thresh; | 88 | unsigned gc_thresh; |
| 88 | 89 | ||
| 89 | int (*gc)(void); | 90 | int (*gc)(void); |
diff --git a/include/net/esp.h b/include/net/esp.h index 90cd94fad7d9..713d039f4af7 100644 --- a/include/net/esp.h +++ b/include/net/esp.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _NET_ESP_H | 1 | #ifndef _NET_ESP_H |
| 2 | #define _NET_ESP_H | 2 | #define _NET_ESP_H |
| 3 | 3 | ||
| 4 | #include <linux/crypto.h> | ||
| 4 | #include <net/xfrm.h> | 5 | #include <net/xfrm.h> |
| 5 | #include <asm/scatterlist.h> | 6 | #include <asm/scatterlist.h> |
| 6 | 7 | ||
| @@ -14,14 +15,15 @@ struct esp_data | |||
| 14 | struct { | 15 | struct { |
| 15 | u8 *key; /* Key */ | 16 | u8 *key; /* Key */ |
| 16 | int key_len; /* Key length */ | 17 | int key_len; /* Key length */ |
| 17 | u8 *ivec; /* ivec buffer */ | 18 | int padlen; /* 0..255 */ |
| 18 | /* ivlen is offset from enc_data, where encrypted data start. | 19 | /* ivlen is offset from enc_data, where encrypted data start. |
| 19 | * It is logically different of crypto_tfm_alg_ivsize(tfm). | 20 | * It is logically different of crypto_tfm_alg_ivsize(tfm). |
| 20 | * We assume that it is either zero (no ivec), or | 21 | * We assume that it is either zero (no ivec), or |
| 21 | * >= crypto_tfm_alg_ivsize(tfm). */ | 22 | * >= crypto_tfm_alg_ivsize(tfm). */ |
| 22 | int ivlen; | 23 | int ivlen; |
| 23 | int padlen; /* 0..255 */ | 24 | int ivinitted; |
| 24 | struct crypto_tfm *tfm; /* crypto handle */ | 25 | u8 *ivec; /* ivec buffer */ |
| 26 | struct crypto_blkcipher *tfm; /* crypto handle */ | ||
| 25 | } conf; | 27 | } conf; |
| 26 | 28 | ||
| 27 | /* Integrity. It is active when icv_full_len != 0 */ | 29 | /* Integrity. It is active when icv_full_len != 0 */ |
| @@ -34,7 +36,7 @@ struct esp_data | |||
| 34 | void (*icv)(struct esp_data*, | 36 | void (*icv)(struct esp_data*, |
| 35 | struct sk_buff *skb, | 37 | struct sk_buff *skb, |
| 36 | int offset, int len, u8 *icv); | 38 | int offset, int len, u8 *icv); |
| 37 | struct crypto_tfm *tfm; | 39 | struct crypto_hash *tfm; |
| 38 | } auth; | 40 | } auth; |
| 39 | }; | 41 | }; |
| 40 | 42 | ||
| @@ -42,18 +44,22 @@ extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, | |||
| 42 | extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); | 44 | extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); |
| 43 | extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); | 45 | extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); |
| 44 | 46 | ||
| 45 | static inline void | 47 | static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, |
| 46 | esp_hmac_digest(struct esp_data *esp, struct sk_buff *skb, int offset, | 48 | int offset, int len) |
| 47 | int len, u8 *auth_data) | ||
| 48 | { | 49 | { |
| 49 | struct crypto_tfm *tfm = esp->auth.tfm; | 50 | struct hash_desc desc; |
| 50 | char *icv = esp->auth.work_icv; | 51 | int err; |
| 51 | 52 | ||
| 52 | memset(auth_data, 0, esp->auth.icv_trunc_len); | 53 | desc.tfm = esp->auth.tfm; |
| 53 | crypto_hmac_init(tfm, esp->auth.key, &esp->auth.key_len); | 54 | desc.flags = 0; |
| 54 | skb_icv_walk(skb, tfm, offset, len, crypto_hmac_update); | 55 | |
| 55 | crypto_hmac_final(tfm, esp->auth.key, &esp->auth.key_len, icv); | 56 | err = crypto_hash_init(&desc); |
| 56 | memcpy(auth_data, icv, esp->auth.icv_trunc_len); | 57 | if (unlikely(err)) |
| 58 | return err; | ||
| 59 | err = skb_icv_walk(skb, &desc, offset, len, crypto_hash_update); | ||
| 60 | if (unlikely(err)) | ||
| 61 | return err; | ||
| 62 | return crypto_hash_final(&desc, esp->auth.work_icv); | ||
| 57 | } | 63 | } |
| 58 | 64 | ||
| 59 | #endif | 65 | #endif |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h new file mode 100644 index 000000000000..8e2f473d3e82 --- /dev/null +++ b/include/net/fib_rules.h | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | #ifndef __NET_FIB_RULES_H | ||
| 2 | #define __NET_FIB_RULES_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <linux/netdevice.h> | ||
| 6 | #include <linux/fib_rules.h> | ||
| 7 | #include <net/flow.h> | ||
| 8 | #include <net/netlink.h> | ||
| 9 | |||
| 10 | struct fib_rule | ||
| 11 | { | ||
| 12 | struct list_head list; | ||
| 13 | atomic_t refcnt; | ||
| 14 | int ifindex; | ||
| 15 | char ifname[IFNAMSIZ]; | ||
| 16 | u32 pref; | ||
| 17 | u32 flags; | ||
| 18 | u32 table; | ||
| 19 | u8 action; | ||
| 20 | struct rcu_head rcu; | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct fib_lookup_arg | ||
| 24 | { | ||
| 25 | void *lookup_ptr; | ||
| 26 | void *result; | ||
| 27 | struct fib_rule *rule; | ||
| 28 | }; | ||
| 29 | |||
| 30 | struct fib_rules_ops | ||
| 31 | { | ||
| 32 | int family; | ||
| 33 | struct list_head list; | ||
| 34 | int rule_size; | ||
| 35 | |||
| 36 | int (*action)(struct fib_rule *, | ||
| 37 | struct flowi *, int, | ||
| 38 | struct fib_lookup_arg *); | ||
| 39 | int (*match)(struct fib_rule *, | ||
| 40 | struct flowi *, int); | ||
| 41 | int (*configure)(struct fib_rule *, | ||
| 42 | struct sk_buff *, | ||
| 43 | struct nlmsghdr *, | ||
| 44 | struct fib_rule_hdr *, | ||
| 45 | struct nlattr **); | ||
| 46 | int (*compare)(struct fib_rule *, | ||
| 47 | struct fib_rule_hdr *, | ||
| 48 | struct nlattr **); | ||
| 49 | int (*fill)(struct fib_rule *, struct sk_buff *, | ||
| 50 | struct nlmsghdr *, | ||
| 51 | struct fib_rule_hdr *); | ||
| 52 | u32 (*default_pref)(void); | ||
| 53 | |||
| 54 | int nlgroup; | ||
| 55 | struct nla_policy *policy; | ||
| 56 | struct list_head *rules_list; | ||
| 57 | struct module *owner; | ||
| 58 | }; | ||
| 59 | |||
| 60 | static inline void fib_rule_get(struct fib_rule *rule) | ||
| 61 | { | ||
| 62 | atomic_inc(&rule->refcnt); | ||
| 63 | } | ||
| 64 | |||
| 65 | static inline void fib_rule_put_rcu(struct rcu_head *head) | ||
| 66 | { | ||
| 67 | struct fib_rule *rule = container_of(head, struct fib_rule, rcu); | ||
| 68 | kfree(rule); | ||
| 69 | } | ||
| 70 | |||
| 71 | static inline void fib_rule_put(struct fib_rule *rule) | ||
| 72 | { | ||
| 73 | if (atomic_dec_and_test(&rule->refcnt)) | ||
| 74 | call_rcu(&rule->rcu, fib_rule_put_rcu); | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) | ||
| 78 | { | ||
| 79 | if (nla[FRA_TABLE]) | ||
| 80 | return nla_get_u32(nla[FRA_TABLE]); | ||
| 81 | return frh->table; | ||
| 82 | } | ||
| 83 | |||
| 84 | extern int fib_rules_register(struct fib_rules_ops *); | ||
| 85 | extern int fib_rules_unregister(struct fib_rules_ops *); | ||
| 86 | |||
| 87 | extern int fib_rules_lookup(struct fib_rules_ops *, | ||
| 88 | struct flowi *, int flags, | ||
| 89 | struct fib_lookup_arg *); | ||
| 90 | |||
| 91 | extern int fib_nl_newrule(struct sk_buff *, | ||
| 92 | struct nlmsghdr *, void *); | ||
| 93 | extern int fib_nl_delrule(struct sk_buff *, | ||
| 94 | struct nlmsghdr *, void *); | ||
| 95 | extern int fib_rules_dump(struct sk_buff *, | ||
| 96 | struct netlink_callback *, int); | ||
| 97 | #endif | ||
diff --git a/include/net/flow.h b/include/net/flow.h index 04d89f763451..ddf5f3ca1720 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
| @@ -16,8 +16,8 @@ struct flowi { | |||
| 16 | 16 | ||
| 17 | union { | 17 | union { |
| 18 | struct { | 18 | struct { |
| 19 | __u32 daddr; | 19 | __be32 daddr; |
| 20 | __u32 saddr; | 20 | __be32 saddr; |
| 21 | __u32 fwmark; | 21 | __u32 fwmark; |
| 22 | __u8 tos; | 22 | __u8 tos; |
| 23 | __u8 scope; | 23 | __u8 scope; |
| @@ -26,6 +26,7 @@ struct flowi { | |||
| 26 | struct { | 26 | struct { |
| 27 | struct in6_addr daddr; | 27 | struct in6_addr daddr; |
| 28 | struct in6_addr saddr; | 28 | struct in6_addr saddr; |
| 29 | __u32 fwmark; | ||
| 29 | __u32 flowlabel; | 30 | __u32 flowlabel; |
| 30 | } ip6_u; | 31 | } ip6_u; |
| 31 | 32 | ||
| @@ -42,6 +43,7 @@ struct flowi { | |||
| 42 | #define fld_scope nl_u.dn_u.scope | 43 | #define fld_scope nl_u.dn_u.scope |
| 43 | #define fl6_dst nl_u.ip6_u.daddr | 44 | #define fl6_dst nl_u.ip6_u.daddr |
| 44 | #define fl6_src nl_u.ip6_u.saddr | 45 | #define fl6_src nl_u.ip6_u.saddr |
| 46 | #define fl6_fwmark nl_u.ip6_u.fwmark | ||
| 45 | #define fl6_flowlabel nl_u.ip6_u.flowlabel | 47 | #define fl6_flowlabel nl_u.ip6_u.flowlabel |
| 46 | #define fl4_dst nl_u.ip4_u.daddr | 48 | #define fl4_dst nl_u.ip4_u.daddr |
| 47 | #define fl4_src nl_u.ip4_u.saddr | 49 | #define fl4_src nl_u.ip4_u.saddr |
| @@ -54,8 +56,8 @@ struct flowi { | |||
| 54 | #define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01 | 56 | #define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01 |
| 55 | union { | 57 | union { |
| 56 | struct { | 58 | struct { |
| 57 | __u16 sport; | 59 | __be16 sport; |
| 58 | __u16 dport; | 60 | __be16 dport; |
| 59 | } ports; | 61 | } ports; |
| 60 | 62 | ||
| 61 | struct { | 63 | struct { |
| @@ -71,13 +73,23 @@ struct flowi { | |||
| 71 | __u8 objname[16]; /* Not zero terminated */ | 73 | __u8 objname[16]; /* Not zero terminated */ |
| 72 | } dnports; | 74 | } dnports; |
| 73 | 75 | ||
| 74 | __u32 spi; | 76 | __be32 spi; |
| 77 | |||
| 78 | #ifdef CONFIG_IPV6_MIP6 | ||
| 79 | struct { | ||
| 80 | __u8 type; | ||
| 81 | } mht; | ||
| 82 | #endif | ||
| 75 | } uli_u; | 83 | } uli_u; |
| 76 | #define fl_ip_sport uli_u.ports.sport | 84 | #define fl_ip_sport uli_u.ports.sport |
| 77 | #define fl_ip_dport uli_u.ports.dport | 85 | #define fl_ip_dport uli_u.ports.dport |
| 78 | #define fl_icmp_type uli_u.icmpt.type | 86 | #define fl_icmp_type uli_u.icmpt.type |
| 79 | #define fl_icmp_code uli_u.icmpt.code | 87 | #define fl_icmp_code uli_u.icmpt.code |
| 80 | #define fl_ipsec_spi uli_u.spi | 88 | #define fl_ipsec_spi uli_u.spi |
| 89 | #ifdef CONFIG_IPV6_MIP6 | ||
| 90 | #define fl_mh_type uli_u.mht.type | ||
| 91 | #endif | ||
| 92 | __u32 secid; /* used by xfrm; see secid.txt */ | ||
| 81 | } __attribute__((__aligned__(BITS_PER_LONG/8))); | 93 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
| 82 | 94 | ||
| 83 | #define FLOW_DIR_IN 0 | 95 | #define FLOW_DIR_IN 0 |
| @@ -85,10 +97,10 @@ struct flowi { | |||
| 85 | #define FLOW_DIR_FWD 2 | 97 | #define FLOW_DIR_FWD 2 |
| 86 | 98 | ||
| 87 | struct sock; | 99 | struct sock; |
| 88 | typedef void (*flow_resolve_t)(struct flowi *key, u32 sk_sid, u16 family, u8 dir, | 100 | typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, |
| 89 | void **objp, atomic_t **obj_refp); | 101 | void **objp, atomic_t **obj_refp); |
| 90 | 102 | ||
| 91 | extern void *flow_cache_lookup(struct flowi *key, u32 sk_sid, u16 family, u8 dir, | 103 | extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, |
| 92 | flow_resolve_t resolver); | 104 | flow_resolve_t resolver); |
| 93 | extern void flow_cache_flush(void); | 105 | extern void flow_cache_flush(void); |
| 94 | extern atomic_t flow_cache_genid; | 106 | extern atomic_t flow_cache_genid; |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 805de50df00d..4a38d85e4e25 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
| @@ -27,8 +27,6 @@ struct genl_family | |||
| 27 | struct list_head family_list; /* private */ | 27 | struct list_head family_list; /* private */ |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | #define GENL_ADMIN_PERM 0x01 | ||
| 31 | |||
| 32 | /** | 30 | /** |
| 33 | * struct genl_info - receiving information | 31 | * struct genl_info - receiving information |
| 34 | * @snd_seq: sending sequence number | 32 | * @snd_seq: sending sequence number |
| @@ -133,11 +131,12 @@ static inline int genlmsg_cancel(struct sk_buff *skb, void *hdr) | |||
| 133 | * @skb: netlink message as socket buffer | 131 | * @skb: netlink message as socket buffer |
| 134 | * @pid: own netlink pid to avoid sending to yourself | 132 | * @pid: own netlink pid to avoid sending to yourself |
| 135 | * @group: multicast group id | 133 | * @group: multicast group id |
| 134 | * @flags: allocation flags | ||
| 136 | */ | 135 | */ |
| 137 | static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, | 136 | static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, |
| 138 | unsigned int group) | 137 | unsigned int group, gfp_t flags) |
| 139 | { | 138 | { |
| 140 | return nlmsg_multicast(genl_sock, skb, pid, group); | 139 | return nlmsg_multicast(genl_sock, skb, pid, group, flags); |
| 141 | } | 140 | } |
| 142 | 141 | ||
| 143 | /** | 142 | /** |
| @@ -150,4 +149,24 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid) | |||
| 150 | return nlmsg_unicast(genl_sock, skb, pid); | 149 | return nlmsg_unicast(genl_sock, skb, pid); |
| 151 | } | 150 | } |
| 152 | 151 | ||
| 152 | /** | ||
| 153 | * gennlmsg_data - head of message payload | ||
| 154 | * @gnlh: genetlink messsage header | ||
| 155 | */ | ||
| 156 | static inline void *genlmsg_data(const struct genlmsghdr *gnlh) | ||
| 157 | { | ||
| 158 | return ((unsigned char *) gnlh + GENL_HDRLEN); | ||
| 159 | } | ||
| 160 | |||
| 161 | /** | ||
| 162 | * genlmsg_len - length of message payload | ||
| 163 | * @gnlh: genetlink message header | ||
| 164 | */ | ||
| 165 | static inline int genlmsg_len(const struct genlmsghdr *gnlh) | ||
| 166 | { | ||
| 167 | struct nlmsghdr *nlh = (struct nlmsghdr *)((unsigned char *)gnlh - | ||
| 168 | NLMSG_HDRLEN); | ||
| 169 | return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN); | ||
| 170 | } | ||
| 171 | |||
| 153 | #endif /* __NET_GENERIC_NETLINK_H */ | 172 | #endif /* __NET_GENERIC_NETLINK_H */ |
diff --git a/include/net/icmp.h b/include/net/icmp.h index 05f8ff7d9316..dc09474efcf3 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
| @@ -38,7 +38,7 @@ struct dst_entry; | |||
| 38 | struct net_proto_family; | 38 | struct net_proto_family; |
| 39 | struct sk_buff; | 39 | struct sk_buff; |
| 40 | 40 | ||
| 41 | extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); | 41 | extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); |
| 42 | extern int icmp_rcv(struct sk_buff *skb); | 42 | extern int icmp_rcv(struct sk_buff *skb); |
| 43 | extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 43 | extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
| 44 | extern void icmp_init(struct net_proto_family *ops); | 44 | extern void icmp_init(struct net_proto_family *ops); |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index ecc42864b001..b174ebb277a9 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
| @@ -240,6 +240,11 @@ struct ieee80211_snap_hdr { | |||
| 240 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) | 240 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) |
| 241 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) | 241 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) |
| 242 | 242 | ||
| 243 | /* 802.11g ERP information element */ | ||
| 244 | #define WLAN_ERP_NON_ERP_PRESENT (1<<0) | ||
| 245 | #define WLAN_ERP_USE_PROTECTION (1<<1) | ||
| 246 | #define WLAN_ERP_BARKER_PREAMBLE (1<<2) | ||
| 247 | |||
| 243 | /* Status codes */ | 248 | /* Status codes */ |
| 244 | enum ieee80211_statuscode { | 249 | enum ieee80211_statuscode { |
| 245 | WLAN_STATUS_SUCCESS = 0, | 250 | WLAN_STATUS_SUCCESS = 0, |
| @@ -747,6 +752,8 @@ struct ieee80211_txb { | |||
| 747 | #define NETWORK_HAS_IBSS_DFS (1<<8) | 752 | #define NETWORK_HAS_IBSS_DFS (1<<8) |
| 748 | #define NETWORK_HAS_TPC_REPORT (1<<9) | 753 | #define NETWORK_HAS_TPC_REPORT (1<<9) |
| 749 | 754 | ||
| 755 | #define NETWORK_HAS_ERP_VALUE (1<<10) | ||
| 756 | |||
| 750 | #define QOS_QUEUE_NUM 4 | 757 | #define QOS_QUEUE_NUM 4 |
| 751 | #define QOS_OUI_LEN 3 | 758 | #define QOS_OUI_LEN 3 |
| 752 | #define QOS_OUI_TYPE 2 | 759 | #define QOS_OUI_TYPE 2 |
| @@ -1252,6 +1259,8 @@ extern int ieee80211_tx_frame(struct ieee80211_device *ieee, | |||
| 1252 | int total_len, int encrypt_mpdu); | 1259 | int total_len, int encrypt_mpdu); |
| 1253 | 1260 | ||
| 1254 | /* ieee80211_rx.c */ | 1261 | /* ieee80211_rx.c */ |
| 1262 | extern void ieee80211_rx_any(struct ieee80211_device *ieee, | ||
| 1263 | struct sk_buff *skb, struct ieee80211_rx_stats *stats); | ||
| 1255 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | 1264 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
| 1256 | struct ieee80211_rx_stats *rx_stats); | 1265 | struct ieee80211_rx_stats *rx_stats); |
| 1257 | /* make sure to set stats->len */ | 1266 | /* make sure to set stats->len */ |
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index 7a483ab4022f..425b3a57ac74 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
| @@ -86,9 +86,6 @@ struct ieee80211softmac_assoc_info { | |||
| 86 | 86 | ||
| 87 | /* BSSID we're trying to associate to */ | 87 | /* BSSID we're trying to associate to */ |
| 88 | char bssid[ETH_ALEN]; | 88 | char bssid[ETH_ALEN]; |
| 89 | |||
| 90 | /* Rates supported by the network */ | ||
| 91 | struct ieee80211softmac_ratesinfo supported_rates; | ||
| 92 | 89 | ||
| 93 | /* some flags. | 90 | /* some flags. |
| 94 | * static_essid is valid if the essid is constant, | 91 | * static_essid is valid if the essid is constant, |
| @@ -103,7 +100,9 @@ struct ieee80211softmac_assoc_info { | |||
| 103 | * bssfixed is used for SIOCSIWAP. | 100 | * bssfixed is used for SIOCSIWAP. |
| 104 | */ | 101 | */ |
| 105 | u8 static_essid:1, | 102 | u8 static_essid:1, |
| 103 | short_preamble_available:1, | ||
| 106 | associating:1, | 104 | associating:1, |
| 105 | assoc_wait:1, | ||
| 107 | bssvalid:1, | 106 | bssvalid:1, |
| 108 | bssfixed:1; | 107 | bssfixed:1; |
| 109 | 108 | ||
| @@ -114,6 +113,19 @@ struct ieee80211softmac_assoc_info { | |||
| 114 | struct work_struct timeout; | 113 | struct work_struct timeout; |
| 115 | }; | 114 | }; |
| 116 | 115 | ||
| 116 | struct ieee80211softmac_bss_info { | ||
| 117 | /* Rates supported by the network */ | ||
| 118 | struct ieee80211softmac_ratesinfo supported_rates; | ||
| 119 | |||
| 120 | /* This indicates whether frames can currently be transmitted with | ||
| 121 | * short preamble (only use this variable during TX at CCK rates) */ | ||
| 122 | u8 short_preamble:1; | ||
| 123 | |||
| 124 | /* This indicates whether protection (e.g. self-CTS) should be used | ||
| 125 | * when transmitting with OFDM modulation */ | ||
| 126 | u8 use_protection:1; | ||
| 127 | }; | ||
| 128 | |||
| 117 | enum { | 129 | enum { |
| 118 | IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1, | 130 | IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1, |
| 119 | IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2, | 131 | IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2, |
| @@ -156,6 +168,10 @@ struct ieee80211softmac_txrates { | |||
| 156 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ | 168 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ |
| 157 | #define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ | 169 | #define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ |
| 158 | 170 | ||
| 171 | #define IEEE80211SOFTMAC_BSSINFOCHG_RATES (1 << 0) /* supported_rates */ | ||
| 172 | #define IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE (1 << 1) /* short_preamble */ | ||
| 173 | #define IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION (1 << 2) /* use_protection */ | ||
| 174 | |||
| 159 | struct ieee80211softmac_device { | 175 | struct ieee80211softmac_device { |
| 160 | /* 802.11 structure for data stuff */ | 176 | /* 802.11 structure for data stuff */ |
| 161 | struct ieee80211_device *ieee; | 177 | struct ieee80211_device *ieee; |
| @@ -199,10 +215,16 @@ struct ieee80211softmac_device { | |||
| 199 | * The driver just needs to read them. | 215 | * The driver just needs to read them. |
| 200 | */ | 216 | */ |
| 201 | struct ieee80211softmac_txrates txrates; | 217 | struct ieee80211softmac_txrates txrates; |
| 202 | /* If the driver needs to do stuff on TX rate changes, assign this callback. */ | 218 | |
| 219 | /* If the driver needs to do stuff on TX rate changes, assign this | ||
| 220 | * callback. See IEEE80211SOFTMAC_TXRATECHG for change flags. */ | ||
| 203 | void (*txrates_change)(struct net_device *dev, | 221 | void (*txrates_change)(struct net_device *dev, |
| 204 | u32 changes, /* see IEEE80211SOFTMAC_TXRATECHG flags */ | 222 | u32 changes); |
| 205 | const struct ieee80211softmac_txrates *rates_before_change); | 223 | |
| 224 | /* If the driver needs to do stuff when BSS properties change, assign | ||
| 225 | * this callback. see IEEE80211SOFTMAC_BSSINFOCHG for change flags. */ | ||
| 226 | void (*bssinfo_change)(struct net_device *dev, | ||
| 227 | u32 changes); | ||
| 206 | 228 | ||
| 207 | /* private stuff follows */ | 229 | /* private stuff follows */ |
| 208 | /* this lock protects this structure */ | 230 | /* this lock protects this structure */ |
| @@ -215,6 +237,7 @@ struct ieee80211softmac_device { | |||
| 215 | 237 | ||
| 216 | struct ieee80211softmac_scaninfo *scaninfo; | 238 | struct ieee80211softmac_scaninfo *scaninfo; |
| 217 | struct ieee80211softmac_assoc_info associnfo; | 239 | struct ieee80211softmac_assoc_info associnfo; |
| 240 | struct ieee80211softmac_bss_info bssinfo; | ||
| 218 | 241 | ||
| 219 | struct list_head auth_queue; | 242 | struct list_head auth_queue; |
| 220 | struct list_head events; | 243 | struct list_head events; |
| @@ -256,6 +279,14 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev, | |||
| 256 | * Note that the rates need to be sorted. */ | 279 | * Note that the rates need to be sorted. */ |
| 257 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); | 280 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); |
| 258 | 281 | ||
| 282 | /* Finds the highest rate which is: | ||
| 283 | * 1. Present in ri (optionally a basic rate) | ||
| 284 | * 2. Supported by the device | ||
| 285 | * 3. Less than or equal to the user-defined rate | ||
| 286 | */ | ||
| 287 | extern u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac, | ||
| 288 | struct ieee80211softmac_ratesinfo *ri, int basic_only); | ||
| 289 | |||
| 259 | /* Helper function which advises you the rate at which a frame should be | 290 | /* Helper function which advises you the rate at which a frame should be |
| 260 | * transmitted at. */ | 291 | * transmitted at. */ |
| 261 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, | 292 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, |
| @@ -278,6 +309,24 @@ static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device | |||
| 278 | return txrates->mcast_rate; | 309 | return txrates->mcast_rate; |
| 279 | } | 310 | } |
| 280 | 311 | ||
| 312 | /* Helper function which advises you when it is safe to transmit with short | ||
| 313 | * preamble. | ||
| 314 | * You should only call this function when transmitting at CCK rates. */ | ||
| 315 | static inline int ieee80211softmac_short_preamble_ok(struct ieee80211softmac_device *mac, | ||
| 316 | int is_multicast, | ||
| 317 | int is_mgt) | ||
| 318 | { | ||
| 319 | return (is_multicast && is_mgt) ? 0 : mac->bssinfo.short_preamble; | ||
| 320 | } | ||
| 321 | |||
| 322 | /* Helper function which advises you whether protection (e.g. self-CTS) is | ||
| 323 | * needed. 1 = protection needed, 0 = no protection needed | ||
| 324 | * Only use this function when transmitting with OFDM modulation. */ | ||
| 325 | static inline int ieee80211softmac_protection_needed(struct ieee80211softmac_device *mac) | ||
| 326 | { | ||
| 327 | return mac->bssinfo.use_protection; | ||
| 328 | } | ||
| 329 | |||
| 281 | /* Start the SoftMAC. Call this after you initialized the device | 330 | /* Start the SoftMAC. Call this after you initialized the device |
| 282 | * and it is ready to run. | 331 | * and it is ready to run. |
| 283 | */ | 332 | */ |
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index e459e1a0ae4a..34489c13c119 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
| @@ -189,6 +189,7 @@ struct inet6_dev | |||
| 189 | struct ipv6_devconf cnf; | 189 | struct ipv6_devconf cnf; |
| 190 | struct ipv6_devstat stats; | 190 | struct ipv6_devstat stats; |
| 191 | unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ | 191 | unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ |
| 192 | struct rcu_head rcu; | ||
| 192 | }; | 193 | }; |
| 193 | 194 | ||
| 194 | extern struct ipv6_devconf ipv6_devconf; | 195 | extern struct ipv6_devconf ipv6_devconf; |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 9bf73fe50948..0bcf9f237e1f 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
| @@ -147,7 +147,8 @@ extern struct sock *inet_csk_clone(struct sock *sk, | |||
| 147 | enum inet_csk_ack_state_t { | 147 | enum inet_csk_ack_state_t { |
| 148 | ICSK_ACK_SCHED = 1, | 148 | ICSK_ACK_SCHED = 1, |
| 149 | ICSK_ACK_TIMER = 2, | 149 | ICSK_ACK_TIMER = 2, |
| 150 | ICSK_ACK_PUSHED = 4 | 150 | ICSK_ACK_PUSHED = 4, |
| 151 | ICSK_ACK_PUSHED2 = 8 | ||
| 151 | }; | 152 | }; |
| 152 | 153 | ||
| 153 | extern void inet_csk_init_xmit_timers(struct sock *sk, | 154 | extern void inet_csk_init_xmit_timers(struct sock *sk, |
| @@ -237,9 +238,9 @@ extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err); | |||
| 237 | 238 | ||
| 238 | extern struct request_sock *inet_csk_search_req(const struct sock *sk, | 239 | extern struct request_sock *inet_csk_search_req(const struct sock *sk, |
| 239 | struct request_sock ***prevp, | 240 | struct request_sock ***prevp, |
| 240 | const __u16 rport, | 241 | const __be16 rport, |
| 241 | const __u32 raddr, | 242 | const __be32 raddr, |
| 242 | const __u32 laddr); | 243 | const __be32 laddr); |
| 243 | extern int inet_csk_bind_conflict(const struct sock *sk, | 244 | extern int inet_csk_bind_conflict(const struct sock *sk, |
| 244 | const struct inet_bind_bucket *tb); | 245 | const struct inet_bind_bucket *tb); |
| 245 | extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, | 246 | extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 98e0bb3014fe..a9eb2eaf094e 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
| @@ -271,66 +271,57 @@ static inline int inet_iif(const struct sk_buff *skb) | |||
| 271 | return ((struct rtable *)skb->dst)->rt_iif; | 271 | return ((struct rtable *)skb->dst)->rt_iif; |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | extern struct sock *__inet_lookup_listener(const struct hlist_head *head, | 274 | extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, |
| 275 | const u32 daddr, | 275 | const __be32 daddr, |
| 276 | const unsigned short hnum, | 276 | const unsigned short hnum, |
| 277 | const int dif); | 277 | const int dif); |
| 278 | 278 | ||
| 279 | /* Optimize the common listener case. */ | 279 | static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, |
| 280 | static inline struct sock * | 280 | __be32 daddr, __be16 dport, int dif) |
| 281 | inet_lookup_listener(struct inet_hashinfo *hashinfo, | ||
| 282 | const u32 daddr, | ||
| 283 | const unsigned short hnum, const int dif) | ||
| 284 | { | 281 | { |
| 285 | struct sock *sk = NULL; | 282 | return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif); |
| 286 | const struct hlist_head *head; | ||
| 287 | |||
| 288 | read_lock(&hashinfo->lhash_lock); | ||
| 289 | head = &hashinfo->listening_hash[inet_lhashfn(hnum)]; | ||
| 290 | if (!hlist_empty(head)) { | ||
| 291 | const struct inet_sock *inet = inet_sk((sk = __sk_head(head))); | ||
| 292 | |||
| 293 | if (inet->num == hnum && !sk->sk_node.next && | ||
| 294 | (!inet->rcv_saddr || inet->rcv_saddr == daddr) && | ||
| 295 | (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) && | ||
| 296 | !sk->sk_bound_dev_if) | ||
| 297 | goto sherry_cache; | ||
| 298 | sk = __inet_lookup_listener(head, daddr, hnum, dif); | ||
| 299 | } | ||
| 300 | if (sk) { | ||
| 301 | sherry_cache: | ||
| 302 | sock_hold(sk); | ||
| 303 | } | ||
| 304 | read_unlock(&hashinfo->lhash_lock); | ||
| 305 | return sk; | ||
| 306 | } | 283 | } |
| 307 | 284 | ||
| 308 | /* Socket demux engine toys. */ | 285 | /* Socket demux engine toys. */ |
| 286 | /* What happens here is ugly; there's a pair of adjacent fields in | ||
| 287 | struct inet_sock; __be16 dport followed by __u16 num. We want to | ||
| 288 | search by pair, so we combine the keys into a single 32bit value | ||
| 289 | and compare with 32bit value read from &...->dport. Let's at least | ||
| 290 | make sure that it's not mixed with anything else... | ||
| 291 | On 64bit targets we combine comparisons with pair of adjacent __be32 | ||
| 292 | fields in the same way. | ||
| 293 | */ | ||
| 294 | typedef __u32 __bitwise __portpair; | ||
| 309 | #ifdef __BIG_ENDIAN | 295 | #ifdef __BIG_ENDIAN |
| 310 | #define INET_COMBINED_PORTS(__sport, __dport) \ | 296 | #define INET_COMBINED_PORTS(__sport, __dport) \ |
| 311 | (((__u32)(__sport) << 16) | (__u32)(__dport)) | 297 | ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport))) |
| 312 | #else /* __LITTLE_ENDIAN */ | 298 | #else /* __LITTLE_ENDIAN */ |
| 313 | #define INET_COMBINED_PORTS(__sport, __dport) \ | 299 | #define INET_COMBINED_PORTS(__sport, __dport) \ |
| 314 | (((__u32)(__dport) << 16) | (__u32)(__sport)) | 300 | ((__force __portpair)(((__u32)(__dport) << 16) | (__force __u32)(__be16)(__sport))) |
| 315 | #endif | 301 | #endif |
| 316 | 302 | ||
| 317 | #if (BITS_PER_LONG == 64) | 303 | #if (BITS_PER_LONG == 64) |
| 304 | typedef __u64 __bitwise __addrpair; | ||
| 318 | #ifdef __BIG_ENDIAN | 305 | #ifdef __BIG_ENDIAN |
| 319 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ | 306 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ |
| 320 | const __u64 __name = (((__u64)(__saddr)) << 32) | ((__u64)(__daddr)); | 307 | const __addrpair __name = (__force __addrpair) ( \ |
| 308 | (((__force __u64)(__be32)(__saddr)) << 32) | \ | ||
| 309 | ((__force __u64)(__be32)(__daddr))); | ||
| 321 | #else /* __LITTLE_ENDIAN */ | 310 | #else /* __LITTLE_ENDIAN */ |
| 322 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ | 311 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ |
| 323 | const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr)); | 312 | const __addrpair __name = (__force __addrpair) ( \ |
| 313 | (((__force __u64)(__be32)(__daddr)) << 32) | \ | ||
| 314 | ((__force __u64)(__be32)(__saddr))); | ||
| 324 | #endif /* __BIG_ENDIAN */ | 315 | #endif /* __BIG_ENDIAN */ |
| 325 | #define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 316 | #define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
| 326 | (((__sk)->sk_hash == (__hash)) && \ | 317 | (((__sk)->sk_hash == (__hash)) && \ |
| 327 | ((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ | 318 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ |
| 328 | ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 319 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
| 329 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 320 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
| 330 | #define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 321 | #define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
| 331 | (((__sk)->sk_hash == (__hash)) && \ | 322 | (((__sk)->sk_hash == (__hash)) && \ |
| 332 | ((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ | 323 | ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ |
| 333 | ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 324 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |
| 334 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 325 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
| 335 | #else /* 32-bit arch */ | 326 | #else /* 32-bit arch */ |
| 336 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) | 327 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) |
| @@ -338,13 +329,13 @@ sherry_cache: | |||
| 338 | (((__sk)->sk_hash == (__hash)) && \ | 329 | (((__sk)->sk_hash == (__hash)) && \ |
| 339 | (inet_sk(__sk)->daddr == (__saddr)) && \ | 330 | (inet_sk(__sk)->daddr == (__saddr)) && \ |
| 340 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ | 331 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ |
| 341 | ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 332 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
| 342 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 333 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
| 343 | #define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ | 334 | #define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ |
| 344 | (((__sk)->sk_hash == (__hash)) && \ | 335 | (((__sk)->sk_hash == (__hash)) && \ |
| 345 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ | 336 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ |
| 346 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ | 337 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ |
| 347 | ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 338 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |
| 348 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 339 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
| 349 | #endif /* 64-bit arch */ | 340 | #endif /* 64-bit arch */ |
| 350 | 341 | ||
| @@ -356,12 +347,12 @@ sherry_cache: | |||
| 356 | */ | 347 | */ |
| 357 | static inline struct sock * | 348 | static inline struct sock * |
| 358 | __inet_lookup_established(struct inet_hashinfo *hashinfo, | 349 | __inet_lookup_established(struct inet_hashinfo *hashinfo, |
| 359 | const u32 saddr, const u16 sport, | 350 | const __be32 saddr, const __be16 sport, |
| 360 | const u32 daddr, const u16 hnum, | 351 | const __be32 daddr, const u16 hnum, |
| 361 | const int dif) | 352 | const int dif) |
| 362 | { | 353 | { |
| 363 | INET_ADDR_COOKIE(acookie, saddr, daddr) | 354 | INET_ADDR_COOKIE(acookie, saddr, daddr) |
| 364 | const __u32 ports = INET_COMBINED_PORTS(sport, hnum); | 355 | const __portpair ports = INET_COMBINED_PORTS(sport, hnum); |
| 365 | struct sock *sk; | 356 | struct sock *sk; |
| 366 | const struct hlist_node *node; | 357 | const struct hlist_node *node; |
| 367 | /* Optimize here for direct hit, only listening connections can | 358 | /* Optimize here for direct hit, only listening connections can |
| @@ -391,25 +382,36 @@ hit: | |||
| 391 | goto out; | 382 | goto out; |
| 392 | } | 383 | } |
| 393 | 384 | ||
| 385 | static inline struct sock * | ||
| 386 | inet_lookup_established(struct inet_hashinfo *hashinfo, | ||
| 387 | const __be32 saddr, const __be16 sport, | ||
| 388 | const __be32 daddr, const __be16 dport, | ||
| 389 | const int dif) | ||
| 390 | { | ||
| 391 | return __inet_lookup_established(hashinfo, saddr, sport, daddr, | ||
| 392 | ntohs(dport), dif); | ||
| 393 | } | ||
| 394 | |||
| 394 | static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, | 395 | static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, |
| 395 | const u32 saddr, const u16 sport, | 396 | const __be32 saddr, const __be16 sport, |
| 396 | const u32 daddr, const u16 hnum, | 397 | const __be32 daddr, const __be16 dport, |
| 397 | const int dif) | 398 | const int dif) |
| 398 | { | 399 | { |
| 400 | u16 hnum = ntohs(dport); | ||
| 399 | struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr, | 401 | struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr, |
| 400 | hnum, dif); | 402 | hnum, dif); |
| 401 | return sk ? : inet_lookup_listener(hashinfo, daddr, hnum, dif); | 403 | return sk ? : __inet_lookup_listener(hashinfo, daddr, hnum, dif); |
| 402 | } | 404 | } |
| 403 | 405 | ||
| 404 | static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, | 406 | static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, |
| 405 | const u32 saddr, const u16 sport, | 407 | const __be32 saddr, const __be16 sport, |
| 406 | const u32 daddr, const u16 dport, | 408 | const __be32 daddr, const __be16 dport, |
| 407 | const int dif) | 409 | const int dif) |
| 408 | { | 410 | { |
| 409 | struct sock *sk; | 411 | struct sock *sk; |
| 410 | 412 | ||
| 411 | local_bh_disable(); | 413 | local_bh_disable(); |
| 412 | sk = __inet_lookup(hashinfo, saddr, sport, daddr, ntohs(dport), dif); | 414 | sk = __inet_lookup(hashinfo, saddr, sport, daddr, dport, dif); |
| 413 | local_bh_enable(); | 415 | local_bh_enable(); |
| 414 | 416 | ||
| 415 | return sk; | 417 | return sk; |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 1f4a9a60d4cc..ce6da97bc848 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | /** struct ip_options - IP Options | 27 | /** struct ip_options - IP Options |
| 28 | * | 28 | * |
| 29 | * @faddr - Saved first hop address | 29 | * @faddr - Saved first hop address |
| 30 | * @is_setbyuser - Set by setsockopt? | ||
| 31 | * @is_data - Options in __data, rather than skb | 30 | * @is_data - Options in __data, rather than skb |
| 32 | * @is_strictroute - Strict source route | 31 | * @is_strictroute - Strict source route |
| 33 | * @srr_is_hit - Packet destination addr was our one | 32 | * @srr_is_hit - Packet destination addr was our one |
| @@ -37,13 +36,12 @@ | |||
| 37 | * @ts_needaddr - Need to record addr of outgoing dev | 36 | * @ts_needaddr - Need to record addr of outgoing dev |
| 38 | */ | 37 | */ |
| 39 | struct ip_options { | 38 | struct ip_options { |
| 40 | __u32 faddr; | 39 | __be32 faddr; |
| 41 | unsigned char optlen; | 40 | unsigned char optlen; |
| 42 | unsigned char srr; | 41 | unsigned char srr; |
| 43 | unsigned char rr; | 42 | unsigned char rr; |
| 44 | unsigned char ts; | 43 | unsigned char ts; |
| 45 | unsigned char is_setbyuser:1, | 44 | unsigned char is_data:1, |
| 46 | is_data:1, | ||
| 47 | is_strictroute:1, | 45 | is_strictroute:1, |
| 48 | srr_is_hit:1, | 46 | srr_is_hit:1, |
| 49 | is_changed:1, | 47 | is_changed:1, |
| @@ -51,7 +49,7 @@ struct ip_options { | |||
| 51 | ts_needtime:1, | 49 | ts_needtime:1, |
| 52 | ts_needaddr:1; | 50 | ts_needaddr:1; |
| 53 | unsigned char router_alert; | 51 | unsigned char router_alert; |
| 54 | unsigned char __pad1; | 52 | unsigned char cipso; |
| 55 | unsigned char __pad2; | 53 | unsigned char __pad2; |
| 56 | unsigned char __data[0]; | 54 | unsigned char __data[0]; |
| 57 | }; | 55 | }; |
| @@ -64,9 +62,9 @@ struct inet_request_sock { | |||
| 64 | u16 inet6_rsk_offset; | 62 | u16 inet6_rsk_offset; |
| 65 | /* 2 bytes hole, try to pack */ | 63 | /* 2 bytes hole, try to pack */ |
| 66 | #endif | 64 | #endif |
| 67 | u32 loc_addr; | 65 | __be32 loc_addr; |
| 68 | u32 rmt_addr; | 66 | __be32 rmt_addr; |
| 69 | u16 rmt_port; | 67 | __be16 rmt_port; |
| 70 | u16 snd_wscale : 4, | 68 | u16 snd_wscale : 4, |
| 71 | rcv_wscale : 4, | 69 | rcv_wscale : 4, |
| 72 | tstamp_ok : 1, | 70 | tstamp_ok : 1, |
| @@ -112,15 +110,15 @@ struct inet_sock { | |||
| 112 | struct ipv6_pinfo *pinet6; | 110 | struct ipv6_pinfo *pinet6; |
| 113 | #endif | 111 | #endif |
| 114 | /* Socket demultiplex comparisons on incoming packets. */ | 112 | /* Socket demultiplex comparisons on incoming packets. */ |
| 115 | __u32 daddr; | 113 | __be32 daddr; |
| 116 | __u32 rcv_saddr; | 114 | __be32 rcv_saddr; |
| 117 | __u16 dport; | 115 | __be16 dport; |
| 118 | __u16 num; | 116 | __u16 num; |
| 119 | __u32 saddr; | 117 | __be32 saddr; |
| 120 | __s16 uc_ttl; | 118 | __s16 uc_ttl; |
| 121 | __u16 cmsg_flags; | 119 | __u16 cmsg_flags; |
| 122 | struct ip_options *opt; | 120 | struct ip_options *opt; |
| 123 | __u16 sport; | 121 | __be16 sport; |
| 124 | __u16 id; | 122 | __u16 id; |
| 125 | __u8 tos; | 123 | __u8 tos; |
| 126 | __u8 mc_ttl; | 124 | __u8 mc_ttl; |
| @@ -131,7 +129,7 @@ struct inet_sock { | |||
| 131 | hdrincl:1, | 129 | hdrincl:1, |
| 132 | mc_loop:1; | 130 | mc_loop:1; |
| 133 | int mc_index; | 131 | int mc_index; |
| 134 | __u32 mc_addr; | 132 | __be32 mc_addr; |
| 135 | struct ip_mc_socklist *mc_list; | 133 | struct ip_mc_socklist *mc_list; |
| 136 | struct { | 134 | struct { |
| 137 | unsigned int flags; | 135 | unsigned int flags; |
| @@ -139,7 +137,7 @@ struct inet_sock { | |||
| 139 | struct ip_options *opt; | 137 | struct ip_options *opt; |
| 140 | struct rtable *rt; | 138 | struct rtable *rt; |
| 141 | int length; /* Total length of all frames */ | 139 | int length; /* Total length of all frames */ |
| 142 | u32 addr; | 140 | __be32 addr; |
| 143 | struct flowi fl; | 141 | struct flowi fl; |
| 144 | } cork; | 142 | } cork; |
| 145 | }; | 143 | }; |
| @@ -169,10 +167,10 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
| 169 | 167 | ||
| 170 | extern int inet_sk_rebuild_header(struct sock *sk); | 168 | extern int inet_sk_rebuild_header(struct sock *sk); |
| 171 | 169 | ||
| 172 | static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, | 170 | static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, |
| 173 | const __u32 faddr, const __u16 fport) | 171 | const __be32 faddr, const __be16 fport) |
| 174 | { | 172 | { |
| 175 | unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); | 173 | unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport); |
| 176 | h ^= h >> 16; | 174 | h ^= h >> 16; |
| 177 | h ^= h >> 8; | 175 | h ^= h >> 8; |
| 178 | return h; | 176 | return h; |
| @@ -181,10 +179,10 @@ static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, | |||
| 181 | static inline int inet_sk_ehashfn(const struct sock *sk) | 179 | static inline int inet_sk_ehashfn(const struct sock *sk) |
| 182 | { | 180 | { |
| 183 | const struct inet_sock *inet = inet_sk(sk); | 181 | const struct inet_sock *inet = inet_sk(sk); |
| 184 | const __u32 laddr = inet->rcv_saddr; | 182 | const __be32 laddr = inet->rcv_saddr; |
| 185 | const __u16 lport = inet->num; | 183 | const __u16 lport = inet->num; |
| 186 | const __u32 faddr = inet->daddr; | 184 | const __be32 faddr = inet->daddr; |
| 187 | const __u16 fport = inet->dport; | 185 | const __be16 fport = inet->dport; |
| 188 | 186 | ||
| 189 | return inet_ehashfn(laddr, lport, faddr, fport); | 187 | return inet_ehashfn(laddr, lport, faddr, fport); |
| 190 | } | 188 | } |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 600cb543550d..6d14c22a00c5 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
| @@ -120,10 +120,10 @@ struct inet_timewait_sock { | |||
| 120 | unsigned char tw_rcv_wscale; | 120 | unsigned char tw_rcv_wscale; |
| 121 | /* Socket demultiplex comparisons on incoming packets. */ | 121 | /* Socket demultiplex comparisons on incoming packets. */ |
| 122 | /* these five are in inet_sock */ | 122 | /* these five are in inet_sock */ |
| 123 | __u16 tw_sport; | 123 | __be16 tw_sport; |
| 124 | __u32 tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES))); | 124 | __be32 tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES))); |
| 125 | __u32 tw_rcv_saddr; | 125 | __be32 tw_rcv_saddr; |
| 126 | __u16 tw_dport; | 126 | __be16 tw_dport; |
| 127 | __u16 tw_num; | 127 | __u16 tw_num; |
| 128 | /* And these are ours. */ | 128 | /* And these are ours. */ |
| 129 | __u8 tw_ipv6only:1; | 129 | __u8 tw_ipv6only:1; |
| @@ -186,7 +186,7 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk) | |||
| 186 | return (struct inet_timewait_sock *)sk; | 186 | return (struct inet_timewait_sock *)sk; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | static inline u32 inet_rcv_saddr(const struct sock *sk) | 189 | static inline __be32 inet_rcv_saddr(const struct sock *sk) |
| 190 | { | 190 | { |
| 191 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | 191 | return likely(sk->sk_state != TCP_TIME_WAIT) ? |
| 192 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; | 192 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 0965515f40cf..925573fd2aed 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
| @@ -22,7 +22,7 @@ struct inet_peer | |||
| 22 | unsigned long dtime; /* the time of last use of not | 22 | unsigned long dtime; /* the time of last use of not |
| 23 | * referenced entries */ | 23 | * referenced entries */ |
| 24 | atomic_t refcnt; | 24 | atomic_t refcnt; |
| 25 | __u32 v4daddr; /* peer's address */ | 25 | __be32 v4daddr; /* peer's address */ |
| 26 | __u16 avl_height; | 26 | __u16 avl_height; |
| 27 | __u16 ip_id_count; /* IP ID for the next packet */ | 27 | __u16 ip_id_count; /* IP ID for the next packet */ |
| 28 | atomic_t rid; /* Frag reception counter */ | 28 | atomic_t rid; /* Frag reception counter */ |
| @@ -33,7 +33,7 @@ struct inet_peer | |||
| 33 | void inet_initpeers(void) __init; | 33 | void inet_initpeers(void) __init; |
| 34 | 34 | ||
| 35 | /* can be called with or without local BH being disabled */ | 35 | /* can be called with or without local BH being disabled */ |
| 36 | struct inet_peer *inet_getpeer(__u32 daddr, int create); | 36 | struct inet_peer *inet_getpeer(__be32 daddr, int create); |
| 37 | 37 | ||
| 38 | extern spinlock_t inet_peer_unused_lock; | 38 | extern spinlock_t inet_peer_unused_lock; |
| 39 | extern struct inet_peer **inet_peer_unused_tailp; | 39 | extern struct inet_peer **inet_peer_unused_tailp; |
diff --git a/include/net/ip.h b/include/net/ip.h index 98f908400771..b6d95e553401 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -45,7 +45,7 @@ struct inet_skb_parm | |||
| 45 | 45 | ||
| 46 | struct ipcm_cookie | 46 | struct ipcm_cookie |
| 47 | { | 47 | { |
| 48 | u32 addr; | 48 | __be32 addr; |
| 49 | int oif; | 49 | int oif; |
| 50 | struct ip_options *opt; | 50 | struct ip_options *opt; |
| 51 | }; | 51 | }; |
| @@ -86,7 +86,7 @@ extern int igmp_mc_proc_init(void); | |||
| 86 | */ | 86 | */ |
| 87 | 87 | ||
| 88 | extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, | 88 | extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, |
| 89 | u32 saddr, u32 daddr, | 89 | __be32 saddr, __be32 daddr, |
| 90 | struct ip_options *opt); | 90 | struct ip_options *opt); |
| 91 | extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, | 91 | extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, |
| 92 | struct packet_type *pt, struct net_device *orig_dev); | 92 | struct packet_type *pt, struct net_device *orig_dev); |
| @@ -335,7 +335,7 @@ extern int ip_net_unreachable(struct sk_buff *skb); | |||
| 335 | * Functions provided by ip_options.c | 335 | * Functions provided by ip_options.c |
| 336 | */ | 336 | */ |
| 337 | 337 | ||
| 338 | extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, u32 daddr, struct rtable *rt, int is_frag); | 338 | extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag); |
| 339 | extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); | 339 | extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); |
| 340 | extern void ip_options_fragment(struct sk_buff *skb); | 340 | extern void ip_options_fragment(struct sk_buff *skb); |
| 341 | extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); | 341 | extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); |
| @@ -363,8 +363,8 @@ extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(s | |||
| 363 | 363 | ||
| 364 | extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); | 364 | extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); |
| 365 | extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | 365 | extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, |
| 366 | u16 port, u32 info, u8 *payload); | 366 | __be16 port, u32 info, u8 *payload); |
| 367 | extern void ip_local_error(struct sock *sk, int err, u32 daddr, u16 dport, | 367 | extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, |
| 368 | u32 info); | 368 | u32 info); |
| 369 | 369 | ||
| 370 | /* sysctl helpers - any sysctl which holds a value that ends up being | 370 | /* sysctl helpers - any sysctl which holds a value that ends up being |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index a66e9de16a6c..e4438de3bd6b 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
| @@ -16,14 +16,35 @@ | |||
| 16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
| 17 | 17 | ||
| 18 | #include <linux/ipv6_route.h> | 18 | #include <linux/ipv6_route.h> |
| 19 | |||
| 20 | #include <net/dst.h> | ||
| 21 | #include <net/flow.h> | ||
| 22 | #include <linux/rtnetlink.h> | 19 | #include <linux/rtnetlink.h> |
| 23 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
| 21 | #include <net/dst.h> | ||
| 22 | #include <net/flow.h> | ||
| 23 | #include <net/netlink.h> | ||
| 24 | 24 | ||
| 25 | struct rt6_info; | 25 | struct rt6_info; |
| 26 | 26 | ||
| 27 | struct fib6_config | ||
| 28 | { | ||
| 29 | u32 fc_table; | ||
| 30 | u32 fc_metric; | ||
| 31 | int fc_dst_len; | ||
| 32 | int fc_src_len; | ||
| 33 | int fc_ifindex; | ||
| 34 | u32 fc_flags; | ||
| 35 | u32 fc_protocol; | ||
| 36 | |||
| 37 | struct in6_addr fc_dst; | ||
| 38 | struct in6_addr fc_src; | ||
| 39 | struct in6_addr fc_gateway; | ||
| 40 | |||
| 41 | unsigned long fc_expires; | ||
| 42 | struct nlattr *fc_mx; | ||
| 43 | int fc_mx_len; | ||
| 44 | |||
| 45 | struct nl_info fc_nlinfo; | ||
| 46 | }; | ||
| 47 | |||
| 27 | struct fib6_node | 48 | struct fib6_node |
| 28 | { | 49 | { |
| 29 | struct fib6_node *parent; | 50 | struct fib6_node *parent; |
| @@ -39,6 +60,11 @@ struct fib6_node | |||
| 39 | __u32 fn_sernum; | 60 | __u32 fn_sernum; |
| 40 | }; | 61 | }; |
| 41 | 62 | ||
| 63 | #ifndef CONFIG_IPV6_SUBTREES | ||
| 64 | #define FIB6_SUBTREE(fn) NULL | ||
| 65 | #else | ||
| 66 | #define FIB6_SUBTREE(fn) ((fn)->subtree) | ||
| 67 | #endif | ||
| 42 | 68 | ||
| 43 | /* | 69 | /* |
| 44 | * routing information | 70 | * routing information |
| @@ -51,6 +77,8 @@ struct rt6key | |||
| 51 | int plen; | 77 | int plen; |
| 52 | }; | 78 | }; |
| 53 | 79 | ||
| 80 | struct fib6_table; | ||
| 81 | |||
| 54 | struct rt6_info | 82 | struct rt6_info |
| 55 | { | 83 | { |
| 56 | union { | 84 | union { |
| @@ -71,6 +99,7 @@ struct rt6_info | |||
| 71 | u32 rt6i_flags; | 99 | u32 rt6i_flags; |
| 72 | u32 rt6i_metric; | 100 | u32 rt6i_metric; |
| 73 | atomic_t rt6i_ref; | 101 | atomic_t rt6i_ref; |
| 102 | struct fib6_table *rt6i_table; | ||
| 74 | 103 | ||
| 75 | struct rt6key rt6i_dst; | 104 | struct rt6key rt6i_dst; |
| 76 | struct rt6key rt6i_src; | 105 | struct rt6key rt6i_src; |
| @@ -89,28 +118,6 @@ struct fib6_walker_t | |||
| 89 | void *args; | 118 | void *args; |
| 90 | }; | 119 | }; |
| 91 | 120 | ||
| 92 | extern struct fib6_walker_t fib6_walker_list; | ||
| 93 | extern rwlock_t fib6_walker_lock; | ||
| 94 | |||
| 95 | static inline void fib6_walker_link(struct fib6_walker_t *w) | ||
| 96 | { | ||
| 97 | write_lock_bh(&fib6_walker_lock); | ||
| 98 | w->next = fib6_walker_list.next; | ||
| 99 | w->prev = &fib6_walker_list; | ||
| 100 | w->next->prev = w; | ||
| 101 | w->prev->next = w; | ||
| 102 | write_unlock_bh(&fib6_walker_lock); | ||
| 103 | } | ||
| 104 | |||
| 105 | static inline void fib6_walker_unlink(struct fib6_walker_t *w) | ||
| 106 | { | ||
| 107 | write_lock_bh(&fib6_walker_lock); | ||
| 108 | w->next->prev = w->prev; | ||
| 109 | w->prev->next = w->next; | ||
| 110 | w->prev = w->next = w; | ||
| 111 | write_unlock_bh(&fib6_walker_lock); | ||
| 112 | } | ||
| 113 | |||
| 114 | struct rt6_statistics { | 121 | struct rt6_statistics { |
| 115 | __u32 fib_nodes; | 122 | __u32 fib_nodes; |
| 116 | __u32 fib_route_nodes; | 123 | __u32 fib_route_nodes; |
| @@ -143,12 +150,41 @@ struct rt6_statistics { | |||
| 143 | 150 | ||
| 144 | typedef void (*f_pnode)(struct fib6_node *fn, void *); | 151 | typedef void (*f_pnode)(struct fib6_node *fn, void *); |
| 145 | 152 | ||
| 146 | extern struct fib6_node ip6_routing_table; | 153 | struct fib6_table { |
| 154 | struct hlist_node tb6_hlist; | ||
| 155 | u32 tb6_id; | ||
| 156 | rwlock_t tb6_lock; | ||
| 157 | struct fib6_node tb6_root; | ||
| 158 | }; | ||
| 159 | |||
| 160 | #define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC | ||
| 161 | #define RT6_TABLE_MAIN RT_TABLE_MAIN | ||
| 162 | #define RT6_TABLE_DFLT RT6_TABLE_MAIN | ||
| 163 | #define RT6_TABLE_INFO RT6_TABLE_MAIN | ||
| 164 | #define RT6_TABLE_PREFIX RT6_TABLE_MAIN | ||
| 165 | |||
| 166 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
| 167 | #define FIB6_TABLE_MIN 1 | ||
| 168 | #define FIB6_TABLE_MAX RT_TABLE_MAX | ||
| 169 | #define RT6_TABLE_LOCAL RT_TABLE_LOCAL | ||
| 170 | #else | ||
| 171 | #define FIB6_TABLE_MIN RT_TABLE_MAIN | ||
| 172 | #define FIB6_TABLE_MAX FIB6_TABLE_MIN | ||
| 173 | #define RT6_TABLE_LOCAL RT6_TABLE_MAIN | ||
| 174 | #endif | ||
| 175 | |||
| 176 | typedef struct rt6_info *(*pol_lookup_t)(struct fib6_table *, | ||
| 177 | struct flowi *, int); | ||
| 147 | 178 | ||
| 148 | /* | 179 | /* |
| 149 | * exported functions | 180 | * exported functions |
| 150 | */ | 181 | */ |
| 151 | 182 | ||
| 183 | extern struct fib6_table * fib6_get_table(u32 id); | ||
| 184 | extern struct fib6_table * fib6_new_table(u32 id); | ||
| 185 | extern struct dst_entry * fib6_rule_lookup(struct flowi *fl, int flags, | ||
| 186 | pol_lookup_t lookup); | ||
| 187 | |||
| 152 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, | 188 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, |
| 153 | struct in6_addr *daddr, | 189 | struct in6_addr *daddr, |
| 154 | struct in6_addr *saddr); | 190 | struct in6_addr *saddr); |
| @@ -157,32 +193,29 @@ struct fib6_node *fib6_locate(struct fib6_node *root, | |||
| 157 | struct in6_addr *daddr, int dst_len, | 193 | struct in6_addr *daddr, int dst_len, |
| 158 | struct in6_addr *saddr, int src_len); | 194 | struct in6_addr *saddr, int src_len); |
| 159 | 195 | ||
| 160 | extern void fib6_clean_tree(struct fib6_node *root, | 196 | extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg), |
| 161 | int (*func)(struct rt6_info *, void *arg), | 197 | int prune, void *arg); |
| 162 | int prune, void *arg); | ||
| 163 | |||
| 164 | extern int fib6_walk(struct fib6_walker_t *w); | ||
| 165 | extern int fib6_walk_continue(struct fib6_walker_t *w); | ||
| 166 | 198 | ||
| 167 | extern int fib6_add(struct fib6_node *root, | 199 | extern int fib6_add(struct fib6_node *root, |
| 168 | struct rt6_info *rt, | 200 | struct rt6_info *rt, |
| 169 | struct nlmsghdr *nlh, | 201 | struct nl_info *info); |
| 170 | void *rtattr, | ||
| 171 | struct netlink_skb_parms *req); | ||
| 172 | 202 | ||
| 173 | extern int fib6_del(struct rt6_info *rt, | 203 | extern int fib6_del(struct rt6_info *rt, |
| 174 | struct nlmsghdr *nlh, | 204 | struct nl_info *info); |
| 175 | void *rtattr, | ||
| 176 | struct netlink_skb_parms *req); | ||
| 177 | 205 | ||
| 178 | extern void inet6_rt_notify(int event, struct rt6_info *rt, | 206 | extern void inet6_rt_notify(int event, struct rt6_info *rt, |
| 179 | struct nlmsghdr *nlh, | 207 | struct nl_info *info); |
| 180 | struct netlink_skb_parms *req); | ||
| 181 | 208 | ||
| 182 | extern void fib6_run_gc(unsigned long dummy); | 209 | extern void fib6_run_gc(unsigned long dummy); |
| 183 | 210 | ||
| 184 | extern void fib6_gc_cleanup(void); | 211 | extern void fib6_gc_cleanup(void); |
| 185 | 212 | ||
| 186 | extern void fib6_init(void); | 213 | extern void fib6_init(void); |
| 214 | |||
| 215 | extern void fib6_rules_init(void); | ||
| 216 | extern void fib6_rules_cleanup(void); | ||
| 217 | extern int fib6_rules_dump(struct sk_buff *, | ||
| 218 | struct netlink_callback *); | ||
| 219 | |||
| 187 | #endif | 220 | #endif |
| 188 | #endif | 221 | #endif |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index a398ae5e30f9..6ca6b71dfe0f 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
| @@ -32,6 +32,10 @@ struct route_info { | |||
| 32 | #include <linux/ip.h> | 32 | #include <linux/ip.h> |
| 33 | #include <linux/ipv6.h> | 33 | #include <linux/ipv6.h> |
| 34 | 34 | ||
| 35 | #define RT6_LOOKUP_F_IFACE 0x1 | ||
| 36 | #define RT6_LOOKUP_F_REACHABLE 0x2 | ||
| 37 | #define RT6_LOOKUP_F_HAS_SADDR 0x4 | ||
| 38 | |||
| 35 | struct pol_chain { | 39 | struct pol_chain { |
| 36 | int type; | 40 | int type; |
| 37 | int priority; | 41 | int priority; |
| @@ -41,6 +45,11 @@ struct pol_chain { | |||
| 41 | 45 | ||
| 42 | extern struct rt6_info ip6_null_entry; | 46 | extern struct rt6_info ip6_null_entry; |
| 43 | 47 | ||
| 48 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
| 49 | extern struct rt6_info ip6_prohibit_entry; | ||
| 50 | extern struct rt6_info ip6_blk_hole_entry; | ||
| 51 | #endif | ||
| 52 | |||
| 44 | extern int ip6_rt_gc_interval; | 53 | extern int ip6_rt_gc_interval; |
| 45 | 54 | ||
| 46 | extern void ip6_route_input(struct sk_buff *skb); | 55 | extern void ip6_route_input(struct sk_buff *skb); |
| @@ -48,25 +57,14 @@ extern void ip6_route_input(struct sk_buff *skb); | |||
| 48 | extern struct dst_entry * ip6_route_output(struct sock *sk, | 57 | extern struct dst_entry * ip6_route_output(struct sock *sk, |
| 49 | struct flowi *fl); | 58 | struct flowi *fl); |
| 50 | 59 | ||
| 51 | extern int ip6_route_me_harder(struct sk_buff *skb); | ||
| 52 | |||
| 53 | extern void ip6_route_init(void); | 60 | extern void ip6_route_init(void); |
| 54 | extern void ip6_route_cleanup(void); | 61 | extern void ip6_route_cleanup(void); |
| 55 | 62 | ||
| 56 | extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); | 63 | extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); |
| 57 | 64 | ||
| 58 | extern int ip6_route_add(struct in6_rtmsg *rtmsg, | 65 | extern int ip6_route_add(struct fib6_config *cfg); |
| 59 | struct nlmsghdr *, | 66 | extern int ip6_ins_rt(struct rt6_info *); |
| 60 | void *rtattr, | 67 | extern int ip6_del_rt(struct rt6_info *); |
| 61 | struct netlink_skb_parms *req); | ||
| 62 | extern int ip6_ins_rt(struct rt6_info *, | ||
| 63 | struct nlmsghdr *, | ||
| 64 | void *rtattr, | ||
| 65 | struct netlink_skb_parms *req); | ||
| 66 | extern int ip6_del_rt(struct rt6_info *, | ||
| 67 | struct nlmsghdr *, | ||
| 68 | void *rtattr, | ||
| 69 | struct netlink_skb_parms *req); | ||
| 70 | 68 | ||
| 71 | extern int ip6_rt_addr_add(struct in6_addr *addr, | 69 | extern int ip6_rt_addr_add(struct in6_addr *addr, |
| 72 | struct net_device *dev, | 70 | struct net_device *dev, |
| @@ -114,6 +112,7 @@ extern int rt6_route_rcv(struct net_device *dev, | |||
| 114 | struct in6_addr *gwaddr); | 112 | struct in6_addr *gwaddr); |
| 115 | 113 | ||
| 116 | extern void rt6_redirect(struct in6_addr *dest, | 114 | extern void rt6_redirect(struct in6_addr *dest, |
| 115 | struct in6_addr *src, | ||
| 117 | struct in6_addr *saddr, | 116 | struct in6_addr *saddr, |
| 118 | struct neighbour *neigh, | 117 | struct neighbour *neigh, |
| 119 | u8 *lladdr, | 118 | u8 *lladdr, |
| @@ -131,6 +130,13 @@ extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *a | |||
| 131 | extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 130 | extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
| 132 | extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 131 | extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
| 133 | 132 | ||
| 133 | struct rt6_rtnl_dump_arg | ||
| 134 | { | ||
| 135 | struct sk_buff *skb; | ||
| 136 | struct netlink_callback *cb; | ||
| 137 | }; | ||
| 138 | |||
| 139 | extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); | ||
| 134 | extern void rt6_ifdown(struct net_device *dev); | 140 | extern void rt6_ifdown(struct net_device *dev); |
| 135 | extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); | 141 | extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); |
| 136 | 142 | ||
| @@ -139,16 +145,25 @@ extern rwlock_t rt6_lock; | |||
| 139 | /* | 145 | /* |
| 140 | * Store a destination cache entry in a socket | 146 | * Store a destination cache entry in a socket |
| 141 | */ | 147 | */ |
| 142 | static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, | 148 | static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst, |
| 143 | struct in6_addr *daddr) | 149 | struct in6_addr *daddr, struct in6_addr *saddr) |
| 144 | { | 150 | { |
| 145 | struct ipv6_pinfo *np = inet6_sk(sk); | 151 | struct ipv6_pinfo *np = inet6_sk(sk); |
| 146 | struct rt6_info *rt = (struct rt6_info *) dst; | 152 | struct rt6_info *rt = (struct rt6_info *) dst; |
| 147 | 153 | ||
| 148 | write_lock(&sk->sk_dst_lock); | 154 | sk_setup_caps(sk, dst); |
| 149 | __sk_dst_set(sk, dst); | ||
| 150 | np->daddr_cache = daddr; | 155 | np->daddr_cache = daddr; |
| 156 | #ifdef CONFIG_IPV6_SUBTREES | ||
| 157 | np->saddr_cache = saddr; | ||
| 158 | #endif | ||
| 151 | np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; | 159 | np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; |
| 160 | } | ||
| 161 | |||
| 162 | static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, | ||
| 163 | struct in6_addr *daddr, struct in6_addr *saddr) | ||
| 164 | { | ||
| 165 | write_lock(&sk->sk_dst_lock); | ||
| 166 | __ip6_dst_store(sk, dst, daddr, saddr); | ||
| 152 | write_unlock(&sk->sk_dst_lock); | 167 | write_unlock(&sk->sk_dst_lock); |
| 153 | } | 168 | } |
| 154 | 169 | ||
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index a095d1dec7a4..82229146bac7 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
| @@ -18,26 +18,34 @@ | |||
| 18 | 18 | ||
| 19 | #include <net/flow.h> | 19 | #include <net/flow.h> |
| 20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
| 21 | 21 | #include <net/fib_rules.h> | |
| 22 | /* WARNING: The ordering of these elements must match ordering | 22 | |
| 23 | * of RTA_* rtnetlink attribute numbers. | 23 | struct fib_config { |
| 24 | */ | 24 | u8 fc_family; |
| 25 | struct kern_rta { | 25 | u8 fc_dst_len; |
| 26 | void *rta_dst; | 26 | u8 fc_src_len; |
| 27 | void *rta_src; | 27 | u8 fc_tos; |
| 28 | int *rta_iif; | 28 | u8 fc_protocol; |
| 29 | int *rta_oif; | 29 | u8 fc_scope; |
| 30 | void *rta_gw; | 30 | u8 fc_type; |
| 31 | u32 *rta_priority; | 31 | /* 1 byte unused */ |
| 32 | void *rta_prefsrc; | 32 | u32 fc_table; |
| 33 | struct rtattr *rta_mx; | 33 | __be32 fc_dst; |
| 34 | struct rtattr *rta_mp; | 34 | __be32 fc_src; |
| 35 | unsigned char *rta_protoinfo; | 35 | __be32 fc_gw; |
| 36 | u32 *rta_flow; | 36 | int fc_oif; |
| 37 | struct rta_cacheinfo *rta_ci; | 37 | u32 fc_flags; |
| 38 | struct rta_session *rta_sess; | 38 | u32 fc_priority; |
| 39 | u32 *rta_mp_alg; | 39 | __be32 fc_prefsrc; |
| 40 | }; | 40 | struct nlattr *fc_mx; |
| 41 | struct rtnexthop *fc_mp; | ||
| 42 | int fc_mx_len; | ||
| 43 | int fc_mp_len; | ||
| 44 | u32 fc_flow; | ||
| 45 | u32 fc_mp_alg; | ||
| 46 | u32 fc_nlflags; | ||
| 47 | struct nl_info fc_nlinfo; | ||
| 48 | }; | ||
| 41 | 49 | ||
| 42 | struct fib_info; | 50 | struct fib_info; |
| 43 | 51 | ||
| @@ -55,7 +63,7 @@ struct fib_nh { | |||
| 55 | __u32 nh_tclassid; | 63 | __u32 nh_tclassid; |
| 56 | #endif | 64 | #endif |
| 57 | int nh_oif; | 65 | int nh_oif; |
| 58 | u32 nh_gw; | 66 | __be32 nh_gw; |
| 59 | }; | 67 | }; |
| 60 | 68 | ||
| 61 | /* | 69 | /* |
| @@ -70,7 +78,7 @@ struct fib_info { | |||
| 70 | int fib_dead; | 78 | int fib_dead; |
| 71 | unsigned fib_flags; | 79 | unsigned fib_flags; |
| 72 | int fib_protocol; | 80 | int fib_protocol; |
| 73 | u32 fib_prefsrc; | 81 | __be32 fib_prefsrc; |
| 74 | u32 fib_priority; | 82 | u32 fib_priority; |
| 75 | u32 fib_metrics[RTAX_MAX]; | 83 | u32 fib_metrics[RTAX_MAX]; |
| 76 | #define fib_mtu fib_metrics[RTAX_MTU-1] | 84 | #define fib_mtu fib_metrics[RTAX_MTU-1] |
| @@ -99,8 +107,8 @@ struct fib_result { | |||
| 99 | unsigned char type; | 107 | unsigned char type; |
| 100 | unsigned char scope; | 108 | unsigned char scope; |
| 101 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED | 109 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED |
| 102 | __u32 network; | 110 | __be32 network; |
| 103 | __u32 netmask; | 111 | __be32 netmask; |
| 104 | #endif | 112 | #endif |
| 105 | struct fib_info *fi; | 113 | struct fib_info *fi; |
| 106 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 114 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
| @@ -109,7 +117,7 @@ struct fib_result { | |||
| 109 | }; | 117 | }; |
| 110 | 118 | ||
| 111 | struct fib_result_nl { | 119 | struct fib_result_nl { |
| 112 | u32 fl_addr; /* To be looked up*/ | 120 | __be32 fl_addr; /* To be looked up*/ |
| 113 | u32 fl_fwmark; | 121 | u32 fl_fwmark; |
| 114 | unsigned char fl_tos; | 122 | unsigned char fl_tos; |
| 115 | unsigned char fl_scope; | 123 | unsigned char fl_scope; |
| @@ -149,15 +157,12 @@ struct fib_result_nl { | |||
| 149 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */ | 157 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */ |
| 150 | 158 | ||
| 151 | struct fib_table { | 159 | struct fib_table { |
| 152 | unsigned char tb_id; | 160 | struct hlist_node tb_hlist; |
| 161 | u32 tb_id; | ||
| 153 | unsigned tb_stamp; | 162 | unsigned tb_stamp; |
| 154 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); | 163 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); |
| 155 | int (*tb_insert)(struct fib_table *table, struct rtmsg *r, | 164 | int (*tb_insert)(struct fib_table *, struct fib_config *); |
| 156 | struct kern_rta *rta, struct nlmsghdr *n, | 165 | int (*tb_delete)(struct fib_table *, struct fib_config *); |
| 157 | struct netlink_skb_parms *req); | ||
| 158 | int (*tb_delete)(struct fib_table *table, struct rtmsg *r, | ||
| 159 | struct kern_rta *rta, struct nlmsghdr *n, | ||
| 160 | struct netlink_skb_parms *req); | ||
| 161 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, | 166 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, |
| 162 | struct netlink_callback *cb); | 167 | struct netlink_callback *cb); |
| 163 | int (*tb_flush)(struct fib_table *table); | 168 | int (*tb_flush)(struct fib_table *table); |
| @@ -172,14 +177,14 @@ struct fib_table { | |||
| 172 | extern struct fib_table *ip_fib_local_table; | 177 | extern struct fib_table *ip_fib_local_table; |
| 173 | extern struct fib_table *ip_fib_main_table; | 178 | extern struct fib_table *ip_fib_main_table; |
| 174 | 179 | ||
| 175 | static inline struct fib_table *fib_get_table(int id) | 180 | static inline struct fib_table *fib_get_table(u32 id) |
| 176 | { | 181 | { |
| 177 | if (id != RT_TABLE_LOCAL) | 182 | if (id != RT_TABLE_LOCAL) |
| 178 | return ip_fib_main_table; | 183 | return ip_fib_main_table; |
| 179 | return ip_fib_local_table; | 184 | return ip_fib_local_table; |
| 180 | } | 185 | } |
| 181 | 186 | ||
| 182 | static inline struct fib_table *fib_new_table(int id) | 187 | static inline struct fib_table *fib_new_table(u32 id) |
| 183 | { | 188 | { |
| 184 | return fib_get_table(id); | 189 | return fib_get_table(id); |
| 185 | } | 190 | } |
| @@ -199,67 +204,48 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result | |||
| 199 | } | 204 | } |
| 200 | 205 | ||
| 201 | #else /* CONFIG_IP_MULTIPLE_TABLES */ | 206 | #else /* CONFIG_IP_MULTIPLE_TABLES */ |
| 202 | #define ip_fib_local_table (fib_tables[RT_TABLE_LOCAL]) | 207 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) |
| 203 | #define ip_fib_main_table (fib_tables[RT_TABLE_MAIN]) | 208 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) |
| 204 | |||
| 205 | extern struct fib_table * fib_tables[RT_TABLE_MAX+1]; | ||
| 206 | extern int fib_lookup(const struct flowi *flp, struct fib_result *res); | ||
| 207 | extern struct fib_table *__fib_new_table(int id); | ||
| 208 | extern void fib_rule_put(struct fib_rule *r); | ||
| 209 | 209 | ||
| 210 | static inline struct fib_table *fib_get_table(int id) | 210 | extern int fib_lookup(struct flowi *flp, struct fib_result *res); |
| 211 | { | ||
| 212 | if (id == 0) | ||
| 213 | id = RT_TABLE_MAIN; | ||
| 214 | |||
| 215 | return fib_tables[id]; | ||
| 216 | } | ||
| 217 | |||
| 218 | static inline struct fib_table *fib_new_table(int id) | ||
| 219 | { | ||
| 220 | if (id == 0) | ||
| 221 | id = RT_TABLE_MAIN; | ||
| 222 | |||
| 223 | return fib_tables[id] ? : __fib_new_table(id); | ||
| 224 | } | ||
| 225 | 211 | ||
| 212 | extern struct fib_table *fib_new_table(u32 id); | ||
| 213 | extern struct fib_table *fib_get_table(u32 id); | ||
| 226 | extern void fib_select_default(const struct flowi *flp, struct fib_result *res); | 214 | extern void fib_select_default(const struct flowi *flp, struct fib_result *res); |
| 227 | 215 | ||
| 228 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ | 216 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ |
| 229 | 217 | ||
| 230 | /* Exported by fib_frontend.c */ | 218 | /* Exported by fib_frontend.c */ |
| 219 | extern struct nla_policy rtm_ipv4_policy[]; | ||
| 231 | extern void ip_fib_init(void); | 220 | extern void ip_fib_init(void); |
| 232 | extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 221 | extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
| 233 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 222 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
| 234 | extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 223 | extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
| 235 | extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); | 224 | extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); |
| 236 | extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, | 225 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
| 237 | struct net_device *dev, u32 *spec_dst, u32 *itag); | 226 | struct net_device *dev, __be32 *spec_dst, u32 *itag); |
| 238 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | 227 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); |
| 239 | 228 | ||
| 240 | struct rtentry; | 229 | struct rtentry; |
| 241 | 230 | ||
| 242 | /* Exported by fib_semantics.c */ | 231 | /* Exported by fib_semantics.c */ |
| 243 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); | 232 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); |
| 244 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); | 233 | extern int fib_sync_down(__be32 local, struct net_device *dev, int force); |
| 245 | extern int fib_sync_up(struct net_device *dev); | 234 | extern int fib_sync_up(struct net_device *dev); |
| 246 | extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, | 235 | extern __be32 __fib_res_prefsrc(struct fib_result *res); |
| 247 | struct kern_rta *rta, struct rtentry *r); | ||
| 248 | extern u32 __fib_res_prefsrc(struct fib_result *res); | ||
| 249 | 236 | ||
| 250 | /* Exported by fib_hash.c */ | 237 | /* Exported by fib_hash.c */ |
| 251 | extern struct fib_table *fib_hash_init(int id); | 238 | extern struct fib_table *fib_hash_init(u32 id); |
| 252 | 239 | ||
| 253 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 240 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
| 254 | /* Exported by fib_rules.c */ | 241 | extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb); |
| 242 | |||
| 243 | extern void __init fib4_rules_init(void); | ||
| 255 | 244 | ||
| 256 | extern int inet_rtm_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
| 257 | extern int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
| 258 | extern int inet_dump_rules(struct sk_buff *skb, struct netlink_callback *cb); | ||
| 259 | #ifdef CONFIG_NET_CLS_ROUTE | 245 | #ifdef CONFIG_NET_CLS_ROUTE |
| 260 | extern u32 fib_rules_tclass(struct fib_result *res); | 246 | extern u32 fib_rules_tclass(struct fib_result *res); |
| 261 | #endif | 247 | #endif |
| 262 | extern void fib_rules_init(void); | 248 | |
| 263 | #endif | 249 | #endif |
| 264 | 250 | ||
| 265 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 251 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) |
diff --git a/include/net/ip_mp_alg.h b/include/net/ip_mp_alg.h index ac747b64734c..beffdd66ad74 100644 --- a/include/net/ip_mp_alg.h +++ b/include/net/ip_mp_alg.h | |||
| @@ -17,7 +17,7 @@ struct ip_mp_alg_ops { | |||
| 17 | void (*mp_alg_select_route)(const struct flowi *flp, | 17 | void (*mp_alg_select_route)(const struct flowi *flp, |
| 18 | struct rtable *rth, struct rtable **rp); | 18 | struct rtable *rth, struct rtable **rp); |
| 19 | void (*mp_alg_flush)(void); | 19 | void (*mp_alg_flush)(void); |
| 20 | void (*mp_alg_set_nhinfo)(__u32 network, __u32 netmask, | 20 | void (*mp_alg_set_nhinfo)(__be32 network, __be32 netmask, |
| 21 | unsigned char prefixlen, | 21 | unsigned char prefixlen, |
| 22 | const struct fib_nh *nh); | 22 | const struct fib_nh *nh); |
| 23 | void (*mp_alg_remove)(struct rtable *rth); | 23 | void (*mp_alg_remove)(struct rtable *rth); |
| @@ -59,7 +59,7 @@ static inline void multipath_flush(void) | |||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | static inline void multipath_set_nhinfo(struct rtable *rth, | 61 | static inline void multipath_set_nhinfo(struct rtable *rth, |
| 62 | __u32 network, __u32 netmask, | 62 | __be32 network, __be32 netmask, |
| 63 | unsigned char prefixlen, | 63 | unsigned char prefixlen, |
| 64 | const struct fib_nh *nh) | 64 | const struct fib_nh *nh) |
| 65 | { | 65 | { |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 3b57b159b653..49c717e3b040 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -100,22 +100,22 @@ | |||
| 100 | struct ip_vs_service_user { | 100 | struct ip_vs_service_user { |
| 101 | /* virtual service addresses */ | 101 | /* virtual service addresses */ |
| 102 | u_int16_t protocol; | 102 | u_int16_t protocol; |
| 103 | u_int32_t addr; /* virtual ip address */ | 103 | __be32 addr; /* virtual ip address */ |
| 104 | u_int16_t port; | 104 | __be16 port; |
| 105 | u_int32_t fwmark; /* firwall mark of service */ | 105 | u_int32_t fwmark; /* firwall mark of service */ |
| 106 | 106 | ||
| 107 | /* virtual service options */ | 107 | /* virtual service options */ |
| 108 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; | 108 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; |
| 109 | unsigned flags; /* virtual service flags */ | 109 | unsigned flags; /* virtual service flags */ |
| 110 | unsigned timeout; /* persistent timeout in sec */ | 110 | unsigned timeout; /* persistent timeout in sec */ |
| 111 | u_int32_t netmask; /* persistent netmask */ | 111 | __be32 netmask; /* persistent netmask */ |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | 114 | ||
| 115 | struct ip_vs_dest_user { | 115 | struct ip_vs_dest_user { |
| 116 | /* destination server address */ | 116 | /* destination server address */ |
| 117 | u_int32_t addr; | 117 | __be32 addr; |
| 118 | u_int16_t port; | 118 | __be16 port; |
| 119 | 119 | ||
| 120 | /* real server options */ | 120 | /* real server options */ |
| 121 | unsigned conn_flags; /* connection flags */ | 121 | unsigned conn_flags; /* connection flags */ |
| @@ -163,15 +163,15 @@ struct ip_vs_getinfo { | |||
| 163 | struct ip_vs_service_entry { | 163 | struct ip_vs_service_entry { |
| 164 | /* which service: user fills in these */ | 164 | /* which service: user fills in these */ |
| 165 | u_int16_t protocol; | 165 | u_int16_t protocol; |
| 166 | u_int32_t addr; /* virtual address */ | 166 | __be32 addr; /* virtual address */ |
| 167 | u_int16_t port; | 167 | __be16 port; |
| 168 | u_int32_t fwmark; /* firwall mark of service */ | 168 | u_int32_t fwmark; /* firwall mark of service */ |
| 169 | 169 | ||
| 170 | /* service options */ | 170 | /* service options */ |
| 171 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; | 171 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; |
| 172 | unsigned flags; /* virtual service flags */ | 172 | unsigned flags; /* virtual service flags */ |
| 173 | unsigned timeout; /* persistent timeout */ | 173 | unsigned timeout; /* persistent timeout */ |
| 174 | u_int32_t netmask; /* persistent netmask */ | 174 | __be32 netmask; /* persistent netmask */ |
| 175 | 175 | ||
| 176 | /* number of real servers */ | 176 | /* number of real servers */ |
| 177 | unsigned int num_dests; | 177 | unsigned int num_dests; |
| @@ -182,8 +182,8 @@ struct ip_vs_service_entry { | |||
| 182 | 182 | ||
| 183 | 183 | ||
| 184 | struct ip_vs_dest_entry { | 184 | struct ip_vs_dest_entry { |
| 185 | u_int32_t addr; /* destination address */ | 185 | __be32 addr; /* destination address */ |
| 186 | u_int16_t port; | 186 | __be16 port; |
| 187 | unsigned conn_flags; /* connection flags */ | 187 | unsigned conn_flags; /* connection flags */ |
| 188 | int weight; /* destination weight */ | 188 | int weight; /* destination weight */ |
| 189 | 189 | ||
| @@ -203,8 +203,8 @@ struct ip_vs_dest_entry { | |||
| 203 | struct ip_vs_get_dests { | 203 | struct ip_vs_get_dests { |
| 204 | /* which service: user fills in these */ | 204 | /* which service: user fills in these */ |
| 205 | u_int16_t protocol; | 205 | u_int16_t protocol; |
| 206 | u_int32_t addr; /* virtual address */ | 206 | __be32 addr; /* virtual address */ |
| 207 | u_int16_t port; | 207 | __be16 port; |
| 208 | u_int32_t fwmark; /* firwall mark of service */ | 208 | u_int32_t fwmark; /* firwall mark of service */ |
| 209 | 209 | ||
| 210 | /* number of real servers */ | 210 | /* number of real servers */ |
| @@ -502,12 +502,12 @@ struct ip_vs_conn { | |||
| 502 | struct list_head c_list; /* hashed list heads */ | 502 | struct list_head c_list; /* hashed list heads */ |
| 503 | 503 | ||
| 504 | /* Protocol, addresses and port numbers */ | 504 | /* Protocol, addresses and port numbers */ |
| 505 | __u32 caddr; /* client address */ | 505 | __be32 caddr; /* client address */ |
| 506 | __u32 vaddr; /* virtual address */ | 506 | __be32 vaddr; /* virtual address */ |
| 507 | __u32 daddr; /* destination address */ | 507 | __be32 daddr; /* destination address */ |
| 508 | __u16 cport; | 508 | __be16 cport; |
| 509 | __u16 vport; | 509 | __be16 vport; |
| 510 | __u16 dport; | 510 | __be16 dport; |
| 511 | __u16 protocol; /* Which protocol (TCP/UDP) */ | 511 | __u16 protocol; /* Which protocol (TCP/UDP) */ |
| 512 | 512 | ||
| 513 | /* counter and timer */ | 513 | /* counter and timer */ |
| @@ -554,12 +554,12 @@ struct ip_vs_service { | |||
| 554 | atomic_t usecnt; /* use counter */ | 554 | atomic_t usecnt; /* use counter */ |
| 555 | 555 | ||
| 556 | __u16 protocol; /* which protocol (TCP/UDP) */ | 556 | __u16 protocol; /* which protocol (TCP/UDP) */ |
| 557 | __u32 addr; /* IP address for virtual service */ | 557 | __be32 addr; /* IP address for virtual service */ |
| 558 | __u16 port; /* port number for the service */ | 558 | __be16 port; /* port number for the service */ |
| 559 | __u32 fwmark; /* firewall mark of the service */ | 559 | __u32 fwmark; /* firewall mark of the service */ |
| 560 | unsigned flags; /* service status flags */ | 560 | unsigned flags; /* service status flags */ |
| 561 | unsigned timeout; /* persistent timeout in ticks */ | 561 | unsigned timeout; /* persistent timeout in ticks */ |
| 562 | __u32 netmask; /* grouping granularity */ | 562 | __be32 netmask; /* grouping granularity */ |
| 563 | 563 | ||
| 564 | struct list_head destinations; /* real server d-linked list */ | 564 | struct list_head destinations; /* real server d-linked list */ |
| 565 | __u32 num_dests; /* number of servers */ | 565 | __u32 num_dests; /* number of servers */ |
| @@ -581,8 +581,8 @@ struct ip_vs_dest { | |||
| 581 | struct list_head n_list; /* for the dests in the service */ | 581 | struct list_head n_list; /* for the dests in the service */ |
| 582 | struct list_head d_list; /* for table with all the dests */ | 582 | struct list_head d_list; /* for table with all the dests */ |
| 583 | 583 | ||
| 584 | __u32 addr; /* IP address of the server */ | 584 | __be32 addr; /* IP address of the server */ |
| 585 | __u16 port; /* port number of the server */ | 585 | __be16 port; /* port number of the server */ |
| 586 | volatile unsigned flags; /* dest status flags */ | 586 | volatile unsigned flags; /* dest status flags */ |
| 587 | atomic_t conn_flags; /* flags to copy to conn */ | 587 | atomic_t conn_flags; /* flags to copy to conn */ |
| 588 | atomic_t weight; /* server weight */ | 588 | atomic_t weight; /* server weight */ |
| @@ -605,8 +605,8 @@ struct ip_vs_dest { | |||
| 605 | /* for virtual service */ | 605 | /* for virtual service */ |
| 606 | struct ip_vs_service *svc; /* service it belongs to */ | 606 | struct ip_vs_service *svc; /* service it belongs to */ |
| 607 | __u16 protocol; /* which protocol (TCP/UDP) */ | 607 | __u16 protocol; /* which protocol (TCP/UDP) */ |
| 608 | __u32 vaddr; /* virtual IP address */ | 608 | __be32 vaddr; /* virtual IP address */ |
| 609 | __u16 vport; /* virtual port number */ | 609 | __be16 vport; /* virtual port number */ |
| 610 | __u32 vfwmark; /* firewall mark of service */ | 610 | __u32 vfwmark; /* firewall mark of service */ |
| 611 | }; | 611 | }; |
| 612 | 612 | ||
| @@ -648,7 +648,7 @@ struct ip_vs_app | |||
| 648 | /* members for application incarnations */ | 648 | /* members for application incarnations */ |
| 649 | struct list_head p_list; /* member in proto app list */ | 649 | struct list_head p_list; /* member in proto app list */ |
| 650 | struct ip_vs_app *app; /* its real application */ | 650 | struct ip_vs_app *app; /* its real application */ |
| 651 | __u16 port; /* port number in net order */ | 651 | __be16 port; /* port number in net order */ |
| 652 | atomic_t usecnt; /* usage counter */ | 652 | atomic_t usecnt; /* usage counter */ |
| 653 | 653 | ||
| 654 | /* output hook: return false if can't linearize. diff set for TCP. */ | 654 | /* output hook: return false if can't linearize. diff set for TCP. */ |
| @@ -740,11 +740,11 @@ enum { | |||
| 740 | }; | 740 | }; |
| 741 | 741 | ||
| 742 | extern struct ip_vs_conn *ip_vs_conn_in_get | 742 | extern struct ip_vs_conn *ip_vs_conn_in_get |
| 743 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); | 743 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); |
| 744 | extern struct ip_vs_conn *ip_vs_ct_in_get | 744 | extern struct ip_vs_conn *ip_vs_ct_in_get |
| 745 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); | 745 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); |
| 746 | extern struct ip_vs_conn *ip_vs_conn_out_get | 746 | extern struct ip_vs_conn *ip_vs_conn_out_get |
| 747 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); | 747 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); |
| 748 | 748 | ||
| 749 | /* put back the conn without restarting its timer */ | 749 | /* put back the conn without restarting its timer */ |
| 750 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | 750 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) |
| @@ -752,11 +752,11 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | |||
| 752 | atomic_dec(&cp->refcnt); | 752 | atomic_dec(&cp->refcnt); |
| 753 | } | 753 | } |
| 754 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); | 754 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); |
| 755 | extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport); | 755 | extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); |
| 756 | 756 | ||
| 757 | extern struct ip_vs_conn * | 757 | extern struct ip_vs_conn * |
| 758 | ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport, | 758 | ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport, |
| 759 | __u32 daddr, __u16 dport, unsigned flags, | 759 | __be32 daddr, __be16 dport, unsigned flags, |
| 760 | struct ip_vs_dest *dest); | 760 | struct ip_vs_dest *dest); |
| 761 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); | 761 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); |
| 762 | 762 | ||
| @@ -887,7 +887,7 @@ extern int sysctl_ip_vs_nat_icmp_send; | |||
| 887 | extern struct ip_vs_stats ip_vs_stats; | 887 | extern struct ip_vs_stats ip_vs_stats; |
| 888 | 888 | ||
| 889 | extern struct ip_vs_service * | 889 | extern struct ip_vs_service * |
| 890 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport); | 890 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); |
| 891 | 891 | ||
| 892 | static inline void ip_vs_service_put(struct ip_vs_service *svc) | 892 | static inline void ip_vs_service_put(struct ip_vs_service *svc) |
| 893 | { | 893 | { |
| @@ -895,7 +895,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc) | |||
| 895 | } | 895 | } |
| 896 | 896 | ||
| 897 | extern struct ip_vs_dest * | 897 | extern struct ip_vs_dest * |
| 898 | ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport); | 898 | ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport); |
| 899 | extern int ip_vs_use_count_inc(void); | 899 | extern int ip_vs_use_count_inc(void); |
| 900 | extern void ip_vs_use_count_dec(void); | 900 | extern void ip_vs_use_count_dec(void); |
| 901 | extern int ip_vs_control_init(void); | 901 | extern int ip_vs_control_init(void); |
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h index e651a57ecdd5..87c1af3e5e82 100644 --- a/include/net/ipcomp.h +++ b/include/net/ipcomp.h | |||
| @@ -1,11 +1,14 @@ | |||
| 1 | #ifndef _NET_IPCOMP_H | 1 | #ifndef _NET_IPCOMP_H |
| 2 | #define _NET_IPCOMP_H | 2 | #define _NET_IPCOMP_H |
| 3 | 3 | ||
| 4 | #include <linux/crypto.h> | ||
| 5 | #include <linux/types.h> | ||
| 6 | |||
| 4 | #define IPCOMP_SCRATCH_SIZE 65400 | 7 | #define IPCOMP_SCRATCH_SIZE 65400 |
| 5 | 8 | ||
| 6 | struct ipcomp_data { | 9 | struct ipcomp_data { |
| 7 | u16 threshold; | 10 | u16 threshold; |
| 8 | struct crypto_tfm **tfms; | 11 | struct crypto_comp **tfms; |
| 9 | }; | 12 | }; |
| 10 | 13 | ||
| 11 | #endif | 14 | #endif |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index a8fdf7970b37..8223c4410b4b 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #define NEXTHDR_ICMP 58 /* ICMP for IPv6. */ | 40 | #define NEXTHDR_ICMP 58 /* ICMP for IPv6. */ |
| 41 | #define NEXTHDR_NONE 59 /* No next header */ | 41 | #define NEXTHDR_NONE 59 /* No next header */ |
| 42 | #define NEXTHDR_DEST 60 /* Destination options header. */ | 42 | #define NEXTHDR_DEST 60 /* Destination options header. */ |
| 43 | #define NEXTHDR_MOBILITY 135 /* Mobility header. */ | ||
| 43 | 44 | ||
| 44 | #define NEXTHDR_MAX 255 | 45 | #define NEXTHDR_MAX 255 |
| 45 | 46 | ||
| @@ -229,7 +230,7 @@ extern int ip6_ra_control(struct sock *sk, int sel, | |||
| 229 | void (*destructor)(struct sock *)); | 230 | void (*destructor)(struct sock *)); |
| 230 | 231 | ||
| 231 | 232 | ||
| 232 | extern int ipv6_parse_hopopts(struct sk_buff *skb); | 233 | extern int ipv6_parse_hopopts(struct sk_buff **skbp); |
| 233 | 234 | ||
| 234 | extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); | 235 | extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); |
| 235 | extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, | 236 | extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, |
| @@ -317,8 +318,8 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx, | |||
| 317 | 318 | ||
| 318 | #ifndef __HAVE_ARCH_ADDR_SET | 319 | #ifndef __HAVE_ARCH_ADDR_SET |
| 319 | static inline void ipv6_addr_set(struct in6_addr *addr, | 320 | static inline void ipv6_addr_set(struct in6_addr *addr, |
| 320 | __u32 w1, __u32 w2, | 321 | __be32 w1, __be32 w2, |
| 321 | __u32 w3, __u32 w4) | 322 | __be32 w3, __be32 w4) |
| 322 | { | 323 | { |
| 323 | addr->s6_addr32[0] = w1; | 324 | addr->s6_addr32[0] = w1; |
| 324 | addr->s6_addr32[1] = w2; | 325 | addr->s6_addr32[1] = w2; |
| @@ -336,7 +337,7 @@ static inline int ipv6_addr_equal(const struct in6_addr *a1, | |||
| 336 | a1->s6_addr32[3] == a2->s6_addr32[3]); | 337 | a1->s6_addr32[3] == a2->s6_addr32[3]); |
| 337 | } | 338 | } |
| 338 | 339 | ||
| 339 | static inline int __ipv6_prefix_equal(const u32 *a1, const u32 *a2, | 340 | static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, |
| 340 | unsigned int prefixlen) | 341 | unsigned int prefixlen) |
| 341 | { | 342 | { |
| 342 | unsigned pdw, pbi; | 343 | unsigned pdw, pbi; |
| @@ -468,6 +469,9 @@ extern void ip6_flush_pending_frames(struct sock *sk); | |||
| 468 | extern int ip6_dst_lookup(struct sock *sk, | 469 | extern int ip6_dst_lookup(struct sock *sk, |
| 469 | struct dst_entry **dst, | 470 | struct dst_entry **dst, |
| 470 | struct flowi *fl); | 471 | struct flowi *fl); |
| 472 | extern int ip6_sk_dst_lookup(struct sock *sk, | ||
| 473 | struct dst_entry **dst, | ||
| 474 | struct flowi *fl); | ||
| 471 | 475 | ||
| 472 | /* | 476 | /* |
| 473 | * skb processing functions | 477 | * skb processing functions |
| @@ -503,6 +507,8 @@ extern int ipv6_skip_exthdr(const struct sk_buff *, int start, | |||
| 503 | 507 | ||
| 504 | extern int ipv6_ext_hdr(u8 nexthdr); | 508 | extern int ipv6_ext_hdr(u8 nexthdr); |
| 505 | 509 | ||
| 510 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); | ||
| 511 | |||
| 506 | extern struct ipv6_txoptions * ipv6_invert_rthdr(struct sock *sk, | 512 | extern struct ipv6_txoptions * ipv6_invert_rthdr(struct sock *sk, |
| 507 | struct ipv6_rt_hdr *hdr); | 513 | struct ipv6_rt_hdr *hdr); |
| 508 | 514 | ||
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index 0575c59a5c96..bca19ca7bdd4 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h | |||
| @@ -160,7 +160,7 @@ typedef struct { | |||
| 160 | int irq, irq2; /* Interrupts used */ | 160 | int irq, irq2; /* Interrupts used */ |
| 161 | int dma, dma2; /* DMA channel(s) used */ | 161 | int dma, dma2; /* DMA channel(s) used */ |
| 162 | int fifo_size; /* FIFO size */ | 162 | int fifo_size; /* FIFO size */ |
| 163 | int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */ | 163 | int irqflags; /* interrupt flags (ie, IRQF_SHARED|IRQF_DISABLED) */ |
| 164 | int direction; /* Link direction, used by some FIR drivers */ | 164 | int direction; /* Link direction, used by some FIR drivers */ |
| 165 | int enabled; /* Powered on? */ | 165 | int enabled; /* Powered on? */ |
| 166 | int suspended; /* Suspended by APM */ | 166 | int suspended; /* Suspended by APM */ |
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h index 1c73bdbc3eb3..9592c374b41d 100644 --- a/include/net/irda/irlan_common.h +++ b/include/net/irda/irlan_common.h | |||
| @@ -98,7 +98,15 @@ | |||
| 98 | #define IRLAN_SHORT 1 | 98 | #define IRLAN_SHORT 1 |
| 99 | #define IRLAN_ARRAY 2 | 99 | #define IRLAN_ARRAY 2 |
| 100 | 100 | ||
| 101 | #define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_MAX_HEADER) | 101 | /* IrLAN sits on top if IrTTP */ |
| 102 | #define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER) | ||
| 103 | /* 1 byte for the command code and 1 byte for the parameter count */ | ||
| 104 | #define IRLAN_CMD_HEADER 2 | ||
| 105 | |||
| 106 | #define IRLAN_STRING_PARAMETER_LEN(name, value) (1 + strlen((name)) + 2 \ | ||
| 107 | + strlen ((value))) | ||
| 108 | #define IRLAN_BYTE_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 1) | ||
| 109 | #define IRLAN_SHORT_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 2) | ||
| 102 | 110 | ||
| 103 | /* | 111 | /* |
| 104 | * IrLAN client | 112 | * IrLAN client |
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h index 3452ae257c84..9dd54a5002b2 100644 --- a/include/net/irda/irlap_frame.h +++ b/include/net/irda/irlap_frame.h | |||
| @@ -74,6 +74,19 @@ struct discovery_t; | |||
| 74 | 74 | ||
| 75 | #define PF_BIT 0x10 /* Poll/final bit */ | 75 | #define PF_BIT 0x10 /* Poll/final bit */ |
| 76 | 76 | ||
| 77 | /* Some IrLAP field lengths */ | ||
| 78 | /* | ||
| 79 | * Only baud rate triplet is 4 bytes (PV can be 2 bytes). | ||
| 80 | * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes. | ||
| 81 | */ | ||
| 82 | #define IRLAP_NEGOCIATION_PARAMS_LEN 25 | ||
| 83 | #define IRLAP_DISCOVERY_INFO_LEN 32 | ||
| 84 | |||
| 85 | struct disc_frame { | ||
| 86 | __u8 caddr; /* Connection address */ | ||
| 87 | __u8 control; | ||
| 88 | } IRDA_PACK; | ||
| 89 | |||
| 77 | struct xid_frame { | 90 | struct xid_frame { |
| 78 | __u8 caddr; /* Connection address */ | 91 | __u8 caddr; /* Connection address */ |
| 79 | __u8 control; | 92 | __u8 control; |
| @@ -95,11 +108,25 @@ struct test_frame { | |||
| 95 | struct ua_frame { | 108 | struct ua_frame { |
| 96 | __u8 caddr; | 109 | __u8 caddr; |
| 97 | __u8 control; | 110 | __u8 control; |
| 98 | |||
| 99 | __u32 saddr; /* Source device address */ | 111 | __u32 saddr; /* Source device address */ |
| 100 | __u32 daddr; /* Dest device address */ | 112 | __u32 daddr; /* Dest device address */ |
| 101 | } IRDA_PACK; | 113 | } IRDA_PACK; |
| 102 | 114 | ||
| 115 | struct dm_frame { | ||
| 116 | __u8 caddr; /* Connection address */ | ||
| 117 | __u8 control; | ||
| 118 | } IRDA_PACK; | ||
| 119 | |||
| 120 | struct rd_frame { | ||
| 121 | __u8 caddr; /* Connection address */ | ||
| 122 | __u8 control; | ||
| 123 | } IRDA_PACK; | ||
| 124 | |||
| 125 | struct rr_frame { | ||
| 126 | __u8 caddr; /* Connection address */ | ||
| 127 | __u8 control; | ||
| 128 | } IRDA_PACK; | ||
| 129 | |||
| 103 | struct i_frame { | 130 | struct i_frame { |
| 104 | __u8 caddr; | 131 | __u8 caddr; |
| 105 | __u8 control; | 132 | __u8 control; |
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h index 11ecfa58a648..e212b9bc2503 100644 --- a/include/net/irda/irlmp.h +++ b/include/net/irda/irlmp.h | |||
| @@ -48,7 +48,7 @@ | |||
| 48 | #define DEV_ADDR_ANY 0xffffffff | 48 | #define DEV_ADDR_ANY 0xffffffff |
| 49 | 49 | ||
| 50 | #define LMP_HEADER 2 /* Dest LSAP + Source LSAP */ | 50 | #define LMP_HEADER 2 /* Dest LSAP + Source LSAP */ |
| 51 | #define LMP_CONTROL_HEADER 4 | 51 | #define LMP_CONTROL_HEADER 4 /* LMP_HEADER + opcode + parameter */ |
| 52 | #define LMP_PID_HEADER 1 /* Used by Ultra */ | 52 | #define LMP_PID_HEADER 1 /* Used by Ultra */ |
| 53 | #define LMP_MAX_HEADER (LMP_CONTROL_HEADER+LAP_MAX_HEADER) | 53 | #define LMP_MAX_HEADER (LMP_CONTROL_HEADER+LAP_MAX_HEADER) |
| 54 | 54 | ||
diff --git a/include/net/mip6.h b/include/net/mip6.h new file mode 100644 index 000000000000..68263c6d9996 --- /dev/null +++ b/include/net/mip6.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C)2003-2006 Helsinki University of Technology | ||
| 3 | * Copyright (C)2003-2006 USAGI/WIDE Project | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 18 | */ | ||
| 19 | /* | ||
| 20 | * Authors: | ||
| 21 | * Noriaki TAKAMIYA @USAGI | ||
| 22 | * Masahide NAKAMURA @USAGI | ||
| 23 | * YOSHIFUJI Hideaki @USAGI | ||
| 24 | */ | ||
| 25 | #ifndef _NET_MIP6_H | ||
| 26 | #define _NET_MIP6_H | ||
| 27 | |||
| 28 | #include <linux/skbuff.h> | ||
| 29 | #include <net/sock.h> | ||
| 30 | |||
| 31 | #define MIP6_OPT_PAD_1 0 | ||
| 32 | #define MIP6_OPT_PAD_N 1 | ||
| 33 | |||
| 34 | /* | ||
| 35 | * Mobility Header | ||
| 36 | */ | ||
| 37 | struct ip6_mh { | ||
| 38 | __u8 ip6mh_proto; | ||
| 39 | __u8 ip6mh_hdrlen; | ||
| 40 | __u8 ip6mh_type; | ||
| 41 | __u8 ip6mh_reserved; | ||
| 42 | __u16 ip6mh_cksum; | ||
| 43 | /* Followed by type specific messages */ | ||
| 44 | __u8 data[0]; | ||
| 45 | } __attribute__ ((__packed__)); | ||
| 46 | |||
| 47 | #define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */ | ||
| 48 | #define IP6_MH_TYPE_HOTI 1 /* HOTI Message */ | ||
| 49 | #define IP6_MH_TYPE_COTI 2 /* COTI Message */ | ||
| 50 | #define IP6_MH_TYPE_HOT 3 /* HOT Message */ | ||
| 51 | #define IP6_MH_TYPE_COT 4 /* COT Message */ | ||
| 52 | #define IP6_MH_TYPE_BU 5 /* Binding Update */ | ||
| 53 | #define IP6_MH_TYPE_BACK 6 /* Binding ACK */ | ||
| 54 | #define IP6_MH_TYPE_BERROR 7 /* Binding Error */ | ||
| 55 | #define IP6_MH_TYPE_MAX IP6_MH_TYPE_BERROR | ||
| 56 | |||
| 57 | extern int mip6_init(void); | ||
| 58 | extern void mip6_fini(void); | ||
| 59 | extern int mip6_mh_filter(struct sock *sk, struct sk_buff *skb); | ||
| 60 | |||
| 61 | #endif | ||
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 4901ee446879..c8aacbd2e333 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _NET_NEIGHBOUR_H | 1 | #ifndef _NET_NEIGHBOUR_H |
| 2 | #define _NET_NEIGHBOUR_H | 2 | #define _NET_NEIGHBOUR_H |
| 3 | 3 | ||
| 4 | #include <linux/neighbour.h> | ||
| 5 | |||
| 4 | /* | 6 | /* |
| 5 | * Generic neighbour manipulation | 7 | * Generic neighbour manipulation |
| 6 | * | 8 | * |
| @@ -14,40 +16,6 @@ | |||
| 14 | * - Add neighbour cache statistics like rtstat | 16 | * - Add neighbour cache statistics like rtstat |
| 15 | */ | 17 | */ |
| 16 | 18 | ||
| 17 | /* The following flags & states are exported to user space, | ||
| 18 | so that they should be moved to include/linux/ directory. | ||
| 19 | */ | ||
| 20 | |||
| 21 | /* | ||
| 22 | * Neighbor Cache Entry Flags | ||
| 23 | */ | ||
| 24 | |||
| 25 | #define NTF_PROXY 0x08 /* == ATF_PUBL */ | ||
| 26 | #define NTF_ROUTER 0x80 | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Neighbor Cache Entry States. | ||
| 30 | */ | ||
| 31 | |||
| 32 | #define NUD_INCOMPLETE 0x01 | ||
| 33 | #define NUD_REACHABLE 0x02 | ||
| 34 | #define NUD_STALE 0x04 | ||
| 35 | #define NUD_DELAY 0x08 | ||
| 36 | #define NUD_PROBE 0x10 | ||
| 37 | #define NUD_FAILED 0x20 | ||
| 38 | |||
| 39 | /* Dummy states */ | ||
| 40 | #define NUD_NOARP 0x40 | ||
| 41 | #define NUD_PERMANENT 0x80 | ||
| 42 | #define NUD_NONE 0x00 | ||
| 43 | |||
| 44 | /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change | ||
| 45 | and make no address resolution or NUD. | ||
| 46 | NUD_PERMANENT is also cannot be deleted by garbage collectors. | ||
| 47 | */ | ||
| 48 | |||
| 49 | #ifdef __KERNEL__ | ||
| 50 | |||
| 51 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
| 52 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
| 53 | #include <linux/skbuff.h> | 21 | #include <linux/skbuff.h> |
| @@ -133,7 +101,7 @@ struct neighbour | |||
| 133 | __u8 dead; | 101 | __u8 dead; |
| 134 | atomic_t probes; | 102 | atomic_t probes; |
| 135 | rwlock_t lock; | 103 | rwlock_t lock; |
| 136 | unsigned char ha[(MAX_ADDR_LEN+sizeof(unsigned long)-1)&~(sizeof(unsigned long)-1)]; | 104 | unsigned char ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; |
| 137 | struct hh_cache *hh; | 105 | struct hh_cache *hh; |
| 138 | atomic_t refcnt; | 106 | atomic_t refcnt; |
| 139 | int (*output)(struct sk_buff *skb); | 107 | int (*output)(struct sk_buff *skb); |
| @@ -158,6 +126,7 @@ struct pneigh_entry | |||
| 158 | { | 126 | { |
| 159 | struct pneigh_entry *next; | 127 | struct pneigh_entry *next; |
| 160 | struct net_device *dev; | 128 | struct net_device *dev; |
| 129 | u8 flags; | ||
| 161 | u8 key[0]; | 130 | u8 key[0]; |
| 162 | }; | 131 | }; |
| 163 | 132 | ||
| @@ -374,6 +343,3 @@ struct neighbour_cb { | |||
| 374 | #define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb) | 343 | #define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb) |
| 375 | 344 | ||
| 376 | #endif | 345 | #endif |
| 377 | #endif | ||
| 378 | |||
| 379 | |||
diff --git a/include/net/netdma.h b/include/net/netdma.h index 19760eb131aa..7f53cd1d8b1e 100644 --- a/include/net/netdma.h +++ b/include/net/netdma.h | |||
| @@ -29,7 +29,7 @@ static inline struct dma_chan *get_softnet_dma(void) | |||
| 29 | { | 29 | { |
| 30 | struct dma_chan *chan; | 30 | struct dma_chan *chan; |
| 31 | rcu_read_lock(); | 31 | rcu_read_lock(); |
| 32 | chan = rcu_dereference(__get_cpu_var(softnet_data.net_dma)); | 32 | chan = rcu_dereference(__get_cpu_var(softnet_data).net_dma); |
| 33 | if (chan) | 33 | if (chan) |
| 34 | dma_chan_get(chan); | 34 | dma_chan_get(chan); |
| 35 | rcu_read_unlock(); | 35 | rcu_read_unlock(); |
| @@ -37,7 +37,7 @@ static inline struct dma_chan *get_softnet_dma(void) | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | int dma_skb_copy_datagram_iovec(struct dma_chan* chan, | 39 | int dma_skb_copy_datagram_iovec(struct dma_chan* chan, |
| 40 | const struct sk_buff *skb, int offset, struct iovec *to, | 40 | struct sk_buff *skb, int offset, struct iovec *to, |
| 41 | size_t len, struct dma_pinned_list *pinned_list); | 41 | size_t len, struct dma_pinned_list *pinned_list); |
| 42 | 42 | ||
| 43 | #endif /* CONFIG_NET_DMA */ | 43 | #endif /* CONFIG_NET_DMA */ |
diff --git a/include/net/netevent.h b/include/net/netevent.h new file mode 100644 index 000000000000..e5d216241423 --- /dev/null +++ b/include/net/netevent.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #ifndef _NET_EVENT_H | ||
| 2 | #define _NET_EVENT_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Generic netevent notifiers | ||
| 6 | * | ||
| 7 | * Authors: | ||
| 8 | * Tom Tucker <tom@opengridcomputing.com> | ||
| 9 | * Steve Wise <swise@opengridcomputing.com> | ||
| 10 | * | ||
| 11 | * Changes: | ||
| 12 | */ | ||
| 13 | #ifdef __KERNEL__ | ||
| 14 | |||
| 15 | #include <net/dst.h> | ||
| 16 | |||
| 17 | struct netevent_redirect { | ||
| 18 | struct dst_entry *old; | ||
| 19 | struct dst_entry *new; | ||
| 20 | }; | ||
| 21 | |||
| 22 | enum netevent_notif_type { | ||
| 23 | NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */ | ||
| 24 | NETEVENT_PMTU_UPDATE, /* arg is struct dst_entry ptr */ | ||
| 25 | NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ | ||
| 26 | }; | ||
| 27 | |||
| 28 | extern int register_netevent_notifier(struct notifier_block *nb); | ||
| 29 | extern int unregister_netevent_notifier(struct notifier_block *nb); | ||
| 30 | extern int call_netevent_notifiers(unsigned long val, void *v); | ||
| 31 | |||
| 32 | #endif | ||
| 33 | #endif | ||
diff --git a/include/net/netlabel.h b/include/net/netlabel.h new file mode 100644 index 000000000000..c63a58058e21 --- /dev/null +++ b/include/net/netlabel.h | |||
| @@ -0,0 +1,261 @@ | |||
| 1 | /* | ||
| 2 | * NetLabel System | ||
| 3 | * | ||
| 4 | * The NetLabel system manages static and dynamic label mappings for network | ||
| 5 | * protocols such as CIPSO and RIPSO. | ||
| 6 | * | ||
| 7 | * Author: Paul Moore <paul.moore@hp.com> | ||
| 8 | * | ||
| 9 | */ | ||
| 10 | |||
| 11 | /* | ||
| 12 | * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 | ||
| 13 | * | ||
| 14 | * This program is free software; you can redistribute it and/or modify | ||
| 15 | * it under the terms of the GNU General Public License as published by | ||
| 16 | * the Free Software Foundation; either version 2 of the License, or | ||
| 17 | * (at your option) any later version. | ||
| 18 | * | ||
| 19 | * This program is distributed in the hope that it will be useful, | ||
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
| 22 | * the GNU General Public License for more details. | ||
| 23 | * | ||
| 24 | * You should have received a copy of the GNU General Public License | ||
| 25 | * along with this program; if not, write to the Free Software | ||
| 26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 27 | * | ||
| 28 | */ | ||
| 29 | |||
| 30 | #ifndef _NETLABEL_H | ||
| 31 | #define _NETLABEL_H | ||
| 32 | |||
| 33 | #include <linux/types.h> | ||
| 34 | #include <linux/net.h> | ||
| 35 | #include <linux/skbuff.h> | ||
| 36 | #include <net/netlink.h> | ||
| 37 | |||
| 38 | /* | ||
| 39 | * NetLabel - A management interface for maintaining network packet label | ||
| 40 | * mapping tables for explicit packet labling protocols. | ||
| 41 | * | ||
| 42 | * Network protocols such as CIPSO and RIPSO require a label translation layer | ||
| 43 | * to convert the label on the packet into something meaningful on the host | ||
| 44 | * machine. In the current Linux implementation these mapping tables live | ||
| 45 | * inside the kernel; NetLabel provides a mechanism for user space applications | ||
| 46 | * to manage these mapping tables. | ||
| 47 | * | ||
| 48 | * NetLabel makes use of the Generic NETLINK mechanism as a transport layer to | ||
| 49 | * send messages between kernel and user space. The general format of a | ||
| 50 | * NetLabel message is shown below: | ||
| 51 | * | ||
| 52 | * +-----------------+-------------------+--------- --- -- - | ||
| 53 | * | struct nlmsghdr | struct genlmsghdr | payload | ||
| 54 | * +-----------------+-------------------+--------- --- -- - | ||
| 55 | * | ||
| 56 | * The 'nlmsghdr' and 'genlmsghdr' structs should be dealt with like normal. | ||
| 57 | * The payload is dependent on the subsystem specified in the | ||
| 58 | * 'nlmsghdr->nlmsg_type' and should be defined below, supporting functions | ||
| 59 | * should be defined in the corresponding net/netlabel/netlabel_<subsys>.h|c | ||
| 60 | * file. All of the fields in the NetLabel payload are NETLINK attributes, see | ||
| 61 | * the include/net/netlink.h file for more information on NETLINK attributes. | ||
| 62 | * | ||
| 63 | */ | ||
| 64 | |||
| 65 | /* | ||
| 66 | * NetLabel NETLINK protocol | ||
| 67 | */ | ||
| 68 | |||
| 69 | #define NETLBL_PROTO_VERSION 1 | ||
| 70 | |||
| 71 | /* NetLabel NETLINK types/families */ | ||
| 72 | #define NETLBL_NLTYPE_NONE 0 | ||
| 73 | #define NETLBL_NLTYPE_MGMT 1 | ||
| 74 | #define NETLBL_NLTYPE_MGMT_NAME "NLBL_MGMT" | ||
| 75 | #define NETLBL_NLTYPE_RIPSO 2 | ||
| 76 | #define NETLBL_NLTYPE_RIPSO_NAME "NLBL_RIPSO" | ||
| 77 | #define NETLBL_NLTYPE_CIPSOV4 3 | ||
| 78 | #define NETLBL_NLTYPE_CIPSOV4_NAME "NLBL_CIPSOv4" | ||
| 79 | #define NETLBL_NLTYPE_CIPSOV6 4 | ||
| 80 | #define NETLBL_NLTYPE_CIPSOV6_NAME "NLBL_CIPSOv6" | ||
| 81 | #define NETLBL_NLTYPE_UNLABELED 5 | ||
| 82 | #define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL" | ||
| 83 | |||
| 84 | /* | ||
| 85 | * NetLabel - Kernel API for accessing the network packet label mappings. | ||
| 86 | * | ||
| 87 | * The following functions are provided for use by other kernel modules, | ||
| 88 | * specifically kernel LSM modules, to provide a consistent, transparent API | ||
| 89 | * for dealing with explicit packet labeling protocols such as CIPSO and | ||
| 90 | * RIPSO. The functions defined here are implemented in the | ||
| 91 | * net/netlabel/netlabel_kapi.c file. | ||
| 92 | * | ||
| 93 | */ | ||
| 94 | |||
| 95 | /* NetLabel audit information */ | ||
| 96 | struct netlbl_audit { | ||
| 97 | u32 secid; | ||
| 98 | uid_t loginuid; | ||
| 99 | }; | ||
| 100 | |||
| 101 | /* Domain mapping definition struct */ | ||
| 102 | struct netlbl_dom_map; | ||
| 103 | |||
| 104 | /* Domain mapping operations */ | ||
| 105 | int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info); | ||
| 106 | |||
| 107 | /* LSM security attributes */ | ||
| 108 | struct netlbl_lsm_cache { | ||
| 109 | void (*free) (const void *data); | ||
| 110 | void *data; | ||
| 111 | }; | ||
| 112 | struct netlbl_lsm_secattr { | ||
| 113 | char *domain; | ||
| 114 | |||
| 115 | u32 mls_lvl; | ||
| 116 | u32 mls_lvl_vld; | ||
| 117 | unsigned char *mls_cat; | ||
| 118 | size_t mls_cat_len; | ||
| 119 | |||
| 120 | struct netlbl_lsm_cache cache; | ||
| 121 | }; | ||
| 122 | |||
| 123 | /* | ||
| 124 | * LSM security attribute operations | ||
| 125 | */ | ||
| 126 | |||
| 127 | |||
| 128 | /** | ||
| 129 | * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct | ||
| 130 | * @secattr: the struct to initialize | ||
| 131 | * | ||
| 132 | * Description: | ||
| 133 | * Initialize an already allocated netlbl_lsm_secattr struct. Returns zero on | ||
| 134 | * success, negative values on error. | ||
| 135 | * | ||
| 136 | */ | ||
| 137 | static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr) | ||
| 138 | { | ||
| 139 | memset(secattr, 0, sizeof(*secattr)); | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 143 | /** | ||
| 144 | * netlbl_secattr_destroy - Clears a netlbl_lsm_secattr struct | ||
| 145 | * @secattr: the struct to clear | ||
| 146 | * @clear_cache: cache clear flag | ||
| 147 | * | ||
| 148 | * Description: | ||
| 149 | * Destroys the @secattr struct, including freeing all of the internal buffers. | ||
| 150 | * If @clear_cache is true then free the cache fields, otherwise leave them | ||
| 151 | * intact. The struct must be reset with a call to netlbl_secattr_init() | ||
| 152 | * before reuse. | ||
| 153 | * | ||
| 154 | */ | ||
| 155 | static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr, | ||
| 156 | u32 clear_cache) | ||
| 157 | { | ||
| 158 | if (clear_cache && secattr->cache.data != NULL && secattr->cache.free) | ||
| 159 | secattr->cache.free(secattr->cache.data); | ||
| 160 | kfree(secattr->domain); | ||
| 161 | kfree(secattr->mls_cat); | ||
| 162 | } | ||
| 163 | |||
| 164 | /** | ||
| 165 | * netlbl_secattr_alloc - Allocate and initialize a netlbl_lsm_secattr struct | ||
| 166 | * @flags: the memory allocation flags | ||
| 167 | * | ||
| 168 | * Description: | ||
| 169 | * Allocate and initialize a netlbl_lsm_secattr struct. Returns a valid | ||
| 170 | * pointer on success, or NULL on failure. | ||
| 171 | * | ||
| 172 | */ | ||
| 173 | static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(int flags) | ||
| 174 | { | ||
| 175 | return kzalloc(sizeof(struct netlbl_lsm_secattr), flags); | ||
| 176 | } | ||
| 177 | |||
| 178 | /** | ||
| 179 | * netlbl_secattr_free - Frees a netlbl_lsm_secattr struct | ||
| 180 | * @secattr: the struct to free | ||
| 181 | * @clear_cache: cache clear flag | ||
| 182 | * | ||
| 183 | * Description: | ||
| 184 | * Frees @secattr including all of the internal buffers. If @clear_cache is | ||
| 185 | * true then free the cache fields, otherwise leave them intact. | ||
| 186 | * | ||
| 187 | */ | ||
| 188 | static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr, | ||
| 189 | u32 clear_cache) | ||
| 190 | { | ||
| 191 | netlbl_secattr_destroy(secattr, clear_cache); | ||
| 192 | kfree(secattr); | ||
| 193 | } | ||
| 194 | |||
| 195 | /* | ||
| 196 | * LSM protocol operations | ||
| 197 | */ | ||
| 198 | |||
| 199 | #ifdef CONFIG_NETLABEL | ||
| 200 | int netlbl_socket_setattr(const struct socket *sock, | ||
| 201 | const struct netlbl_lsm_secattr *secattr); | ||
| 202 | int netlbl_sock_getattr(struct sock *sk, | ||
| 203 | struct netlbl_lsm_secattr *secattr); | ||
| 204 | int netlbl_socket_getattr(const struct socket *sock, | ||
| 205 | struct netlbl_lsm_secattr *secattr); | ||
| 206 | int netlbl_skbuff_getattr(const struct sk_buff *skb, | ||
| 207 | struct netlbl_lsm_secattr *secattr); | ||
| 208 | void netlbl_skbuff_err(struct sk_buff *skb, int error); | ||
| 209 | #else | ||
| 210 | static inline int netlbl_socket_setattr(const struct socket *sock, | ||
| 211 | const struct netlbl_lsm_secattr *secattr) | ||
| 212 | { | ||
| 213 | return -ENOSYS; | ||
| 214 | } | ||
| 215 | |||
| 216 | static inline int netlbl_sock_getattr(struct sock *sk, | ||
| 217 | struct netlbl_lsm_secattr *secattr) | ||
| 218 | { | ||
| 219 | return -ENOSYS; | ||
| 220 | } | ||
| 221 | |||
| 222 | static inline int netlbl_socket_getattr(const struct socket *sock, | ||
| 223 | struct netlbl_lsm_secattr *secattr) | ||
| 224 | { | ||
| 225 | return -ENOSYS; | ||
| 226 | } | ||
| 227 | |||
| 228 | static inline int netlbl_skbuff_getattr(const struct sk_buff *skb, | ||
| 229 | struct netlbl_lsm_secattr *secattr) | ||
| 230 | { | ||
| 231 | return -ENOSYS; | ||
| 232 | } | ||
| 233 | |||
| 234 | static inline void netlbl_skbuff_err(struct sk_buff *skb, int error) | ||
| 235 | { | ||
| 236 | return; | ||
| 237 | } | ||
| 238 | #endif /* CONFIG_NETLABEL */ | ||
| 239 | |||
| 240 | /* | ||
| 241 | * LSM label mapping cache operations | ||
| 242 | */ | ||
| 243 | |||
| 244 | #ifdef CONFIG_NETLABEL | ||
| 245 | void netlbl_cache_invalidate(void); | ||
| 246 | int netlbl_cache_add(const struct sk_buff *skb, | ||
| 247 | const struct netlbl_lsm_secattr *secattr); | ||
| 248 | #else | ||
| 249 | static inline void netlbl_cache_invalidate(void) | ||
| 250 | { | ||
| 251 | return; | ||
| 252 | } | ||
| 253 | |||
| 254 | static inline int netlbl_cache_add(const struct sk_buff *skb, | ||
| 255 | const struct netlbl_lsm_secattr *secattr) | ||
| 256 | { | ||
| 257 | return 0; | ||
| 258 | } | ||
| 259 | #endif /* CONFIG_NETLABEL */ | ||
| 260 | |||
| 261 | #endif /* _NETLABEL_H */ | ||
diff --git a/include/net/netlink.h b/include/net/netlink.h index 640c26a90cf1..ce5cba19c393 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
| @@ -35,12 +35,15 @@ | |||
| 35 | * nlmsg_put() add a netlink message to an skb | 35 | * nlmsg_put() add a netlink message to an skb |
| 36 | * nlmsg_put_answer() callback based nlmsg_put() | 36 | * nlmsg_put_answer() callback based nlmsg_put() |
| 37 | * nlmsg_end() finanlize netlink message | 37 | * nlmsg_end() finanlize netlink message |
| 38 | * nlmsg_get_pos() return current position in message | ||
| 39 | * nlmsg_trim() trim part of message | ||
| 38 | * nlmsg_cancel() cancel message construction | 40 | * nlmsg_cancel() cancel message construction |
| 39 | * nlmsg_free() free a netlink message | 41 | * nlmsg_free() free a netlink message |
| 40 | * | 42 | * |
| 41 | * Message Sending: | 43 | * Message Sending: |
| 42 | * nlmsg_multicast() multicast message to several groups | 44 | * nlmsg_multicast() multicast message to several groups |
| 43 | * nlmsg_unicast() unicast a message to a single socket | 45 | * nlmsg_unicast() unicast a message to a single socket |
| 46 | * nlmsg_notify() send notification message | ||
| 44 | * | 47 | * |
| 45 | * Message Length Calculations: | 48 | * Message Length Calculations: |
| 46 | * nlmsg_msg_size(payload) length of message w/o padding | 49 | * nlmsg_msg_size(payload) length of message w/o padding |
| @@ -62,6 +65,9 @@ | |||
| 62 | * nlmsg_validate() validate netlink message incl. attrs | 65 | * nlmsg_validate() validate netlink message incl. attrs |
| 63 | * nlmsg_for_each_attr() loop over all attributes | 66 | * nlmsg_for_each_attr() loop over all attributes |
| 64 | * | 67 | * |
| 68 | * Misc: | ||
| 69 | * nlmsg_report() report back to application? | ||
| 70 | * | ||
| 65 | * ------------------------------------------------------------------------ | 71 | * ------------------------------------------------------------------------ |
| 66 | * Attributes Interface | 72 | * Attributes Interface |
| 67 | * ------------------------------------------------------------------------ | 73 | * ------------------------------------------------------------------------ |
| @@ -80,8 +86,10 @@ | |||
| 80 | * struct nlattr netlink attribtue header | 86 | * struct nlattr netlink attribtue header |
| 81 | * | 87 | * |
| 82 | * Attribute Construction: | 88 | * Attribute Construction: |
| 83 | * nla_reserve(skb, type, len) reserve skb tailroom for an attribute | 89 | * nla_reserve(skb, type, len) reserve room for an attribute |
| 90 | * nla_reserve_nohdr(skb, len) reserve room for an attribute w/o hdr | ||
| 84 | * nla_put(skb, type, len, data) add attribute to skb | 91 | * nla_put(skb, type, len, data) add attribute to skb |
| 92 | * nla_put_nohdr(skb, len, data) add attribute w/o hdr | ||
| 85 | * | 93 | * |
| 86 | * Attribute Construction for Basic Types: | 94 | * Attribute Construction for Basic Types: |
| 87 | * nla_put_u8(skb, type, value) add u8 attribute to skb | 95 | * nla_put_u8(skb, type, value) add u8 attribute to skb |
| @@ -138,10 +146,13 @@ | |||
| 138 | * nla_ok(nla, remaining) does nla fit into remaining bytes? | 146 | * nla_ok(nla, remaining) does nla fit into remaining bytes? |
| 139 | * nla_next(nla, remaining) get next netlink attribute | 147 | * nla_next(nla, remaining) get next netlink attribute |
| 140 | * nla_validate() validate a stream of attributes | 148 | * nla_validate() validate a stream of attributes |
| 149 | * nla_validate_nested() validate a stream of nested attributes | ||
| 141 | * nla_find() find attribute in stream of attributes | 150 | * nla_find() find attribute in stream of attributes |
| 151 | * nla_find_nested() find attribute in nested attributes | ||
| 142 | * nla_parse() parse and validate stream of attrs | 152 | * nla_parse() parse and validate stream of attrs |
| 143 | * nla_parse_nested() parse nested attribuets | 153 | * nla_parse_nested() parse nested attribuets |
| 144 | * nla_for_each_attr() loop over all attributes | 154 | * nla_for_each_attr() loop over all attributes |
| 155 | * nla_for_each_nested() loop over the nested attributes | ||
| 145 | *========================================================================= | 156 | *========================================================================= |
| 146 | */ | 157 | */ |
| 147 | 158 | ||
| @@ -158,6 +169,7 @@ enum { | |||
| 158 | NLA_FLAG, | 169 | NLA_FLAG, |
| 159 | NLA_MSECS, | 170 | NLA_MSECS, |
| 160 | NLA_NESTED, | 171 | NLA_NESTED, |
| 172 | NLA_NUL_STRING, | ||
| 161 | __NLA_TYPE_MAX, | 173 | __NLA_TYPE_MAX, |
| 162 | }; | 174 | }; |
| 163 | 175 | ||
| @@ -166,21 +178,37 @@ enum { | |||
| 166 | /** | 178 | /** |
| 167 | * struct nla_policy - attribute validation policy | 179 | * struct nla_policy - attribute validation policy |
| 168 | * @type: Type of attribute or NLA_UNSPEC | 180 | * @type: Type of attribute or NLA_UNSPEC |
| 169 | * @minlen: Minimal length of payload required to be available | 181 | * @len: Type specific length of payload |
| 170 | * | 182 | * |
| 171 | * Policies are defined as arrays of this struct, the array must be | 183 | * Policies are defined as arrays of this struct, the array must be |
| 172 | * accessible by attribute type up to the highest identifier to be expected. | 184 | * accessible by attribute type up to the highest identifier to be expected. |
| 173 | * | 185 | * |
| 186 | * Meaning of `len' field: | ||
| 187 | * NLA_STRING Maximum length of string | ||
| 188 | * NLA_NUL_STRING Maximum length of string (excluding NUL) | ||
| 189 | * NLA_FLAG Unused | ||
| 190 | * All other Exact length of attribute payload | ||
| 191 | * | ||
| 174 | * Example: | 192 | * Example: |
| 175 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { | 193 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { |
| 176 | * [ATTR_FOO] = { .type = NLA_U16 }, | 194 | * [ATTR_FOO] = { .type = NLA_U16 }, |
| 177 | * [ATTR_BAR] = { .type = NLA_STRING }, | 195 | * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ }, |
| 178 | * [ATTR_BAZ] = { .minlen = sizeof(struct mystruct) }, | 196 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, |
| 179 | * }; | 197 | * }; |
| 180 | */ | 198 | */ |
| 181 | struct nla_policy { | 199 | struct nla_policy { |
| 182 | u16 type; | 200 | u16 type; |
| 183 | u16 minlen; | 201 | u16 len; |
| 202 | }; | ||
| 203 | |||
| 204 | /** | ||
| 205 | * struct nl_info - netlink source information | ||
| 206 | * @nlh: Netlink message header of original request | ||
| 207 | * @pid: Netlink PID of requesting application | ||
| 208 | */ | ||
| 209 | struct nl_info { | ||
| 210 | struct nlmsghdr *nlh; | ||
| 211 | u32 pid; | ||
| 184 | }; | 212 | }; |
| 185 | 213 | ||
| 186 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | 214 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, |
| @@ -188,6 +216,9 @@ extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | |||
| 188 | struct nlmsghdr *, int *)); | 216 | struct nlmsghdr *, int *)); |
| 189 | extern void netlink_queue_skip(struct nlmsghdr *nlh, | 217 | extern void netlink_queue_skip(struct nlmsghdr *nlh, |
| 190 | struct sk_buff *skb); | 218 | struct sk_buff *skb); |
| 219 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, | ||
| 220 | u32 pid, unsigned int group, int report, | ||
| 221 | gfp_t flags); | ||
| 191 | 222 | ||
| 192 | extern int nla_validate(struct nlattr *head, int len, int maxtype, | 223 | extern int nla_validate(struct nlattr *head, int len, int maxtype, |
| 193 | struct nla_policy *policy); | 224 | struct nla_policy *policy); |
| @@ -203,12 +234,18 @@ extern int nla_memcmp(const struct nlattr *nla, const void *data, | |||
| 203 | extern int nla_strcmp(const struct nlattr *nla, const char *str); | 234 | extern int nla_strcmp(const struct nlattr *nla, const char *str); |
| 204 | extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, | 235 | extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, |
| 205 | int attrlen); | 236 | int attrlen); |
| 237 | extern void * __nla_reserve_nohdr(struct sk_buff *skb, int attrlen); | ||
| 206 | extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype, | 238 | extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype, |
| 207 | int attrlen); | 239 | int attrlen); |
| 240 | extern void * nla_reserve_nohdr(struct sk_buff *skb, int attrlen); | ||
| 208 | extern void __nla_put(struct sk_buff *skb, int attrtype, | 241 | extern void __nla_put(struct sk_buff *skb, int attrtype, |
| 209 | int attrlen, const void *data); | 242 | int attrlen, const void *data); |
| 243 | extern void __nla_put_nohdr(struct sk_buff *skb, int attrlen, | ||
| 244 | const void *data); | ||
| 210 | extern int nla_put(struct sk_buff *skb, int attrtype, | 245 | extern int nla_put(struct sk_buff *skb, int attrtype, |
| 211 | int attrlen, const void *data); | 246 | int attrlen, const void *data); |
| 247 | extern int nla_put_nohdr(struct sk_buff *skb, int attrlen, | ||
| 248 | const void *data); | ||
| 212 | 249 | ||
| 213 | /************************************************************************** | 250 | /************************************************************************** |
| 214 | * Netlink Messages | 251 | * Netlink Messages |
| @@ -364,6 +401,17 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, | |||
| 364 | } | 401 | } |
| 365 | 402 | ||
| 366 | /** | 403 | /** |
| 404 | * nlmsg_report - need to report back to application? | ||
| 405 | * @nlh: netlink message header | ||
| 406 | * | ||
| 407 | * Returns 1 if a report back to the application is requested. | ||
| 408 | */ | ||
| 409 | static inline int nlmsg_report(struct nlmsghdr *nlh) | ||
| 410 | { | ||
| 411 | return !!(nlh->nlmsg_flags & NLM_F_ECHO); | ||
| 412 | } | ||
| 413 | |||
| 414 | /** | ||
| 367 | * nlmsg_for_each_attr - iterate over a stream of attributes | 415 | * nlmsg_for_each_attr - iterate over a stream of attributes |
| 368 | * @pos: loop counter, set to current attribute | 416 | * @pos: loop counter, set to current attribute |
| 369 | * @nlh: netlink message header | 417 | * @nlh: netlink message header |
| @@ -453,12 +501,13 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb, | |||
| 453 | /** | 501 | /** |
| 454 | * nlmsg_new - Allocate a new netlink message | 502 | * nlmsg_new - Allocate a new netlink message |
| 455 | * @size: maximum size of message | 503 | * @size: maximum size of message |
| 504 | * @flags: the type of memory to allocate. | ||
| 456 | * | 505 | * |
| 457 | * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. | 506 | * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. |
| 458 | */ | 507 | */ |
| 459 | static inline struct sk_buff *nlmsg_new(int size) | 508 | static inline struct sk_buff *nlmsg_new(int size, gfp_t flags) |
| 460 | { | 509 | { |
| 461 | return alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | 510 | return alloc_skb(size, flags); |
| 462 | } | 511 | } |
| 463 | 512 | ||
| 464 | /** | 513 | /** |
| @@ -480,6 +529,32 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 480 | } | 529 | } |
| 481 | 530 | ||
| 482 | /** | 531 | /** |
| 532 | * nlmsg_get_pos - return current position in netlink message | ||
| 533 | * @skb: socket buffer the message is stored in | ||
| 534 | * | ||
| 535 | * Returns a pointer to the current tail of the message. | ||
| 536 | */ | ||
| 537 | static inline void *nlmsg_get_pos(struct sk_buff *skb) | ||
| 538 | { | ||
| 539 | return skb->tail; | ||
| 540 | } | ||
| 541 | |||
| 542 | /** | ||
| 543 | * nlmsg_trim - Trim message to a mark | ||
| 544 | * @skb: socket buffer the message is stored in | ||
| 545 | * @mark: mark to trim to | ||
| 546 | * | ||
| 547 | * Trims the message to the provided mark. Returns -1. | ||
| 548 | */ | ||
| 549 | static inline int nlmsg_trim(struct sk_buff *skb, void *mark) | ||
| 550 | { | ||
| 551 | if (mark) | ||
| 552 | skb_trim(skb, (unsigned char *) mark - skb->data); | ||
| 553 | |||
| 554 | return -1; | ||
| 555 | } | ||
| 556 | |||
| 557 | /** | ||
| 483 | * nlmsg_cancel - Cancel construction of a netlink message | 558 | * nlmsg_cancel - Cancel construction of a netlink message |
| 484 | * @skb: socket buffer the message is stored in | 559 | * @skb: socket buffer the message is stored in |
| 485 | * @nlh: netlink message header | 560 | * @nlh: netlink message header |
| @@ -489,9 +564,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 489 | */ | 564 | */ |
| 490 | static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) | 565 | static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) |
| 491 | { | 566 | { |
| 492 | skb_trim(skb, (unsigned char *) nlh - skb->data); | 567 | return nlmsg_trim(skb, nlh); |
| 493 | |||
| 494 | return -1; | ||
| 495 | } | 568 | } |
| 496 | 569 | ||
| 497 | /** | 570 | /** |
| @@ -509,15 +582,16 @@ static inline void nlmsg_free(struct sk_buff *skb) | |||
| 509 | * @skb: netlink message as socket buffer | 582 | * @skb: netlink message as socket buffer |
| 510 | * @pid: own netlink pid to avoid sending to yourself | 583 | * @pid: own netlink pid to avoid sending to yourself |
| 511 | * @group: multicast group id | 584 | * @group: multicast group id |
| 585 | * @flags: allocation flags | ||
| 512 | */ | 586 | */ |
| 513 | static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, | 587 | static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, |
| 514 | u32 pid, unsigned int group) | 588 | u32 pid, unsigned int group, gfp_t flags) |
| 515 | { | 589 | { |
| 516 | int err; | 590 | int err; |
| 517 | 591 | ||
| 518 | NETLINK_CB(skb).dst_group = group; | 592 | NETLINK_CB(skb).dst_group = group; |
| 519 | 593 | ||
| 520 | err = netlink_broadcast(sk, skb, pid, group, GFP_KERNEL); | 594 | err = netlink_broadcast(sk, skb, pid, group, flags); |
| 521 | if (err > 0) | 595 | if (err > 0) |
| 522 | err = 0; | 596 | err = 0; |
| 523 | 597 | ||
| @@ -631,6 +705,18 @@ static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining) | |||
| 631 | } | 705 | } |
| 632 | 706 | ||
| 633 | /** | 707 | /** |
| 708 | * nla_find_nested - find attribute in a set of nested attributes | ||
| 709 | * @nla: attribute containing the nested attributes | ||
| 710 | * @attrtype: type of attribute to look for | ||
| 711 | * | ||
| 712 | * Returns the first attribute which matches the specified type. | ||
| 713 | */ | ||
| 714 | static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype) | ||
| 715 | { | ||
| 716 | return nla_find(nla_data(nla), nla_len(nla), attrtype); | ||
| 717 | } | ||
| 718 | |||
| 719 | /** | ||
| 634 | * nla_parse_nested - parse nested attributes | 720 | * nla_parse_nested - parse nested attributes |
| 635 | * @tb: destination array with maxtype+1 elements | 721 | * @tb: destination array with maxtype+1 elements |
| 636 | * @maxtype: maximum attribute type to be expected | 722 | * @maxtype: maximum attribute type to be expected |
| @@ -745,13 +831,16 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
| 745 | #define NLA_PUT_U32(skb, attrtype, value) \ | 831 | #define NLA_PUT_U32(skb, attrtype, value) \ |
| 746 | NLA_PUT_TYPE(skb, u32, attrtype, value) | 832 | NLA_PUT_TYPE(skb, u32, attrtype, value) |
| 747 | 833 | ||
| 834 | #define NLA_PUT_BE32(skb, attrtype, value) \ | ||
| 835 | NLA_PUT_TYPE(skb, __be32, attrtype, value) | ||
| 836 | |||
| 748 | #define NLA_PUT_U64(skb, attrtype, value) \ | 837 | #define NLA_PUT_U64(skb, attrtype, value) \ |
| 749 | NLA_PUT_TYPE(skb, u64, attrtype, value) | 838 | NLA_PUT_TYPE(skb, u64, attrtype, value) |
| 750 | 839 | ||
| 751 | #define NLA_PUT_STRING(skb, attrtype, value) \ | 840 | #define NLA_PUT_STRING(skb, attrtype, value) \ |
| 752 | NLA_PUT(skb, attrtype, strlen(value) + 1, value) | 841 | NLA_PUT(skb, attrtype, strlen(value) + 1, value) |
| 753 | 842 | ||
| 754 | #define NLA_PUT_FLAG(skb, attrtype, value) \ | 843 | #define NLA_PUT_FLAG(skb, attrtype) \ |
| 755 | NLA_PUT(skb, attrtype, 0, NULL) | 844 | NLA_PUT(skb, attrtype, 0, NULL) |
| 756 | 845 | ||
| 757 | #define NLA_PUT_MSECS(skb, attrtype, jiffies) \ | 846 | #define NLA_PUT_MSECS(skb, attrtype, jiffies) \ |
| @@ -767,6 +856,15 @@ static inline u32 nla_get_u32(struct nlattr *nla) | |||
| 767 | } | 856 | } |
| 768 | 857 | ||
| 769 | /** | 858 | /** |
| 859 | * nla_get_be32 - return payload of __be32 attribute | ||
| 860 | * @nla: __be32 netlink attribute | ||
| 861 | */ | ||
| 862 | static inline __be32 nla_get_be32(struct nlattr *nla) | ||
| 863 | { | ||
| 864 | return *(__be32 *) nla_data(nla); | ||
| 865 | } | ||
| 866 | |||
| 867 | /** | ||
| 770 | * nla_get_u16 - return payload of u16 attribute | 868 | * nla_get_u16 - return payload of u16 attribute |
| 771 | * @nla: u16 netlink attribute | 869 | * @nla: u16 netlink attribute |
| 772 | */ | 870 | */ |
| @@ -862,10 +960,25 @@ static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) | |||
| 862 | */ | 960 | */ |
| 863 | static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | 961 | static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) |
| 864 | { | 962 | { |
| 865 | if (start) | 963 | return nlmsg_trim(skb, start); |
| 866 | skb_trim(skb, (unsigned char *) start - skb->data); | 964 | } |
| 867 | 965 | ||
| 868 | return -1; | 966 | /** |
| 967 | * nla_validate_nested - Validate a stream of nested attributes | ||
| 968 | * @start: container attribute | ||
| 969 | * @maxtype: maximum attribute type to be expected | ||
| 970 | * @policy: validation policy | ||
| 971 | * | ||
| 972 | * Validates all attributes in the nested attribute stream against the | ||
| 973 | * specified policy. Attributes with a type exceeding maxtype will be | ||
| 974 | * ignored. See documenation of struct nla_policy for more details. | ||
| 975 | * | ||
| 976 | * Returns 0 on success or a negative error code. | ||
| 977 | */ | ||
| 978 | static inline int nla_validate_nested(struct nlattr *start, int maxtype, | ||
| 979 | struct nla_policy *policy) | ||
| 980 | { | ||
| 981 | return nla_validate(nla_data(start), nla_len(start), maxtype, policy); | ||
| 869 | } | 982 | } |
| 870 | 983 | ||
| 871 | /** | 984 | /** |
| @@ -880,4 +993,13 @@ static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | |||
| 880 | nla_ok(pos, rem); \ | 993 | nla_ok(pos, rem); \ |
| 881 | pos = nla_next(pos, &(rem))) | 994 | pos = nla_next(pos, &(rem))) |
| 882 | 995 | ||
| 996 | /** | ||
| 997 | * nla_for_each_nested - iterate over nested attributes | ||
| 998 | * @pos: loop counter, set to current attribute | ||
| 999 | * @nla: attribute containing the nested attributes | ||
| 1000 | * @rem: initialized to len, holds bytes currently remaining in stream | ||
| 1001 | */ | ||
| 1002 | #define nla_for_each_nested(pos, nla, rem) \ | ||
| 1003 | nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) | ||
| 1004 | |||
| 883 | #endif | 1005 | #endif |
diff --git a/include/net/nexthop.h b/include/net/nexthop.h new file mode 100644 index 000000000000..3334dbfa5aa4 --- /dev/null +++ b/include/net/nexthop.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #ifndef __NET_NEXTHOP_H | ||
| 2 | #define __NET_NEXTHOP_H | ||
| 3 | |||
| 4 | #include <linux/rtnetlink.h> | ||
| 5 | #include <net/netlink.h> | ||
| 6 | |||
| 7 | static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining) | ||
| 8 | { | ||
| 9 | return remaining >= sizeof(*rtnh) && | ||
| 10 | rtnh->rtnh_len >= sizeof(*rtnh) && | ||
| 11 | rtnh->rtnh_len <= remaining; | ||
| 12 | } | ||
| 13 | |||
| 14 | static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh, | ||
| 15 | int *remaining) | ||
| 16 | { | ||
| 17 | int totlen = NLA_ALIGN(rtnh->rtnh_len); | ||
| 18 | |||
| 19 | *remaining -= totlen; | ||
| 20 | return (struct rtnexthop *) ((char *) rtnh + totlen); | ||
| 21 | } | ||
| 22 | |||
| 23 | static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh) | ||
| 24 | { | ||
| 25 | return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh))); | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline int rtnh_attrlen(const struct rtnexthop *rtnh) | ||
| 29 | { | ||
| 30 | return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh)); | ||
| 31 | } | ||
| 32 | |||
| 33 | #endif | ||
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h deleted file mode 100644 index cf5e4d2e4c21..000000000000 --- a/include/net/pkt_act.h +++ /dev/null | |||
| @@ -1,273 +0,0 @@ | |||
| 1 | #ifndef __NET_PKT_ACT_H | ||
| 2 | #define __NET_PKT_ACT_H | ||
| 3 | |||
| 4 | #include <asm/uaccess.h> | ||
| 5 | #include <asm/system.h> | ||
| 6 | #include <linux/bitops.h> | ||
| 7 | #include <linux/types.h> | ||
| 8 | #include <linux/kernel.h> | ||
| 9 | #include <linux/sched.h> | ||
| 10 | #include <linux/string.h> | ||
| 11 | #include <linux/mm.h> | ||
| 12 | #include <linux/socket.h> | ||
| 13 | #include <linux/sockios.h> | ||
| 14 | #include <linux/in.h> | ||
| 15 | #include <linux/errno.h> | ||
| 16 | #include <linux/interrupt.h> | ||
| 17 | #include <linux/skbuff.h> | ||
| 18 | #include <linux/rtnetlink.h> | ||
| 19 | #include <linux/module.h> | ||
| 20 | #include <linux/init.h> | ||
| 21 | #include <linux/proc_fs.h> | ||
| 22 | #include <net/sock.h> | ||
| 23 | #include <net/pkt_sched.h> | ||
| 24 | |||
| 25 | #define tca_st(val) (struct tcf_##val *) | ||
| 26 | #define PRIV(a,name) ( tca_st(name) (a)->priv) | ||
| 27 | |||
| 28 | #if 0 /* control */ | ||
| 29 | #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
| 30 | #else | ||
| 31 | #define DPRINTK(format,args...) | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #if 0 /* data */ | ||
| 35 | #define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
| 36 | #else | ||
| 37 | #define D2PRINTK(format,args...) | ||
| 38 | #endif | ||
| 39 | |||
| 40 | static __inline__ unsigned | ||
| 41 | tcf_hash(u32 index) | ||
| 42 | { | ||
| 43 | return index & MY_TAB_MASK; | ||
| 44 | } | ||
| 45 | |||
| 46 | /* probably move this from being inline | ||
| 47 | * and put into act_generic | ||
| 48 | */ | ||
| 49 | static inline void | ||
| 50 | tcf_hash_destroy(struct tcf_st *p) | ||
| 51 | { | ||
| 52 | unsigned h = tcf_hash(p->index); | ||
| 53 | struct tcf_st **p1p; | ||
| 54 | |||
| 55 | for (p1p = &tcf_ht[h]; *p1p; p1p = &(*p1p)->next) { | ||
| 56 | if (*p1p == p) { | ||
| 57 | write_lock_bh(&tcf_t_lock); | ||
| 58 | *p1p = p->next; | ||
| 59 | write_unlock_bh(&tcf_t_lock); | ||
| 60 | #ifdef CONFIG_NET_ESTIMATOR | ||
| 61 | gen_kill_estimator(&p->bstats, &p->rate_est); | ||
| 62 | #endif | ||
| 63 | kfree(p); | ||
| 64 | return; | ||
| 65 | } | ||
| 66 | } | ||
| 67 | BUG_TRAP(0); | ||
| 68 | } | ||
| 69 | |||
| 70 | static inline int | ||
| 71 | tcf_hash_release(struct tcf_st *p, int bind ) | ||
| 72 | { | ||
| 73 | int ret = 0; | ||
| 74 | if (p) { | ||
| 75 | if (bind) { | ||
| 76 | p->bindcnt--; | ||
| 77 | } | ||
| 78 | p->refcnt--; | ||
| 79 | if(p->bindcnt <=0 && p->refcnt <= 0) { | ||
| 80 | tcf_hash_destroy(p); | ||
| 81 | ret = 1; | ||
| 82 | } | ||
| 83 | } | ||
| 84 | return ret; | ||
| 85 | } | ||
| 86 | |||
| 87 | static __inline__ int | ||
| 88 | tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb, | ||
| 89 | struct tc_action *a) | ||
| 90 | { | ||
| 91 | struct tcf_st *p; | ||
| 92 | int err =0, index = -1,i= 0, s_i = 0, n_i = 0; | ||
| 93 | struct rtattr *r ; | ||
| 94 | |||
| 95 | read_lock(&tcf_t_lock); | ||
| 96 | |||
| 97 | s_i = cb->args[0]; | ||
| 98 | |||
| 99 | for (i = 0; i < MY_TAB_SIZE; i++) { | ||
| 100 | p = tcf_ht[tcf_hash(i)]; | ||
| 101 | |||
| 102 | for (; p; p = p->next) { | ||
| 103 | index++; | ||
| 104 | if (index < s_i) | ||
| 105 | continue; | ||
| 106 | a->priv = p; | ||
| 107 | a->order = n_i; | ||
| 108 | r = (struct rtattr*) skb->tail; | ||
| 109 | RTA_PUT(skb, a->order, 0, NULL); | ||
| 110 | err = tcf_action_dump_1(skb, a, 0, 0); | ||
| 111 | if (0 > err) { | ||
| 112 | index--; | ||
| 113 | skb_trim(skb, (u8*)r - skb->data); | ||
| 114 | goto done; | ||
| 115 | } | ||
| 116 | r->rta_len = skb->tail - (u8*)r; | ||
| 117 | n_i++; | ||
| 118 | if (n_i >= TCA_ACT_MAX_PRIO) { | ||
| 119 | goto done; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | } | ||
| 123 | done: | ||
| 124 | read_unlock(&tcf_t_lock); | ||
| 125 | if (n_i) | ||
| 126 | cb->args[0] += n_i; | ||
| 127 | return n_i; | ||
| 128 | |||
| 129 | rtattr_failure: | ||
| 130 | skb_trim(skb, (u8*)r - skb->data); | ||
| 131 | goto done; | ||
| 132 | } | ||
| 133 | |||
| 134 | static __inline__ int | ||
| 135 | tcf_del_walker(struct sk_buff *skb, struct tc_action *a) | ||
| 136 | { | ||
| 137 | struct tcf_st *p, *s_p; | ||
| 138 | struct rtattr *r ; | ||
| 139 | int i= 0, n_i = 0; | ||
| 140 | |||
| 141 | r = (struct rtattr*) skb->tail; | ||
| 142 | RTA_PUT(skb, a->order, 0, NULL); | ||
| 143 | RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); | ||
| 144 | for (i = 0; i < MY_TAB_SIZE; i++) { | ||
| 145 | p = tcf_ht[tcf_hash(i)]; | ||
| 146 | |||
| 147 | while (p != NULL) { | ||
| 148 | s_p = p->next; | ||
| 149 | if (ACT_P_DELETED == tcf_hash_release(p, 0)) { | ||
| 150 | module_put(a->ops->owner); | ||
| 151 | } | ||
| 152 | n_i++; | ||
| 153 | p = s_p; | ||
| 154 | } | ||
| 155 | } | ||
| 156 | RTA_PUT(skb, TCA_FCNT, 4, &n_i); | ||
| 157 | r->rta_len = skb->tail - (u8*)r; | ||
| 158 | |||
| 159 | return n_i; | ||
| 160 | rtattr_failure: | ||
| 161 | skb_trim(skb, (u8*)r - skb->data); | ||
| 162 | return -EINVAL; | ||
| 163 | } | ||
| 164 | |||
| 165 | static __inline__ int | ||
| 166 | tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb, int type, | ||
| 167 | struct tc_action *a) | ||
| 168 | { | ||
| 169 | if (type == RTM_DELACTION) { | ||
| 170 | return tcf_del_walker(skb,a); | ||
| 171 | } else if (type == RTM_GETACTION) { | ||
| 172 | return tcf_dump_walker(skb,cb,a); | ||
| 173 | } else { | ||
| 174 | printk("tcf_generic_walker: unknown action %d\n",type); | ||
| 175 | return -EINVAL; | ||
| 176 | } | ||
| 177 | } | ||
| 178 | |||
| 179 | static __inline__ struct tcf_st * | ||
| 180 | tcf_hash_lookup(u32 index) | ||
| 181 | { | ||
| 182 | struct tcf_st *p; | ||
| 183 | |||
| 184 | read_lock(&tcf_t_lock); | ||
| 185 | for (p = tcf_ht[tcf_hash(index)]; p; p = p->next) { | ||
| 186 | if (p->index == index) | ||
| 187 | break; | ||
| 188 | } | ||
| 189 | read_unlock(&tcf_t_lock); | ||
| 190 | return p; | ||
| 191 | } | ||
| 192 | |||
| 193 | static __inline__ u32 | ||
| 194 | tcf_hash_new_index(void) | ||
| 195 | { | ||
| 196 | do { | ||
| 197 | if (++idx_gen == 0) | ||
| 198 | idx_gen = 1; | ||
| 199 | } while (tcf_hash_lookup(idx_gen)); | ||
| 200 | |||
| 201 | return idx_gen; | ||
| 202 | } | ||
| 203 | |||
| 204 | |||
| 205 | static inline int | ||
| 206 | tcf_hash_search(struct tc_action *a, u32 index) | ||
| 207 | { | ||
| 208 | struct tcf_st *p = tcf_hash_lookup(index); | ||
| 209 | |||
| 210 | if (p != NULL) { | ||
| 211 | a->priv = p; | ||
| 212 | return 1; | ||
| 213 | } | ||
| 214 | return 0; | ||
| 215 | } | ||
| 216 | |||
| 217 | #ifdef CONFIG_NET_ACT_INIT | ||
| 218 | static inline struct tcf_st * | ||
| 219 | tcf_hash_check(u32 index, struct tc_action *a, int ovr, int bind) | ||
| 220 | { | ||
| 221 | struct tcf_st *p = NULL; | ||
| 222 | if (index && (p = tcf_hash_lookup(index)) != NULL) { | ||
| 223 | if (bind) { | ||
| 224 | p->bindcnt++; | ||
| 225 | p->refcnt++; | ||
| 226 | } | ||
| 227 | a->priv = p; | ||
| 228 | } | ||
| 229 | return p; | ||
| 230 | } | ||
| 231 | |||
| 232 | static inline struct tcf_st * | ||
| 233 | tcf_hash_create(u32 index, struct rtattr *est, struct tc_action *a, int size, int ovr, int bind) | ||
| 234 | { | ||
| 235 | struct tcf_st *p = NULL; | ||
| 236 | |||
| 237 | p = kmalloc(size, GFP_KERNEL); | ||
| 238 | if (p == NULL) | ||
| 239 | return p; | ||
| 240 | |||
| 241 | memset(p, 0, size); | ||
| 242 | p->refcnt = 1; | ||
| 243 | |||
| 244 | if (bind) { | ||
| 245 | p->bindcnt = 1; | ||
| 246 | } | ||
| 247 | |||
| 248 | spin_lock_init(&p->lock); | ||
| 249 | p->stats_lock = &p->lock; | ||
| 250 | p->index = index ? : tcf_hash_new_index(); | ||
| 251 | p->tm.install = jiffies; | ||
| 252 | p->tm.lastuse = jiffies; | ||
| 253 | #ifdef CONFIG_NET_ESTIMATOR | ||
| 254 | if (est) | ||
| 255 | gen_new_estimator(&p->bstats, &p->rate_est, p->stats_lock, est); | ||
| 256 | #endif | ||
| 257 | a->priv = (void *) p; | ||
| 258 | return p; | ||
| 259 | } | ||
| 260 | |||
| 261 | static inline void tcf_hash_insert(struct tcf_st *p) | ||
| 262 | { | ||
| 263 | unsigned h = tcf_hash(p->index); | ||
| 264 | |||
| 265 | write_lock_bh(&tcf_t_lock); | ||
| 266 | p->next = tcf_ht[h]; | ||
| 267 | tcf_ht[h] = p; | ||
| 268 | write_unlock_bh(&tcf_t_lock); | ||
| 269 | } | ||
| 270 | |||
| 271 | #endif | ||
| 272 | |||
| 273 | #endif | ||
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 75b5b9333fc7..f6afee73235d 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
| @@ -171,14 +171,14 @@ psched_tod_diff(int delta_sec, int bound) | |||
| 171 | ({ \ | 171 | ({ \ |
| 172 | int __delta = (tv).tv_usec + (delta); \ | 172 | int __delta = (tv).tv_usec + (delta); \ |
| 173 | (tv_res).tv_sec = (tv).tv_sec; \ | 173 | (tv_res).tv_sec = (tv).tv_sec; \ |
| 174 | if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ | 174 | while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ |
| 175 | (tv_res).tv_usec = __delta; \ | 175 | (tv_res).tv_usec = __delta; \ |
| 176 | }) | 176 | }) |
| 177 | 177 | ||
| 178 | #define PSCHED_TADD(tv, delta) \ | 178 | #define PSCHED_TADD(tv, delta) \ |
| 179 | ({ \ | 179 | ({ \ |
| 180 | (tv).tv_usec += (delta); \ | 180 | (tv).tv_usec += (delta); \ |
| 181 | if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \ | 181 | while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \ |
| 182 | (tv).tv_usec -= USEC_PER_SEC; } \ | 182 | (tv).tv_usec -= USEC_PER_SEC; } \ |
| 183 | }) | 183 | }) |
| 184 | 184 | ||
diff --git a/include/net/protocol.h b/include/net/protocol.h index 3b6dc15c68a5..c643bce64e55 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
| @@ -36,7 +36,9 @@ | |||
| 36 | struct net_protocol { | 36 | struct net_protocol { |
| 37 | int (*handler)(struct sk_buff *skb); | 37 | int (*handler)(struct sk_buff *skb); |
| 38 | void (*err_handler)(struct sk_buff *skb, u32 info); | 38 | void (*err_handler)(struct sk_buff *skb, u32 info); |
| 39 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); | 39 | int (*gso_send_check)(struct sk_buff *skb); |
| 40 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | ||
| 41 | int features); | ||
| 40 | int no_policy; | 42 | int no_policy; |
| 41 | }; | 43 | }; |
| 42 | 44 | ||
| @@ -49,11 +51,18 @@ struct inet6_protocol | |||
| 49 | struct inet6_skb_parm *opt, | 51 | struct inet6_skb_parm *opt, |
| 50 | int type, int code, int offset, | 52 | int type, int code, int offset, |
| 51 | __u32 info); | 53 | __u32 info); |
| 54 | |||
| 55 | int (*gso_send_check)(struct sk_buff *skb); | ||
| 56 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | ||
| 57 | int features); | ||
| 58 | |||
| 52 | unsigned int flags; /* INET6_PROTO_xxx */ | 59 | unsigned int flags; /* INET6_PROTO_xxx */ |
| 53 | }; | 60 | }; |
| 54 | 61 | ||
| 55 | #define INET6_PROTO_NOPOLICY 0x1 | 62 | #define INET6_PROTO_NOPOLICY 0x1 |
| 56 | #define INET6_PROTO_FINAL 0x2 | 63 | #define INET6_PROTO_FINAL 0x2 |
| 64 | /* This should be set for any extension header which is compatible with GSO. */ | ||
| 65 | #define INET6_PROTO_GSO_EXTHDR 0x4 | ||
| 57 | #endif | 66 | #endif |
| 58 | 67 | ||
| 59 | /* This is used to register socket interfaces for IP protocols. */ | 68 | /* This is used to register socket interfaces for IP protocols. */ |
diff --git a/include/net/red.h b/include/net/red.h index 5ccdbb3d4722..a4eb37946f2c 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
| @@ -212,7 +212,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | |||
| 212 | * Seems, it is the best solution to | 212 | * Seems, it is the best solution to |
| 213 | * problem of too coarse exponent tabulation. | 213 | * problem of too coarse exponent tabulation. |
| 214 | */ | 214 | */ |
| 215 | us_idle = (p->qavg * us_idle) >> p->Scell_log; | 215 | us_idle = (p->qavg * (u64)us_idle) >> p->Scell_log; |
| 216 | 216 | ||
| 217 | if (us_idle < (p->qavg >> 1)) | 217 | if (us_idle < (p->qavg >> 1)) |
| 218 | return p->qavg - us_idle; | 218 | return p->qavg - us_idle; |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index c5d7f920c352..8e165ca16bd8 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
| @@ -53,6 +53,7 @@ struct request_sock { | |||
| 53 | unsigned long expires; | 53 | unsigned long expires; |
| 54 | struct request_sock_ops *rsk_ops; | 54 | struct request_sock_ops *rsk_ops; |
| 55 | struct sock *sk; | 55 | struct sock *sk; |
| 56 | u32 secid; | ||
| 56 | }; | 57 | }; |
| 57 | 58 | ||
| 58 | static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops) | 59 | static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops) |
diff --git a/include/net/route.h b/include/net/route.h index c4a068692dcc..486e37aff06c 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/route.h> | 32 | #include <linux/route.h> |
| 33 | #include <linux/ip.h> | 33 | #include <linux/ip.h> |
| 34 | #include <linux/cache.h> | 34 | #include <linux/cache.h> |
| 35 | #include <linux/security.h> | ||
| 35 | 36 | ||
| 36 | #ifndef __KERNEL__ | 37 | #ifndef __KERNEL__ |
| 37 | #warning This file is not supposed to be used outside of kernel. | 38 | #warning This file is not supposed to be used outside of kernel. |
| @@ -61,18 +62,18 @@ struct rtable | |||
| 61 | __u16 rt_type; | 62 | __u16 rt_type; |
| 62 | __u16 rt_multipath_alg; | 63 | __u16 rt_multipath_alg; |
| 63 | 64 | ||
| 64 | __u32 rt_dst; /* Path destination */ | 65 | __be32 rt_dst; /* Path destination */ |
| 65 | __u32 rt_src; /* Path source */ | 66 | __be32 rt_src; /* Path source */ |
| 66 | int rt_iif; | 67 | int rt_iif; |
| 67 | 68 | ||
| 68 | /* Info on neighbour */ | 69 | /* Info on neighbour */ |
| 69 | __u32 rt_gateway; | 70 | __be32 rt_gateway; |
| 70 | 71 | ||
| 71 | /* Cache lookup keys */ | 72 | /* Cache lookup keys */ |
| 72 | struct flowi fl; | 73 | struct flowi fl; |
| 73 | 74 | ||
| 74 | /* Miscellaneous cached information */ | 75 | /* Miscellaneous cached information */ |
| 75 | __u32 rt_spec_dst; /* RFC1122 specific destination */ | 76 | __be32 rt_spec_dst; /* RFC1122 specific destination */ |
| 76 | struct inet_peer *peer; /* long-living peer info */ | 77 | struct inet_peer *peer; /* long-living peer info */ |
| 77 | }; | 78 | }; |
| 78 | 79 | ||
| @@ -108,18 +109,18 @@ extern struct ip_rt_acct *ip_rt_acct; | |||
| 108 | 109 | ||
| 109 | struct in_device; | 110 | struct in_device; |
| 110 | extern int ip_rt_init(void); | 111 | extern int ip_rt_init(void); |
| 111 | extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw, | 112 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, |
| 112 | u32 src, struct net_device *dev); | 113 | __be32 src, struct net_device *dev); |
| 113 | extern void ip_rt_advice(struct rtable **rp, int advice); | 114 | extern void ip_rt_advice(struct rtable **rp, int advice); |
| 114 | extern void rt_cache_flush(int how); | 115 | extern void rt_cache_flush(int how); |
| 115 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); | 116 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); |
| 116 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); | 117 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); |
| 117 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 118 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); |
| 118 | extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin); | 119 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); |
| 119 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); | 120 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); |
| 120 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 121 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
| 121 | 122 | ||
| 122 | extern unsigned inet_addr_type(u32 addr); | 123 | extern unsigned inet_addr_type(__be32 addr); |
| 123 | extern void ip_rt_multicast_event(struct in_device *); | 124 | extern void ip_rt_multicast_event(struct in_device *); |
| 124 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); | 125 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); |
| 125 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); | 126 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); |
| @@ -143,9 +144,9 @@ static inline char rt_tos2priority(u8 tos) | |||
| 143 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; | 144 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; |
| 144 | } | 145 | } |
| 145 | 146 | ||
| 146 | static inline int ip_route_connect(struct rtable **rp, u32 dst, | 147 | static inline int ip_route_connect(struct rtable **rp, __be32 dst, |
| 147 | u32 src, u32 tos, int oif, u8 protocol, | 148 | __be32 src, u32 tos, int oif, u8 protocol, |
| 148 | u16 sport, u16 dport, struct sock *sk) | 149 | __be16 sport, __be16 dport, struct sock *sk) |
| 149 | { | 150 | { |
| 150 | struct flowi fl = { .oif = oif, | 151 | struct flowi fl = { .oif = oif, |
| 151 | .nl_u = { .ip4_u = { .daddr = dst, | 152 | .nl_u = { .ip4_u = { .daddr = dst, |
| @@ -166,11 +167,12 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, | |||
| 166 | ip_rt_put(*rp); | 167 | ip_rt_put(*rp); |
| 167 | *rp = NULL; | 168 | *rp = NULL; |
| 168 | } | 169 | } |
| 170 | security_sk_classify_flow(sk, &fl); | ||
| 169 | return ip_route_output_flow(rp, &fl, sk, 0); | 171 | return ip_route_output_flow(rp, &fl, sk, 0); |
| 170 | } | 172 | } |
| 171 | 173 | ||
| 172 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, | 174 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, |
| 173 | u16 sport, u16 dport, struct sock *sk) | 175 | __be16 sport, __be16 dport, struct sock *sk) |
| 174 | { | 176 | { |
| 175 | if (sport != (*rp)->fl.fl_ip_sport || | 177 | if (sport != (*rp)->fl.fl_ip_sport || |
| 176 | dport != (*rp)->fl.fl_ip_dport) { | 178 | dport != (*rp)->fl.fl_ip_dport) { |
| @@ -182,6 +184,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
| 182 | fl.proto = protocol; | 184 | fl.proto = protocol; |
| 183 | ip_rt_put(*rp); | 185 | ip_rt_put(*rp); |
| 184 | *rp = NULL; | 186 | *rp = NULL; |
| 187 | security_sk_classify_flow(sk, &fl); | ||
| 185 | return ip_route_output_flow(rp, &fl, sk, 0); | 188 | return ip_route_output_flow(rp, &fl, sk, 0); |
| 186 | } | 189 | } |
| 187 | return 0; | 190 | return 0; |
diff --git a/include/net/scm.h b/include/net/scm.h index 540619cb7160..5637d5e22d5f 100644 --- a/include/net/scm.h +++ b/include/net/scm.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/limits.h> | 4 | #include <linux/limits.h> |
| 5 | #include <linux/net.h> | 5 | #include <linux/net.h> |
| 6 | #include <linux/security.h> | ||
| 6 | 7 | ||
| 7 | /* Well, we should have at least one descriptor open | 8 | /* Well, we should have at least one descriptor open |
| 8 | * to accept passed FDs 8) | 9 | * to accept passed FDs 8) |
| @@ -19,6 +20,9 @@ struct scm_cookie | |||
| 19 | { | 20 | { |
| 20 | struct ucred creds; /* Skb credentials */ | 21 | struct ucred creds; /* Skb credentials */ |
| 21 | struct scm_fp_list *fp; /* Passed files */ | 22 | struct scm_fp_list *fp; /* Passed files */ |
| 23 | #ifdef CONFIG_SECURITY_NETWORK | ||
| 24 | u32 secid; /* Passed security ID */ | ||
| 25 | #endif | ||
| 22 | unsigned long seq; /* Connection seqno */ | 26 | unsigned long seq; /* Connection seqno */ |
| 23 | }; | 27 | }; |
| 24 | 28 | ||
| @@ -28,6 +32,16 @@ extern int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie | |||
| 28 | extern void __scm_destroy(struct scm_cookie *scm); | 32 | extern void __scm_destroy(struct scm_cookie *scm); |
| 29 | extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); | 33 | extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); |
| 30 | 34 | ||
| 35 | #ifdef CONFIG_SECURITY_NETWORK | ||
| 36 | static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) | ||
| 37 | { | ||
| 38 | security_socket_getpeersec_dgram(sock, NULL, &scm->secid); | ||
| 39 | } | ||
| 40 | #else | ||
| 41 | static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) | ||
| 42 | { } | ||
| 43 | #endif /* CONFIG_SECURITY_NETWORK */ | ||
| 44 | |||
| 31 | static __inline__ void scm_destroy(struct scm_cookie *scm) | 45 | static __inline__ void scm_destroy(struct scm_cookie *scm) |
| 32 | { | 46 | { |
| 33 | if (scm && scm->fp) | 47 | if (scm && scm->fp) |
| @@ -43,11 +57,33 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, | |||
| 43 | scm->creds.pid = p->tgid; | 57 | scm->creds.pid = p->tgid; |
| 44 | scm->fp = NULL; | 58 | scm->fp = NULL; |
| 45 | scm->seq = 0; | 59 | scm->seq = 0; |
| 60 | unix_get_peersec_dgram(sock, scm); | ||
| 46 | if (msg->msg_controllen <= 0) | 61 | if (msg->msg_controllen <= 0) |
| 47 | return 0; | 62 | return 0; |
| 48 | return __scm_send(sock, msg, scm); | 63 | return __scm_send(sock, msg, scm); |
| 49 | } | 64 | } |
| 50 | 65 | ||
| 66 | #ifdef CONFIG_SECURITY_NETWORK | ||
| 67 | static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) | ||
| 68 | { | ||
| 69 | char *secdata; | ||
| 70 | u32 seclen; | ||
| 71 | int err; | ||
| 72 | |||
| 73 | if (test_bit(SOCK_PASSSEC, &sock->flags)) { | ||
| 74 | err = security_secid_to_secctx(scm->secid, &secdata, &seclen); | ||
| 75 | |||
| 76 | if (!err) { | ||
| 77 | put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, seclen, secdata); | ||
| 78 | security_release_secctx(secdata, seclen); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | } | ||
| 82 | #else | ||
| 83 | static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) | ||
| 84 | { } | ||
| 85 | #endif /* CONFIG_SECURITY_NETWORK */ | ||
| 86 | |||
| 51 | static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, | 87 | static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, |
| 52 | struct scm_cookie *scm, int flags) | 88 | struct scm_cookie *scm, int flags) |
| 53 | { | 89 | { |
| @@ -62,6 +98,8 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, | |||
| 62 | if (test_bit(SOCK_PASSCRED, &sock->flags)) | 98 | if (test_bit(SOCK_PASSCRED, &sock->flags)) |
| 63 | put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); | 99 | put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); |
| 64 | 100 | ||
| 101 | scm_passec(sock, msg, scm); | ||
| 102 | |||
| 65 | if (!scm->fp) | 103 | if (!scm->fp) |
| 66 | return; | 104 | return; |
| 67 | 105 | ||
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index c51541ee0247..6c632e26f72d 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
| @@ -264,10 +264,10 @@ enum { SCTP_MAX_DUP_TSNS = 16 }; | |||
| 264 | enum { SCTP_MAX_GABS = 16 }; | 264 | enum { SCTP_MAX_GABS = 16 }; |
| 265 | 265 | ||
| 266 | /* Heartbeat interval - 30 secs */ | 266 | /* Heartbeat interval - 30 secs */ |
| 267 | #define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30 * HZ) | 267 | #define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30*1000) |
| 268 | 268 | ||
| 269 | /* Delayed sack timer - 200ms */ | 269 | /* Delayed sack timer - 200ms */ |
| 270 | #define SCTP_DEFAULT_TIMEOUT_SACK ((200 * HZ) / 1000) | 270 | #define SCTP_DEFAULT_TIMEOUT_SACK (200) |
| 271 | 271 | ||
| 272 | /* RTO.Initial - 3 seconds | 272 | /* RTO.Initial - 3 seconds |
| 273 | * RTO.Min - 1 second | 273 | * RTO.Min - 1 second |
| @@ -275,9 +275,9 @@ enum { SCTP_MAX_GABS = 16 }; | |||
| 275 | * RTO.Alpha - 1/8 | 275 | * RTO.Alpha - 1/8 |
| 276 | * RTO.Beta - 1/4 | 276 | * RTO.Beta - 1/4 |
| 277 | */ | 277 | */ |
| 278 | #define SCTP_RTO_INITIAL (3 * HZ) | 278 | #define SCTP_RTO_INITIAL (3 * 1000) |
| 279 | #define SCTP_RTO_MIN (1 * HZ) | 279 | #define SCTP_RTO_MIN (1 * 1000) |
| 280 | #define SCTP_RTO_MAX (60 * HZ) | 280 | #define SCTP_RTO_MAX (60 * 1000) |
| 281 | 281 | ||
| 282 | #define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */ | 282 | #define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */ |
| 283 | #define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ | 283 | #define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ |
| @@ -290,8 +290,7 @@ enum { SCTP_MAX_GABS = 16 }; | |||
| 290 | #define SCTP_DEF_MAX_INIT 6 | 290 | #define SCTP_DEF_MAX_INIT 6 |
| 291 | #define SCTP_DEF_MAX_SEND 10 | 291 | #define SCTP_DEF_MAX_SEND 10 |
| 292 | 292 | ||
| 293 | #define SCTP_DEFAULT_COOKIE_LIFE_SEC 60 /* seconds */ | 293 | #define SCTP_DEFAULT_COOKIE_LIFE (60 * 1000) /* 60 seconds */ |
| 294 | #define SCTP_DEFAULT_COOKIE_LIFE_USEC 0 /* microseconds */ | ||
| 295 | 294 | ||
| 296 | #define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ | 295 | #define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ |
| 297 | #define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ | 296 | #define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ |
| @@ -312,9 +311,9 @@ enum { SCTP_MAX_GABS = 16 }; | |||
| 312 | */ | 311 | */ |
| 313 | 312 | ||
| 314 | #if defined (CONFIG_SCTP_HMAC_MD5) | 313 | #if defined (CONFIG_SCTP_HMAC_MD5) |
| 315 | #define SCTP_COOKIE_HMAC_ALG "md5" | 314 | #define SCTP_COOKIE_HMAC_ALG "hmac(md5)" |
| 316 | #elif defined (CONFIG_SCTP_HMAC_SHA1) | 315 | #elif defined (CONFIG_SCTP_HMAC_SHA1) |
| 317 | #define SCTP_COOKIE_HMAC_ALG "sha1" | 316 | #define SCTP_COOKIE_HMAC_ALG "hmac(sha1)" |
| 318 | #else | 317 | #else |
| 319 | #define SCTP_COOKIE_HMAC_ALG NULL | 318 | #define SCTP_COOKIE_HMAC_ALG NULL |
| 320 | #endif | 319 | #endif |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index a9663b49ea54..ee68a3124076 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
| @@ -128,6 +128,8 @@ extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, | |||
| 128 | int flags); | 128 | int flags); |
| 129 | extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); | 129 | extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); |
| 130 | extern int sctp_register_pf(struct sctp_pf *, sa_family_t); | 130 | extern int sctp_register_pf(struct sctp_pf *, sa_family_t); |
| 131 | int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, | ||
| 132 | void *ptr); | ||
| 131 | 133 | ||
| 132 | /* | 134 | /* |
| 133 | * sctp/socket.c | 135 | * sctp/socket.c |
| @@ -178,6 +180,17 @@ void sctp_backlog_migrate(struct sctp_association *assoc, | |||
| 178 | struct sock *oldsk, struct sock *newsk); | 180 | struct sock *oldsk, struct sock *newsk); |
| 179 | 181 | ||
| 180 | /* | 182 | /* |
| 183 | * sctp/proc.c | ||
| 184 | */ | ||
| 185 | int sctp_snmp_proc_init(void); | ||
| 186 | void sctp_snmp_proc_exit(void); | ||
| 187 | int sctp_eps_proc_init(void); | ||
| 188 | void sctp_eps_proc_exit(void); | ||
| 189 | int sctp_assocs_proc_init(void); | ||
| 190 | void sctp_assocs_proc_exit(void); | ||
| 191 | |||
| 192 | |||
| 193 | /* | ||
| 181 | * Section: Macros, externs, and inlines | 194 | * Section: Macros, externs, and inlines |
| 182 | */ | 195 | */ |
| 183 | 196 | ||
| @@ -216,6 +229,50 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); | |||
| 216 | 229 | ||
| 217 | #endif /* !TEST_FRAME */ | 230 | #endif /* !TEST_FRAME */ |
| 218 | 231 | ||
| 232 | /* sctp mib definitions */ | ||
| 233 | enum | ||
| 234 | { | ||
| 235 | SCTP_MIB_NUM = 0, | ||
| 236 | SCTP_MIB_CURRESTAB, /* CurrEstab */ | ||
| 237 | SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */ | ||
| 238 | SCTP_MIB_PASSIVEESTABS, /* PassiveEstabs */ | ||
| 239 | SCTP_MIB_ABORTEDS, /* Aborteds */ | ||
| 240 | SCTP_MIB_SHUTDOWNS, /* Shutdowns */ | ||
| 241 | SCTP_MIB_OUTOFBLUES, /* OutOfBlues */ | ||
| 242 | SCTP_MIB_CHECKSUMERRORS, /* ChecksumErrors */ | ||
| 243 | SCTP_MIB_OUTCTRLCHUNKS, /* OutCtrlChunks */ | ||
| 244 | SCTP_MIB_OUTORDERCHUNKS, /* OutOrderChunks */ | ||
| 245 | SCTP_MIB_OUTUNORDERCHUNKS, /* OutUnorderChunks */ | ||
| 246 | SCTP_MIB_INCTRLCHUNKS, /* InCtrlChunks */ | ||
| 247 | SCTP_MIB_INORDERCHUNKS, /* InOrderChunks */ | ||
| 248 | SCTP_MIB_INUNORDERCHUNKS, /* InUnorderChunks */ | ||
| 249 | SCTP_MIB_FRAGUSRMSGS, /* FragUsrMsgs */ | ||
| 250 | SCTP_MIB_REASMUSRMSGS, /* ReasmUsrMsgs */ | ||
| 251 | SCTP_MIB_OUTSCTPPACKS, /* OutSCTPPacks */ | ||
| 252 | SCTP_MIB_INSCTPPACKS, /* InSCTPPacks */ | ||
| 253 | SCTP_MIB_T1_INIT_EXPIREDS, | ||
| 254 | SCTP_MIB_T1_COOKIE_EXPIREDS, | ||
| 255 | SCTP_MIB_T2_SHUTDOWN_EXPIREDS, | ||
| 256 | SCTP_MIB_T3_RTX_EXPIREDS, | ||
| 257 | SCTP_MIB_T4_RTO_EXPIREDS, | ||
| 258 | SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, | ||
| 259 | SCTP_MIB_DELAY_SACK_EXPIREDS, | ||
| 260 | SCTP_MIB_AUTOCLOSE_EXPIREDS, | ||
| 261 | SCTP_MIB_T3_RETRANSMITS, | ||
| 262 | SCTP_MIB_PMTUD_RETRANSMITS, | ||
| 263 | SCTP_MIB_FAST_RETRANSMITS, | ||
| 264 | SCTP_MIB_IN_PKT_SOFTIRQ, | ||
| 265 | SCTP_MIB_IN_PKT_BACKLOG, | ||
| 266 | SCTP_MIB_IN_PKT_DISCARDS, | ||
| 267 | SCTP_MIB_IN_DATA_CHUNK_DISCARDS, | ||
| 268 | __SCTP_MIB_MAX | ||
| 269 | }; | ||
| 270 | |||
| 271 | #define SCTP_MIB_MAX __SCTP_MIB_MAX | ||
| 272 | struct sctp_mib { | ||
| 273 | unsigned long mibs[SCTP_MIB_MAX]; | ||
| 274 | } __SNMP_MIB_ALIGN__; | ||
| 275 | |||
| 219 | 276 | ||
| 220 | /* Print debugging messages. */ | 277 | /* Print debugging messages. */ |
| 221 | #if SCTP_DEBUG | 278 | #if SCTP_DEBUG |
| @@ -330,17 +387,6 @@ static inline void sctp_v6_exit(void) { return; } | |||
| 330 | 387 | ||
| 331 | #endif /* #if defined(CONFIG_IPV6) */ | 388 | #endif /* #if defined(CONFIG_IPV6) */ |
| 332 | 389 | ||
| 333 | /* Some wrappers, in case crypto not available. */ | ||
| 334 | #if defined (CONFIG_CRYPTO_HMAC) | ||
| 335 | #define sctp_crypto_alloc_tfm crypto_alloc_tfm | ||
| 336 | #define sctp_crypto_free_tfm crypto_free_tfm | ||
| 337 | #define sctp_crypto_hmac crypto_hmac | ||
| 338 | #else | ||
| 339 | #define sctp_crypto_alloc_tfm(x...) NULL | ||
| 340 | #define sctp_crypto_free_tfm(x...) | ||
| 341 | #define sctp_crypto_hmac(x...) | ||
| 342 | #endif | ||
| 343 | |||
| 344 | 390 | ||
| 345 | /* Map an association to an assoc_id. */ | 391 | /* Map an association to an assoc_id. */ |
| 346 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) | 392 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) |
| @@ -404,19 +450,6 @@ static inline int sctp_list_single_entry(struct list_head *head) | |||
| 404 | return ((head->next != head) && (head->next == head->prev)); | 450 | return ((head->next != head) && (head->next == head->prev)); |
| 405 | } | 451 | } |
| 406 | 452 | ||
| 407 | /* Calculate the size (in bytes) occupied by the data of an iovec. */ | ||
| 408 | static inline size_t get_user_iov_size(struct iovec *iov, int iovlen) | ||
| 409 | { | ||
| 410 | size_t retval = 0; | ||
| 411 | |||
| 412 | for (; iovlen > 0; --iovlen) { | ||
| 413 | retval += iov->iov_len; | ||
| 414 | iov++; | ||
| 415 | } | ||
| 416 | |||
| 417 | return retval; | ||
| 418 | } | ||
| 419 | |||
| 420 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ | 453 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ |
| 421 | static inline __s32 sctp_jitter(__u32 rto) | 454 | static inline __s32 sctp_jitter(__u32 rto) |
| 422 | { | 455 | { |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 1eac3d0eb7a9..de313de4fefe 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
| @@ -221,8 +221,7 @@ struct sctp_chunk *sctp_make_abort_no_data(const struct sctp_association *, | |||
| 221 | const struct sctp_chunk *, | 221 | const struct sctp_chunk *, |
| 222 | __u32 tsn); | 222 | __u32 tsn); |
| 223 | struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, | 223 | struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, |
| 224 | const struct sctp_chunk *, | 224 | const struct msghdr *, size_t msg_len); |
| 225 | const struct msghdr *); | ||
| 226 | struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, | 225 | struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, |
| 227 | const struct sctp_chunk *, | 226 | const struct sctp_chunk *, |
| 228 | const __u8 *, | 227 | const __u8 *, |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 5f69158c1006..c6d93bb0dcd2 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -87,6 +87,7 @@ struct sctp_bind_addr; | |||
| 87 | struct sctp_ulpq; | 87 | struct sctp_ulpq; |
| 88 | struct sctp_ep_common; | 88 | struct sctp_ep_common; |
| 89 | struct sctp_ssnmap; | 89 | struct sctp_ssnmap; |
| 90 | struct crypto_hash; | ||
| 90 | 91 | ||
| 91 | 92 | ||
| 92 | #include <net/sctp/tsnmap.h> | 93 | #include <net/sctp/tsnmap.h> |
| @@ -127,9 +128,9 @@ extern struct sctp_globals { | |||
| 127 | * RTO.Alpha - 1/8 (3 when converted to right shifts.) | 128 | * RTO.Alpha - 1/8 (3 when converted to right shifts.) |
| 128 | * RTO.Beta - 1/4 (2 when converted to right shifts.) | 129 | * RTO.Beta - 1/4 (2 when converted to right shifts.) |
| 129 | */ | 130 | */ |
| 130 | unsigned long rto_initial; | 131 | unsigned int rto_initial; |
| 131 | unsigned long rto_min; | 132 | unsigned int rto_min; |
| 132 | unsigned long rto_max; | 133 | unsigned int rto_max; |
| 133 | 134 | ||
| 134 | /* Note: rto_alpha and rto_beta are really defined as inverse | 135 | /* Note: rto_alpha and rto_beta are really defined as inverse |
| 135 | * powers of two to facilitate integer operations. | 136 | * powers of two to facilitate integer operations. |
| @@ -144,13 +145,13 @@ extern struct sctp_globals { | |||
| 144 | int cookie_preserve_enable; | 145 | int cookie_preserve_enable; |
| 145 | 146 | ||
| 146 | /* Valid.Cookie.Life - 60 seconds */ | 147 | /* Valid.Cookie.Life - 60 seconds */ |
| 147 | unsigned long valid_cookie_life; | 148 | unsigned int valid_cookie_life; |
| 148 | 149 | ||
| 149 | /* Delayed SACK timeout 200ms default*/ | 150 | /* Delayed SACK timeout 200ms default*/ |
| 150 | unsigned long sack_timeout; | 151 | unsigned int sack_timeout; |
| 151 | 152 | ||
| 152 | /* HB.interval - 30 seconds */ | 153 | /* HB.interval - 30 seconds */ |
| 153 | unsigned long hb_interval; | 154 | unsigned int hb_interval; |
| 154 | 155 | ||
| 155 | /* Association.Max.Retrans - 10 attempts | 156 | /* Association.Max.Retrans - 10 attempts |
| 156 | * Path.Max.Retrans - 5 attempts (per destination address) | 157 | * Path.Max.Retrans - 5 attempts (per destination address) |
| @@ -264,7 +265,7 @@ struct sctp_sock { | |||
| 264 | struct sctp_pf *pf; | 265 | struct sctp_pf *pf; |
| 265 | 266 | ||
| 266 | /* Access to HMAC transform. */ | 267 | /* Access to HMAC transform. */ |
| 267 | struct crypto_tfm *hmac; | 268 | struct crypto_hash *hmac; |
| 268 | 269 | ||
| 269 | /* What is our base endpointer? */ | 270 | /* What is our base endpointer? */ |
| 270 | struct sctp_endpoint *ep; | 271 | struct sctp_endpoint *ep; |
| @@ -445,6 +446,7 @@ typedef struct sctp_sender_hb_info { | |||
| 445 | struct sctp_paramhdr param_hdr; | 446 | struct sctp_paramhdr param_hdr; |
| 446 | union sctp_addr daddr; | 447 | union sctp_addr daddr; |
| 447 | unsigned long sent_at; | 448 | unsigned long sent_at; |
| 449 | __u64 hb_nonce; | ||
| 448 | } __attribute__((packed)) sctp_sender_hb_info_t; | 450 | } __attribute__((packed)) sctp_sender_hb_info_t; |
| 449 | 451 | ||
| 450 | /* | 452 | /* |
| @@ -730,13 +732,10 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *, | |||
| 730 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); | 732 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); |
| 731 | 733 | ||
| 732 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ | 734 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ |
| 733 | /* sin_family -- AF_INET or AF_INET6 | ||
| 734 | * sin_port -- ordinary port number | ||
| 735 | * sin_addr -- cast to either (struct in_addr) or (struct in6_addr) | ||
| 736 | */ | ||
| 737 | struct sctp_sockaddr_entry { | 735 | struct sctp_sockaddr_entry { |
| 738 | struct list_head list; | 736 | struct list_head list; |
| 739 | union sctp_addr a; | 737 | union sctp_addr a; |
| 738 | __u8 use_as_src; | ||
| 740 | }; | 739 | }; |
| 741 | 740 | ||
| 742 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); | 741 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); |
| @@ -984,6 +983,9 @@ struct sctp_transport { | |||
| 984 | */ | 983 | */ |
| 985 | char cacc_saw_newack; | 984 | char cacc_saw_newack; |
| 986 | } cacc; | 985 | } cacc; |
| 986 | |||
| 987 | /* 64-bit random number sent with heartbeat. */ | ||
| 988 | __u64 hb_nonce; | ||
| 987 | }; | 989 | }; |
| 988 | 990 | ||
| 989 | struct sctp_transport *sctp_transport_new(const union sctp_addr *, | 991 | struct sctp_transport *sctp_transport_new(const union sctp_addr *, |
| @@ -1138,7 +1140,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, | |||
| 1138 | sctp_scope_t scope, gfp_t gfp, | 1140 | sctp_scope_t scope, gfp_t gfp, |
| 1139 | int flags); | 1141 | int flags); |
| 1140 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1142 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
| 1141 | gfp_t gfp); | 1143 | __u8 use_as_src, gfp_t gfp); |
| 1142 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); | 1144 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); |
| 1143 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, | 1145 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, |
| 1144 | struct sctp_sock *); | 1146 | struct sctp_sock *); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 8a6bef6f91eb..1b7aae6cdd82 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
| @@ -560,9 +560,18 @@ struct sctp_paddrinfo { | |||
| 560 | } __attribute__((packed, aligned(4))); | 560 | } __attribute__((packed, aligned(4))); |
| 561 | 561 | ||
| 562 | /* Peer addresses's state. */ | 562 | /* Peer addresses's state. */ |
| 563 | /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] | ||
| 564 | * calls. | ||
| 565 | * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. | ||
| 566 | * Not yet confirmed by a heartbeat and not available for data | ||
| 567 | * transfers. | ||
| 568 | * ACTIVE : Peer address confirmed, active and available for data transfers. | ||
| 569 | * INACTIVE: Peer address inactive and not available for data transfers. | ||
| 570 | */ | ||
| 563 | enum sctp_spinfo_state { | 571 | enum sctp_spinfo_state { |
| 564 | SCTP_INACTIVE, | 572 | SCTP_INACTIVE, |
| 565 | SCTP_ACTIVE, | 573 | SCTP_ACTIVE, |
| 574 | SCTP_UNCONFIRMED, | ||
| 566 | SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ | 575 | SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ |
| 567 | }; | 576 | }; |
| 568 | 577 | ||
diff --git a/include/net/snmp.h b/include/net/snmp.h index a36bed8ea210..464970e39ec0 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
| @@ -100,12 +100,6 @@ struct udp_mib { | |||
| 100 | unsigned long mibs[UDP_MIB_MAX]; | 100 | unsigned long mibs[UDP_MIB_MAX]; |
| 101 | } __SNMP_MIB_ALIGN__; | 101 | } __SNMP_MIB_ALIGN__; |
| 102 | 102 | ||
| 103 | /* SCTP */ | ||
| 104 | #define SCTP_MIB_MAX __SCTP_MIB_MAX | ||
| 105 | struct sctp_mib { | ||
| 106 | unsigned long mibs[SCTP_MIB_MAX]; | ||
| 107 | } __SNMP_MIB_ALIGN__; | ||
| 108 | |||
| 109 | /* Linux */ | 103 | /* Linux */ |
| 110 | #define LINUX_MIB_MAX __LINUX_MIB_MAX | 104 | #define LINUX_MIB_MAX __LINUX_MIB_MAX |
| 111 | struct linux_mib { | 105 | struct linux_mib { |
diff --git a/include/net/sock.h b/include/net/sock.h index 2d8d6adf1616..edd4d73ce7f5 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #include <linux/timer.h> | 44 | #include <linux/timer.h> |
| 45 | #include <linux/cache.h> | 45 | #include <linux/cache.h> |
| 46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
| 47 | #include <linux/lockdep.h> | ||
| 47 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
| 48 | #include <linux/skbuff.h> /* struct sk_buff */ | 49 | #include <linux/skbuff.h> /* struct sk_buff */ |
| 49 | #include <linux/security.h> | 50 | #include <linux/security.h> |
| @@ -78,14 +79,17 @@ typedef struct { | |||
| 78 | spinlock_t slock; | 79 | spinlock_t slock; |
| 79 | struct sock_iocb *owner; | 80 | struct sock_iocb *owner; |
| 80 | wait_queue_head_t wq; | 81 | wait_queue_head_t wq; |
| 82 | /* | ||
| 83 | * We express the mutex-alike socket_lock semantics | ||
| 84 | * to the lock validator by explicitly managing | ||
| 85 | * the slock as a lock variant (in addition to | ||
| 86 | * the slock itself): | ||
| 87 | */ | ||
| 88 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 89 | struct lockdep_map dep_map; | ||
| 90 | #endif | ||
| 81 | } socket_lock_t; | 91 | } socket_lock_t; |
| 82 | 92 | ||
| 83 | #define sock_lock_init(__sk) \ | ||
| 84 | do { spin_lock_init(&((__sk)->sk_lock.slock)); \ | ||
| 85 | (__sk)->sk_lock.owner = NULL; \ | ||
| 86 | init_waitqueue_head(&((__sk)->sk_lock.wq)); \ | ||
| 87 | } while(0) | ||
| 88 | |||
| 89 | struct sock; | 93 | struct sock; |
| 90 | struct proto; | 94 | struct proto; |
| 91 | 95 | ||
| @@ -140,6 +144,7 @@ struct sock_common { | |||
| 140 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings | 144 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings |
| 141 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets | 145 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets |
| 142 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) | 146 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) |
| 147 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) | ||
| 143 | * @sk_lingertime: %SO_LINGER l_linger setting | 148 | * @sk_lingertime: %SO_LINGER l_linger setting |
| 144 | * @sk_backlog: always used with the per-socket spinlock held | 149 | * @sk_backlog: always used with the per-socket spinlock held |
| 145 | * @sk_callback_lock: used with the callbacks in the end of this struct | 150 | * @sk_callback_lock: used with the callbacks in the end of this struct |
| @@ -211,6 +216,7 @@ struct sock { | |||
| 211 | gfp_t sk_allocation; | 216 | gfp_t sk_allocation; |
| 212 | int sk_sndbuf; | 217 | int sk_sndbuf; |
| 213 | int sk_route_caps; | 218 | int sk_route_caps; |
| 219 | int sk_gso_type; | ||
| 214 | int sk_rcvlowat; | 220 | int sk_rcvlowat; |
| 215 | unsigned long sk_flags; | 221 | unsigned long sk_flags; |
| 216 | unsigned long sk_lingertime; | 222 | unsigned long sk_lingertime; |
| @@ -383,7 +389,6 @@ enum sock_flags { | |||
| 383 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ | 389 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ |
| 384 | SOCK_DBG, /* %SO_DEBUG setting */ | 390 | SOCK_DBG, /* %SO_DEBUG setting */ |
| 385 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ | 391 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ |
| 386 | SOCK_NO_LARGESEND, /* whether to sent large segments or not */ | ||
| 387 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ | 392 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ |
| 388 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ | 393 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ |
| 389 | }; | 394 | }; |
| @@ -746,6 +751,9 @@ extern void FASTCALL(release_sock(struct sock *sk)); | |||
| 746 | 751 | ||
| 747 | /* BH context may only use the following locking interface. */ | 752 | /* BH context may only use the following locking interface. */ |
| 748 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) | 753 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) |
| 754 | #define bh_lock_sock_nested(__sk) \ | ||
| 755 | spin_lock_nested(&((__sk)->sk_lock.slock), \ | ||
| 756 | SINGLE_DEPTH_NESTING) | ||
| 749 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) | 757 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) |
| 750 | 758 | ||
| 751 | extern struct sock *sk_alloc(int family, | 759 | extern struct sock *sk_alloc(int family, |
| @@ -854,30 +862,24 @@ extern void sock_init_data(struct socket *sock, struct sock *sk); | |||
| 854 | * | 862 | * |
| 855 | */ | 863 | */ |
| 856 | 864 | ||
| 857 | static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock) | 865 | static inline int sk_filter(struct sock *sk, struct sk_buff *skb) |
| 858 | { | 866 | { |
| 859 | int err; | 867 | int err; |
| 868 | struct sk_filter *filter; | ||
| 860 | 869 | ||
| 861 | err = security_sock_rcv_skb(sk, skb); | 870 | err = security_sock_rcv_skb(sk, skb); |
| 862 | if (err) | 871 | if (err) |
| 863 | return err; | 872 | return err; |
| 864 | 873 | ||
| 865 | if (sk->sk_filter) { | 874 | rcu_read_lock_bh(); |
| 866 | struct sk_filter *filter; | 875 | filter = sk->sk_filter; |
| 867 | 876 | if (filter) { | |
| 868 | if (needlock) | 877 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, |
| 869 | bh_lock_sock(sk); | 878 | filter->len); |
| 870 | 879 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; | |
| 871 | filter = sk->sk_filter; | ||
| 872 | if (filter) { | ||
| 873 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, | ||
| 874 | filter->len); | ||
| 875 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; | ||
| 876 | } | ||
| 877 | |||
| 878 | if (needlock) | ||
| 879 | bh_unlock_sock(sk); | ||
| 880 | } | 880 | } |
| 881 | rcu_read_unlock_bh(); | ||
| 882 | |||
| 881 | return err; | 883 | return err; |
| 882 | } | 884 | } |
| 883 | 885 | ||
| @@ -889,6 +891,12 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock) | |||
| 889 | * Remove a filter from a socket and release its resources. | 891 | * Remove a filter from a socket and release its resources. |
| 890 | */ | 892 | */ |
| 891 | 893 | ||
| 894 | static inline void sk_filter_rcu_free(struct rcu_head *rcu) | ||
| 895 | { | ||
| 896 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); | ||
| 897 | kfree(fp); | ||
| 898 | } | ||
| 899 | |||
| 892 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) | 900 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) |
| 893 | { | 901 | { |
| 894 | unsigned int size = sk_filter_len(fp); | 902 | unsigned int size = sk_filter_len(fp); |
| @@ -896,7 +904,7 @@ static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) | |||
| 896 | atomic_sub(size, &sk->sk_omem_alloc); | 904 | atomic_sub(size, &sk->sk_omem_alloc); |
| 897 | 905 | ||
| 898 | if (atomic_dec_and_test(&fp->refcnt)) | 906 | if (atomic_dec_and_test(&fp->refcnt)) |
| 899 | kfree(fp); | 907 | call_rcu_bh(&fp->rcu, sk_filter_rcu_free); |
| 900 | } | 908 | } |
| 901 | 909 | ||
| 902 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) | 910 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) |
| @@ -961,9 +969,23 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) | |||
| 961 | sk->sk_sleep = &parent->wait; | 969 | sk->sk_sleep = &parent->wait; |
| 962 | parent->sk = sk; | 970 | parent->sk = sk; |
| 963 | sk->sk_socket = parent; | 971 | sk->sk_socket = parent; |
| 972 | security_sock_graft(sk, parent); | ||
| 964 | write_unlock_bh(&sk->sk_callback_lock); | 973 | write_unlock_bh(&sk->sk_callback_lock); |
| 965 | } | 974 | } |
| 966 | 975 | ||
| 976 | static inline void sock_copy(struct sock *nsk, const struct sock *osk) | ||
| 977 | { | ||
| 978 | #ifdef CONFIG_SECURITY_NETWORK | ||
| 979 | void *sptr = nsk->sk_security; | ||
| 980 | #endif | ||
| 981 | |||
| 982 | memcpy(nsk, osk, osk->sk_prot->obj_size); | ||
| 983 | #ifdef CONFIG_SECURITY_NETWORK | ||
| 984 | nsk->sk_security = sptr; | ||
| 985 | security_sk_clone(osk, nsk); | ||
| 986 | #endif | ||
| 987 | } | ||
| 988 | |||
| 967 | extern int sock_i_uid(struct sock *sk); | 989 | extern int sock_i_uid(struct sock *sk); |
| 968 | extern unsigned long sock_i_ino(struct sock *sk); | 990 | extern unsigned long sock_i_ino(struct sock *sk); |
| 969 | 991 | ||
| @@ -1026,15 +1048,20 @@ extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); | |||
| 1026 | 1048 | ||
| 1027 | extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); | 1049 | extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); |
| 1028 | 1050 | ||
| 1051 | static inline int sk_can_gso(const struct sock *sk) | ||
| 1052 | { | ||
| 1053 | return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); | ||
| 1054 | } | ||
| 1055 | |||
| 1029 | static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | 1056 | static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) |
| 1030 | { | 1057 | { |
| 1031 | __sk_dst_set(sk, dst); | 1058 | __sk_dst_set(sk, dst); |
| 1032 | sk->sk_route_caps = dst->dev->features; | 1059 | sk->sk_route_caps = dst->dev->features; |
| 1033 | if (sk->sk_route_caps & NETIF_F_GSO) | 1060 | if (sk->sk_route_caps & NETIF_F_GSO) |
| 1034 | sk->sk_route_caps |= NETIF_F_TSO; | 1061 | sk->sk_route_caps |= NETIF_F_GSO_MASK; |
| 1035 | if (sk->sk_route_caps & NETIF_F_TSO) { | 1062 | if (sk_can_gso(sk)) { |
| 1036 | if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) | 1063 | if (dst->header_len) |
| 1037 | sk->sk_route_caps &= ~NETIF_F_TSO; | 1064 | sk->sk_route_caps &= ~NETIF_F_GSO_MASK; |
| 1038 | else | 1065 | else |
| 1039 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; | 1066 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; |
| 1040 | } | 1067 | } |
diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h index 463aa671f95d..65f024b80958 100644 --- a/include/net/tc_act/tc_defact.h +++ b/include/net/tc_act/tc_defact.h | |||
| @@ -3,11 +3,12 @@ | |||
| 3 | 3 | ||
| 4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
| 5 | 5 | ||
| 6 | struct tcf_defact | 6 | struct tcf_defact { |
| 7 | { | 7 | struct tcf_common common; |
| 8 | tca_gen(defact); | 8 | u32 tcfd_datalen; |
| 9 | u32 datalen; | 9 | void *tcfd_defdata; |
| 10 | void *defdata; | ||
| 11 | }; | 10 | }; |
| 11 | #define to_defact(pc) \ | ||
| 12 | container_of(pc, struct tcf_defact, common) | ||
| 12 | 13 | ||
| 13 | #endif | 14 | #endif /* __NET_TC_DEF_H */ |
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h index 59f0d9628ad1..9e3f6767b80e 100644 --- a/include/net/tc_act/tc_gact.h +++ b/include/net/tc_act/tc_gact.h | |||
| @@ -3,15 +3,15 @@ | |||
| 3 | 3 | ||
| 4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
| 5 | 5 | ||
| 6 | struct tcf_gact | 6 | struct tcf_gact { |
| 7 | { | 7 | struct tcf_common common; |
| 8 | tca_gen(gact); | ||
| 9 | #ifdef CONFIG_GACT_PROB | 8 | #ifdef CONFIG_GACT_PROB |
| 10 | u16 ptype; | 9 | u16 tcfg_ptype; |
| 11 | u16 pval; | 10 | u16 tcfg_pval; |
| 12 | int paction; | 11 | int tcfg_paction; |
| 13 | #endif | 12 | #endif |
| 14 | |||
| 15 | }; | 13 | }; |
| 16 | 14 | #define to_gact(pc) \ | |
| 17 | #endif | 15 | container_of(pc, struct tcf_gact, common) |
| 16 | |||
| 17 | #endif /* __NET_TC_GACT_H */ | ||
diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h index cb37ad08427f..f7d25dfcc4b7 100644 --- a/include/net/tc_act/tc_ipt.h +++ b/include/net/tc_act/tc_ipt.h | |||
| @@ -5,12 +5,13 @@ | |||
| 5 | 5 | ||
| 6 | struct xt_entry_target; | 6 | struct xt_entry_target; |
| 7 | 7 | ||
| 8 | struct tcf_ipt | 8 | struct tcf_ipt { |
| 9 | { | 9 | struct tcf_common common; |
| 10 | tca_gen(ipt); | 10 | u32 tcfi_hook; |
| 11 | u32 hook; | 11 | char *tcfi_tname; |
| 12 | char *tname; | 12 | struct xt_entry_target *tcfi_t; |
| 13 | struct xt_entry_target *t; | ||
| 14 | }; | 13 | }; |
| 14 | #define to_ipt(pc) \ | ||
| 15 | container_of(pc, struct tcf_ipt, common) | ||
| 15 | 16 | ||
| 16 | #endif | 17 | #endif /* __NET_TC_IPT_H */ |
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h index b5c32f65c12c..ceac661cdfd5 100644 --- a/include/net/tc_act/tc_mirred.h +++ b/include/net/tc_act/tc_mirred.h | |||
| @@ -3,13 +3,14 @@ | |||
| 3 | 3 | ||
| 4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
| 5 | 5 | ||
| 6 | struct tcf_mirred | 6 | struct tcf_mirred { |
| 7 | { | 7 | struct tcf_common common; |
| 8 | tca_gen(mirred); | 8 | int tcfm_eaction; |
| 9 | int eaction; | 9 | int tcfm_ifindex; |
| 10 | int ifindex; | 10 | int tcfm_ok_push; |
| 11 | int ok_push; | 11 | struct net_device *tcfm_dev; |
| 12 | struct net_device *dev; | ||
| 13 | }; | 12 | }; |
| 13 | #define to_mirred(pc) \ | ||
| 14 | container_of(pc, struct tcf_mirred, common) | ||
| 14 | 15 | ||
| 15 | #endif | 16 | #endif /* __NET_TC_MIR_H */ |
diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h index eb21689d759d..e6f6e15956f5 100644 --- a/include/net/tc_act/tc_pedit.h +++ b/include/net/tc_act/tc_pedit.h | |||
| @@ -3,12 +3,13 @@ | |||
| 3 | 3 | ||
| 4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
| 5 | 5 | ||
| 6 | struct tcf_pedit | 6 | struct tcf_pedit { |
| 7 | { | 7 | struct tcf_common common; |
| 8 | tca_gen(pedit); | 8 | unsigned char tcfp_nkeys; |
| 9 | unsigned char nkeys; | 9 | unsigned char tcfp_flags; |
| 10 | unsigned char flags; | 10 | struct tc_pedit_key *tcfp_keys; |
| 11 | struct tc_pedit_key *keys; | ||
| 12 | }; | 11 | }; |
| 12 | #define to_pedit(pc) \ | ||
| 13 | container_of(pc, struct tcf_pedit, common) | ||
| 13 | 14 | ||
| 14 | #endif | 15 | #endif /* __NET_TC_PED_H */ |
diff --git a/include/net/tcp.h b/include/net/tcp.h index ca3d38dfc00b..7a093d0aa0fe 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -751,7 +751,7 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | |||
| 751 | if (in_flight >= tp->snd_cwnd) | 751 | if (in_flight >= tp->snd_cwnd) |
| 752 | return 1; | 752 | return 1; |
| 753 | 753 | ||
| 754 | if (!(sk->sk_route_caps & NETIF_F_TSO)) | 754 | if (!sk_can_gso(sk)) |
| 755 | return 0; | 755 | return 0; |
| 756 | 756 | ||
| 757 | left = tp->snd_cwnd - in_flight; | 757 | left = tp->snd_cwnd - in_flight; |
| @@ -914,6 +914,9 @@ static inline void tcp_set_state(struct sock *sk, int state) | |||
| 914 | 914 | ||
| 915 | static inline void tcp_done(struct sock *sk) | 915 | static inline void tcp_done(struct sock *sk) |
| 916 | { | 916 | { |
| 917 | if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) | ||
| 918 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
| 919 | |||
| 917 | tcp_set_state(sk, TCP_CLOSE); | 920 | tcp_set_state(sk, TCP_CLOSE); |
| 918 | tcp_clear_xmit_timers(sk); | 921 | tcp_clear_xmit_timers(sk); |
| 919 | 922 | ||
| @@ -1086,7 +1089,8 @@ extern struct request_sock_ops tcp_request_sock_ops; | |||
| 1086 | 1089 | ||
| 1087 | extern int tcp_v4_destroy_sock(struct sock *sk); | 1090 | extern int tcp_v4_destroy_sock(struct sock *sk); |
| 1088 | 1091 | ||
| 1089 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg); | 1092 | extern int tcp_v4_gso_send_check(struct sk_buff *skb); |
| 1093 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); | ||
| 1090 | 1094 | ||
| 1091 | #ifdef CONFIG_PROC_FS | 1095 | #ifdef CONFIG_PROC_FS |
| 1092 | extern int tcp4_proc_init(void); | 1096 | extern int tcp4_proc_init(void); |
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index c6b84397448d..4629d77173f2 100644 --- a/include/net/tcp_ecn.h +++ b/include/net/tcp_ecn.h | |||
| @@ -31,10 +31,9 @@ static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp, | |||
| 31 | struct sk_buff *skb) | 31 | struct sk_buff *skb) |
| 32 | { | 32 | { |
| 33 | tp->ecn_flags = 0; | 33 | tp->ecn_flags = 0; |
| 34 | if (sysctl_tcp_ecn && !(sk->sk_route_caps & NETIF_F_TSO)) { | 34 | if (sysctl_tcp_ecn) { |
| 35 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; | 35 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; |
| 36 | tp->ecn_flags = TCP_ECN_OK; | 36 | tp->ecn_flags = TCP_ECN_OK; |
| 37 | sock_set_flag(sk, SOCK_NO_LARGESEND); | ||
| 38 | } | 37 | } |
| 39 | } | 38 | } |
| 40 | 39 | ||
| @@ -56,6 +55,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
| 56 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { | 55 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { |
| 57 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; | 56 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; |
| 58 | skb->h.th->cwr = 1; | 57 | skb->h.th->cwr = 1; |
| 58 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | ||
| 59 | } | 59 | } |
| 60 | } else { | 60 | } else { |
| 61 | /* ACK or retransmitted segment: clear ECT|CE */ | 61 | /* ACK or retransmitted segment: clear ECT|CE */ |
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h index 098607cd4b78..e07136d74c2f 100644 --- a/include/net/tipc/tipc_bearer.h +++ b/include/net/tipc/tipc_bearer.h | |||
| @@ -49,10 +49,18 @@ | |||
| 49 | 49 | ||
| 50 | #define TIPC_MEDIA_TYPE_ETH 1 | 50 | #define TIPC_MEDIA_TYPE_ETH 1 |
| 51 | 51 | ||
| 52 | /* | ||
| 53 | * Destination address structure used by TIPC bearers when sending messages | ||
| 54 | * | ||
| 55 | * IMPORTANT: The fields of this structure MUST be stored using the specified | ||
| 56 | * byte order indicated below, as the structure is exchanged between nodes | ||
| 57 | * as part of a link setup process. | ||
| 58 | */ | ||
| 59 | |||
| 52 | struct tipc_media_addr { | 60 | struct tipc_media_addr { |
| 53 | __u32 type; | 61 | __u32 type; /* bearer type (network byte order) */ |
| 54 | union { | 62 | union { |
| 55 | __u8 eth_addr[6]; /* Ethernet bearer */ | 63 | __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */ |
| 56 | #if 0 | 64 | #if 0 |
| 57 | /* Prototypes for other possible bearer types */ | 65 | /* Prototypes for other possible bearer types */ |
| 58 | 66 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index 766fba1369ce..db0c05f67546 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
| @@ -30,25 +30,9 @@ | |||
| 30 | 30 | ||
| 31 | #define UDP_HTABLE_SIZE 128 | 31 | #define UDP_HTABLE_SIZE 128 |
| 32 | 32 | ||
| 33 | /* udp.c: This needs to be shared by v4 and v6 because the lookup | ||
| 34 | * and hashing code needs to work with different AF's yet | ||
| 35 | * the port space is shared. | ||
| 36 | */ | ||
| 37 | extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; | 33 | extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; |
| 38 | extern rwlock_t udp_hash_lock; | 34 | extern rwlock_t udp_hash_lock; |
| 39 | 35 | ||
| 40 | extern int udp_port_rover; | ||
| 41 | |||
| 42 | static inline int udp_lport_inuse(u16 num) | ||
| 43 | { | ||
| 44 | struct sock *sk; | ||
| 45 | struct hlist_node *node; | ||
| 46 | |||
| 47 | sk_for_each(sk, node, &udp_hash[num & (UDP_HTABLE_SIZE - 1)]) | ||
| 48 | if (inet_sk(sk)->num == num) | ||
| 49 | return 1; | ||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | 36 | ||
| 53 | /* Note: this must match 'valbool' in sock_setsockopt */ | 37 | /* Note: this must match 'valbool' in sock_setsockopt */ |
| 54 | #define UDP_CSUM_NOXMIT 1 | 38 | #define UDP_CSUM_NOXMIT 1 |
| @@ -63,6 +47,8 @@ extern struct proto udp_prot; | |||
| 63 | 47 | ||
| 64 | struct sk_buff; | 48 | struct sk_buff; |
| 65 | 49 | ||
| 50 | extern int udp_get_port(struct sock *sk, unsigned short snum, | ||
| 51 | int (*saddr_cmp)(const struct sock *, const struct sock *)); | ||
| 66 | extern void udp_err(struct sk_buff *, u32); | 52 | extern void udp_err(struct sk_buff *, u32); |
| 67 | 53 | ||
| 68 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, | 54 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 9c5ee9f20b65..1e2a4ddec96e 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -8,8 +8,8 @@ | |||
| 8 | #include <linux/list.h> | 8 | #include <linux/list.h> |
| 9 | #include <linux/skbuff.h> | 9 | #include <linux/skbuff.h> |
| 10 | #include <linux/socket.h> | 10 | #include <linux/socket.h> |
| 11 | #include <linux/crypto.h> | ||
| 12 | #include <linux/pfkeyv2.h> | 11 | #include <linux/pfkeyv2.h> |
| 12 | #include <linux/ipsec.h> | ||
| 13 | #include <linux/in6.h> | 13 | #include <linux/in6.h> |
| 14 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
| 15 | 15 | ||
| @@ -94,8 +94,9 @@ extern struct mutex xfrm_cfg_mutex; | |||
| 94 | struct xfrm_state | 94 | struct xfrm_state |
| 95 | { | 95 | { |
| 96 | /* Note: bydst is re-used during gc */ | 96 | /* Note: bydst is re-used during gc */ |
| 97 | struct list_head bydst; | 97 | struct hlist_node bydst; |
| 98 | struct list_head byspi; | 98 | struct hlist_node bysrc; |
| 99 | struct hlist_node byspi; | ||
| 99 | 100 | ||
| 100 | atomic_t refcnt; | 101 | atomic_t refcnt; |
| 101 | spinlock_t lock; | 102 | spinlock_t lock; |
| @@ -103,6 +104,8 @@ struct xfrm_state | |||
| 103 | struct xfrm_id id; | 104 | struct xfrm_id id; |
| 104 | struct xfrm_selector sel; | 105 | struct xfrm_selector sel; |
| 105 | 106 | ||
| 107 | u32 genid; | ||
| 108 | |||
| 106 | /* Key manger bits */ | 109 | /* Key manger bits */ |
| 107 | struct { | 110 | struct { |
| 108 | u8 state; | 111 | u8 state; |
| @@ -133,6 +136,9 @@ struct xfrm_state | |||
| 133 | /* Data for encapsulator */ | 136 | /* Data for encapsulator */ |
| 134 | struct xfrm_encap_tmpl *encap; | 137 | struct xfrm_encap_tmpl *encap; |
| 135 | 138 | ||
| 139 | /* Data for care-of address */ | ||
| 140 | xfrm_address_t *coaddr; | ||
| 141 | |||
| 136 | /* IPComp needs an IPIP tunnel for handling uncompressed packets */ | 142 | /* IPComp needs an IPIP tunnel for handling uncompressed packets */ |
| 137 | struct xfrm_state *tunnel; | 143 | struct xfrm_state *tunnel; |
| 138 | 144 | ||
| @@ -163,6 +169,9 @@ struct xfrm_state | |||
| 163 | struct xfrm_lifetime_cur curlft; | 169 | struct xfrm_lifetime_cur curlft; |
| 164 | struct timer_list timer; | 170 | struct timer_list timer; |
| 165 | 171 | ||
| 172 | /* Last used time */ | ||
| 173 | u64 lastused; | ||
| 174 | |||
| 166 | /* Reference to data common to all the instances of this | 175 | /* Reference to data common to all the instances of this |
| 167 | * transformer. */ | 176 | * transformer. */ |
| 168 | struct xfrm_type *type; | 177 | struct xfrm_type *type; |
| @@ -196,6 +205,7 @@ struct km_event | |||
| 196 | u32 proto; | 205 | u32 proto; |
| 197 | u32 byid; | 206 | u32 byid; |
| 198 | u32 aevent; | 207 | u32 aevent; |
| 208 | u32 type; | ||
| 199 | } data; | 209 | } data; |
| 200 | 210 | ||
| 201 | u32 seq; | 211 | u32 seq; |
| @@ -212,6 +222,7 @@ struct xfrm_policy_afinfo { | |||
| 212 | struct dst_ops *dst_ops; | 222 | struct dst_ops *dst_ops; |
| 213 | void (*garbage_collect)(void); | 223 | void (*garbage_collect)(void); |
| 214 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); | 224 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); |
| 225 | int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); | ||
| 215 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); | 226 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); |
| 216 | int (*bundle_create)(struct xfrm_policy *policy, | 227 | int (*bundle_create)(struct xfrm_policy *policy, |
| 217 | struct xfrm_state **xfrm, | 228 | struct xfrm_state **xfrm, |
| @@ -235,16 +246,12 @@ extern int __xfrm_state_delete(struct xfrm_state *x); | |||
| 235 | 246 | ||
| 236 | struct xfrm_state_afinfo { | 247 | struct xfrm_state_afinfo { |
| 237 | unsigned short family; | 248 | unsigned short family; |
| 238 | struct list_head *state_bydst; | ||
| 239 | struct list_head *state_byspi; | ||
| 240 | int (*init_flags)(struct xfrm_state *x); | 249 | int (*init_flags)(struct xfrm_state *x); |
| 241 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, | 250 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, |
| 242 | struct xfrm_tmpl *tmpl, | 251 | struct xfrm_tmpl *tmpl, |
| 243 | xfrm_address_t *daddr, xfrm_address_t *saddr); | 252 | xfrm_address_t *daddr, xfrm_address_t *saddr); |
| 244 | struct xfrm_state *(*state_lookup)(xfrm_address_t *daddr, u32 spi, u8 proto); | 253 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
| 245 | struct xfrm_state *(*find_acq)(u8 mode, u32 reqid, u8 proto, | 254 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
| 246 | xfrm_address_t *daddr, xfrm_address_t *saddr, | ||
| 247 | int create); | ||
| 248 | }; | 255 | }; |
| 249 | 256 | ||
| 250 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); | 257 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); |
| @@ -257,11 +264,17 @@ struct xfrm_type | |||
| 257 | char *description; | 264 | char *description; |
| 258 | struct module *owner; | 265 | struct module *owner; |
| 259 | __u8 proto; | 266 | __u8 proto; |
| 267 | __u8 flags; | ||
| 268 | #define XFRM_TYPE_NON_FRAGMENT 1 | ||
| 260 | 269 | ||
| 261 | int (*init_state)(struct xfrm_state *x); | 270 | int (*init_state)(struct xfrm_state *x); |
| 262 | void (*destructor)(struct xfrm_state *); | 271 | void (*destructor)(struct xfrm_state *); |
| 263 | int (*input)(struct xfrm_state *, struct sk_buff *skb); | 272 | int (*input)(struct xfrm_state *, struct sk_buff *skb); |
| 264 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); | 273 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); |
| 274 | int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); | ||
| 275 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); | ||
| 276 | xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); | ||
| 277 | xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); | ||
| 265 | /* Estimate maximal size of result of transformation of a dgram */ | 278 | /* Estimate maximal size of result of transformation of a dgram */ |
| 266 | u32 (*get_max_size)(struct xfrm_state *, int size); | 279 | u32 (*get_max_size)(struct xfrm_state *, int size); |
| 267 | }; | 280 | }; |
| @@ -273,7 +286,7 @@ extern void xfrm_put_type(struct xfrm_type *type); | |||
| 273 | 286 | ||
| 274 | struct xfrm_mode { | 287 | struct xfrm_mode { |
| 275 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); | 288 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); |
| 276 | int (*output)(struct sk_buff *skb); | 289 | int (*output)(struct xfrm_state *x,struct sk_buff *skb); |
| 277 | 290 | ||
| 278 | struct module *owner; | 291 | struct module *owner; |
| 279 | unsigned int encap; | 292 | unsigned int encap; |
| @@ -299,7 +312,7 @@ struct xfrm_tmpl | |||
| 299 | 312 | ||
| 300 | __u32 reqid; | 313 | __u32 reqid; |
| 301 | 314 | ||
| 302 | /* Mode: transport/tunnel */ | 315 | /* Mode: transport, tunnel etc. */ |
| 303 | __u8 mode; | 316 | __u8 mode; |
| 304 | 317 | ||
| 305 | /* Sharing mode: unique, this session only, this user only etc. */ | 318 | /* Sharing mode: unique, this session only, this user only etc. */ |
| @@ -314,18 +327,20 @@ struct xfrm_tmpl | |||
| 314 | __u32 calgos; | 327 | __u32 calgos; |
| 315 | }; | 328 | }; |
| 316 | 329 | ||
| 317 | #define XFRM_MAX_DEPTH 4 | 330 | #define XFRM_MAX_DEPTH 6 |
| 318 | 331 | ||
| 319 | struct xfrm_policy | 332 | struct xfrm_policy |
| 320 | { | 333 | { |
| 321 | struct xfrm_policy *next; | 334 | struct xfrm_policy *next; |
| 322 | struct list_head list; | 335 | struct hlist_node bydst; |
| 336 | struct hlist_node byidx; | ||
| 323 | 337 | ||
| 324 | /* This lock only affects elements except for entry. */ | 338 | /* This lock only affects elements except for entry. */ |
| 325 | rwlock_t lock; | 339 | rwlock_t lock; |
| 326 | atomic_t refcnt; | 340 | atomic_t refcnt; |
| 327 | struct timer_list timer; | 341 | struct timer_list timer; |
| 328 | 342 | ||
| 343 | u8 type; | ||
| 329 | u32 priority; | 344 | u32 priority; |
| 330 | u32 index; | 345 | u32 index; |
| 331 | struct xfrm_selector selector; | 346 | struct xfrm_selector selector; |
| @@ -363,16 +378,16 @@ struct xfrm_mgr | |||
| 363 | char *id; | 378 | char *id; |
| 364 | int (*notify)(struct xfrm_state *x, struct km_event *c); | 379 | int (*notify)(struct xfrm_state *x, struct km_event *c); |
| 365 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); | 380 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); |
| 366 | struct xfrm_policy *(*compile_policy)(u16 family, int opt, u8 *data, int len, int *dir); | 381 | struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); |
| 367 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); | 382 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); |
| 368 | int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); | 383 | int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); |
| 384 | int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); | ||
| 369 | }; | 385 | }; |
| 370 | 386 | ||
| 371 | extern int xfrm_register_km(struct xfrm_mgr *km); | 387 | extern int xfrm_register_km(struct xfrm_mgr *km); |
| 372 | extern int xfrm_unregister_km(struct xfrm_mgr *km); | 388 | extern int xfrm_unregister_km(struct xfrm_mgr *km); |
| 373 | 389 | ||
| 374 | 390 | extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2]; | |
| 375 | extern struct xfrm_policy *xfrm_policy_list[XFRM_POLICY_MAX*2]; | ||
| 376 | 391 | ||
| 377 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) | 392 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) |
| 378 | { | 393 | { |
| @@ -388,67 +403,19 @@ static inline void xfrm_pol_put(struct xfrm_policy *policy) | |||
| 388 | __xfrm_policy_destroy(policy); | 403 | __xfrm_policy_destroy(policy); |
| 389 | } | 404 | } |
| 390 | 405 | ||
| 391 | #define XFRM_DST_HSIZE 1024 | 406 | #ifdef CONFIG_XFRM_SUB_POLICY |
| 392 | 407 | static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) | |
| 393 | static __inline__ | ||
| 394 | unsigned __xfrm4_dst_hash(xfrm_address_t *addr) | ||
| 395 | { | ||
| 396 | unsigned h; | ||
| 397 | h = ntohl(addr->a4); | ||
| 398 | h = (h ^ (h>>16)) % XFRM_DST_HSIZE; | ||
| 399 | return h; | ||
| 400 | } | ||
| 401 | |||
| 402 | static __inline__ | ||
| 403 | unsigned __xfrm6_dst_hash(xfrm_address_t *addr) | ||
| 404 | { | ||
| 405 | unsigned h; | ||
| 406 | h = ntohl(addr->a6[2]^addr->a6[3]); | ||
| 407 | h = (h ^ (h>>16)) % XFRM_DST_HSIZE; | ||
| 408 | return h; | ||
| 409 | } | ||
| 410 | |||
| 411 | static __inline__ | ||
| 412 | unsigned xfrm_dst_hash(xfrm_address_t *addr, unsigned short family) | ||
| 413 | { | ||
| 414 | switch (family) { | ||
| 415 | case AF_INET: | ||
| 416 | return __xfrm4_dst_hash(addr); | ||
| 417 | case AF_INET6: | ||
| 418 | return __xfrm6_dst_hash(addr); | ||
| 419 | } | ||
| 420 | return 0; | ||
| 421 | } | ||
| 422 | |||
| 423 | static __inline__ | ||
| 424 | unsigned __xfrm4_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto) | ||
| 425 | { | 408 | { |
| 426 | unsigned h; | 409 | int i; |
| 427 | h = ntohl(addr->a4^spi^proto); | 410 | for (i = npols - 1; i >= 0; --i) |
| 428 | h = (h ^ (h>>10) ^ (h>>20)) % XFRM_DST_HSIZE; | 411 | xfrm_pol_put(pols[i]); |
| 429 | return h; | ||
| 430 | } | 412 | } |
| 431 | 413 | #else | |
| 432 | static __inline__ | 414 | static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) |
| 433 | unsigned __xfrm6_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto) | ||
| 434 | { | ||
| 435 | unsigned h; | ||
| 436 | h = ntohl(addr->a6[2]^addr->a6[3]^spi^proto); | ||
| 437 | h = (h ^ (h>>10) ^ (h>>20)) % XFRM_DST_HSIZE; | ||
| 438 | return h; | ||
| 439 | } | ||
| 440 | |||
| 441 | static __inline__ | ||
| 442 | unsigned xfrm_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto, unsigned short family) | ||
| 443 | { | 415 | { |
| 444 | switch (family) { | 416 | xfrm_pol_put(pols[0]); |
| 445 | case AF_INET: | ||
| 446 | return __xfrm4_spi_hash(addr, spi, proto); | ||
| 447 | case AF_INET6: | ||
| 448 | return __xfrm6_spi_hash(addr, spi, proto); | ||
| 449 | } | ||
| 450 | return 0; /*XXX*/ | ||
| 451 | } | 417 | } |
| 418 | #endif | ||
| 452 | 419 | ||
| 453 | extern void __xfrm_state_destroy(struct xfrm_state *); | 420 | extern void __xfrm_state_destroy(struct xfrm_state *); |
| 454 | 421 | ||
| @@ -470,8 +437,8 @@ static inline void xfrm_state_hold(struct xfrm_state *x) | |||
| 470 | 437 | ||
| 471 | static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | 438 | static __inline__ int addr_match(void *token1, void *token2, int prefixlen) |
| 472 | { | 439 | { |
| 473 | __u32 *a1 = token1; | 440 | __be32 *a1 = token1; |
| 474 | __u32 *a2 = token2; | 441 | __be32 *a2 = token2; |
| 475 | int pdw; | 442 | int pdw; |
| 476 | int pbi; | 443 | int pbi; |
| 477 | 444 | ||
| @@ -483,7 +450,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |||
| 483 | return 0; | 450 | return 0; |
| 484 | 451 | ||
| 485 | if (pbi) { | 452 | if (pbi) { |
| 486 | __u32 mask; | 453 | __be32 mask; |
| 487 | 454 | ||
| 488 | mask = htonl((0xffffffff) << (32 - pbi)); | 455 | mask = htonl((0xffffffff) << (32 - pbi)); |
| 489 | 456 | ||
| @@ -495,9 +462,9 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |||
| 495 | } | 462 | } |
| 496 | 463 | ||
| 497 | static __inline__ | 464 | static __inline__ |
| 498 | u16 xfrm_flowi_sport(struct flowi *fl) | 465 | __be16 xfrm_flowi_sport(struct flowi *fl) |
| 499 | { | 466 | { |
| 500 | u16 port; | 467 | __be16 port; |
| 501 | switch(fl->proto) { | 468 | switch(fl->proto) { |
| 502 | case IPPROTO_TCP: | 469 | case IPPROTO_TCP: |
| 503 | case IPPROTO_UDP: | 470 | case IPPROTO_UDP: |
| @@ -508,6 +475,11 @@ u16 xfrm_flowi_sport(struct flowi *fl) | |||
| 508 | case IPPROTO_ICMPV6: | 475 | case IPPROTO_ICMPV6: |
| 509 | port = htons(fl->fl_icmp_type); | 476 | port = htons(fl->fl_icmp_type); |
| 510 | break; | 477 | break; |
| 478 | #ifdef CONFIG_IPV6_MIP6 | ||
| 479 | case IPPROTO_MH: | ||
| 480 | port = htons(fl->fl_mh_type); | ||
| 481 | break; | ||
| 482 | #endif | ||
| 511 | default: | 483 | default: |
| 512 | port = 0; /*XXX*/ | 484 | port = 0; /*XXX*/ |
| 513 | } | 485 | } |
| @@ -515,9 +487,9 @@ u16 xfrm_flowi_sport(struct flowi *fl) | |||
| 515 | } | 487 | } |
| 516 | 488 | ||
| 517 | static __inline__ | 489 | static __inline__ |
| 518 | u16 xfrm_flowi_dport(struct flowi *fl) | 490 | __be16 xfrm_flowi_dport(struct flowi *fl) |
| 519 | { | 491 | { |
| 520 | u16 port; | 492 | __be16 port; |
| 521 | switch(fl->proto) { | 493 | switch(fl->proto) { |
| 522 | case IPPROTO_TCP: | 494 | case IPPROTO_TCP: |
| 523 | case IPPROTO_UDP: | 495 | case IPPROTO_UDP: |
| @@ -608,6 +580,7 @@ struct xfrm_dst | |||
| 608 | struct rt6_info rt6; | 580 | struct rt6_info rt6; |
| 609 | } u; | 581 | } u; |
| 610 | struct dst_entry *route; | 582 | struct dst_entry *route; |
| 583 | u32 genid; | ||
| 611 | u32 route_mtu_cached; | 584 | u32 route_mtu_cached; |
| 612 | u32 child_mtu_cached; | 585 | u32 child_mtu_cached; |
| 613 | u32 route_cookie; | 586 | u32 route_cookie; |
| @@ -659,6 +632,18 @@ secpath_reset(struct sk_buff *skb) | |||
| 659 | } | 632 | } |
| 660 | 633 | ||
| 661 | static inline int | 634 | static inline int |
| 635 | xfrm_addr_any(xfrm_address_t *addr, unsigned short family) | ||
| 636 | { | ||
| 637 | switch (family) { | ||
| 638 | case AF_INET: | ||
| 639 | return addr->a4 == 0; | ||
| 640 | case AF_INET6: | ||
| 641 | return ipv6_addr_any((struct in6_addr *)&addr->a6); | ||
| 642 | } | ||
| 643 | return 0; | ||
| 644 | } | ||
| 645 | |||
| 646 | static inline int | ||
| 662 | __xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) | 647 | __xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) |
| 663 | { | 648 | { |
| 664 | return (tmpl->saddr.a4 && | 649 | return (tmpl->saddr.a4 && |
| @@ -692,8 +677,8 @@ static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *sk | |||
| 692 | { | 677 | { |
| 693 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) | 678 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) |
| 694 | return __xfrm_policy_check(sk, dir, skb, family); | 679 | return __xfrm_policy_check(sk, dir, skb, family); |
| 695 | 680 | ||
| 696 | return (!xfrm_policy_list[dir] && !skb->sp) || | 681 | return (!xfrm_policy_count[dir] && !skb->sp) || |
| 697 | (skb->dst->flags & DST_NOPOLICY) || | 682 | (skb->dst->flags & DST_NOPOLICY) || |
| 698 | __xfrm_policy_check(sk, dir, skb, family); | 683 | __xfrm_policy_check(sk, dir, skb, family); |
| 699 | } | 684 | } |
| @@ -713,7 +698,7 @@ extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); | |||
| 713 | 698 | ||
| 714 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) | 699 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) |
| 715 | { | 700 | { |
| 716 | return !xfrm_policy_list[XFRM_POLICY_OUT] || | 701 | return !xfrm_policy_count[XFRM_POLICY_OUT] || |
| 717 | (skb->dst->flags & DST_NOXFRM) || | 702 | (skb->dst->flags & DST_NOXFRM) || |
| 718 | __xfrm_route_forward(skb, family); | 703 | __xfrm_route_forward(skb, family); |
| 719 | } | 704 | } |
| @@ -831,11 +816,36 @@ xfrm_state_addr_check(struct xfrm_state *x, | |||
| 831 | return 0; | 816 | return 0; |
| 832 | } | 817 | } |
| 833 | 818 | ||
| 819 | static __inline__ int | ||
| 820 | xfrm_state_addr_flow_check(struct xfrm_state *x, struct flowi *fl, | ||
| 821 | unsigned short family) | ||
| 822 | { | ||
| 823 | switch (family) { | ||
| 824 | case AF_INET: | ||
| 825 | return __xfrm4_state_addr_check(x, | ||
| 826 | (xfrm_address_t *)&fl->fl4_dst, | ||
| 827 | (xfrm_address_t *)&fl->fl4_src); | ||
| 828 | case AF_INET6: | ||
| 829 | return __xfrm6_state_addr_check(x, | ||
| 830 | (xfrm_address_t *)&fl->fl6_dst, | ||
| 831 | (xfrm_address_t *)&fl->fl6_src); | ||
| 832 | } | ||
| 833 | return 0; | ||
| 834 | } | ||
| 835 | |||
| 834 | static inline int xfrm_state_kern(struct xfrm_state *x) | 836 | static inline int xfrm_state_kern(struct xfrm_state *x) |
| 835 | { | 837 | { |
| 836 | return atomic_read(&x->tunnel_users); | 838 | return atomic_read(&x->tunnel_users); |
| 837 | } | 839 | } |
| 838 | 840 | ||
| 841 | static inline int xfrm_id_proto_match(u8 proto, u8 userproto) | ||
| 842 | { | ||
| 843 | return (!userproto || proto == userproto || | ||
| 844 | (userproto == IPSEC_PROTO_ANY && (proto == IPPROTO_AH || | ||
| 845 | proto == IPPROTO_ESP || | ||
| 846 | proto == IPPROTO_COMP))); | ||
| 847 | } | ||
| 848 | |||
| 839 | /* | 849 | /* |
| 840 | * xfrm algorithm information | 850 | * xfrm algorithm information |
| 841 | */ | 851 | */ |
| @@ -855,6 +865,7 @@ struct xfrm_algo_comp_info { | |||
| 855 | 865 | ||
| 856 | struct xfrm_algo_desc { | 866 | struct xfrm_algo_desc { |
| 857 | char *name; | 867 | char *name; |
| 868 | char *compat; | ||
| 858 | u8 available:1; | 869 | u8 available:1; |
| 859 | union { | 870 | union { |
| 860 | struct xfrm_algo_auth_info auth; | 871 | struct xfrm_algo_auth_info auth; |
| @@ -901,12 +912,31 @@ extern int xfrm_state_check_expire(struct xfrm_state *x); | |||
| 901 | extern void xfrm_state_insert(struct xfrm_state *x); | 912 | extern void xfrm_state_insert(struct xfrm_state *x); |
| 902 | extern int xfrm_state_add(struct xfrm_state *x); | 913 | extern int xfrm_state_add(struct xfrm_state *x); |
| 903 | extern int xfrm_state_update(struct xfrm_state *x); | 914 | extern int xfrm_state_update(struct xfrm_state *x); |
| 904 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); | 915 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); |
| 916 | extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); | ||
| 917 | #ifdef CONFIG_XFRM_SUB_POLICY | ||
| 918 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | ||
| 919 | int n, unsigned short family); | ||
| 920 | extern int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, | ||
| 921 | int n, unsigned short family); | ||
| 922 | #else | ||
| 923 | static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | ||
| 924 | int n, unsigned short family) | ||
| 925 | { | ||
| 926 | return -ENOSYS; | ||
| 927 | } | ||
| 928 | |||
| 929 | static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, | ||
| 930 | int n, unsigned short family) | ||
| 931 | { | ||
| 932 | return -ENOSYS; | ||
| 933 | } | ||
| 934 | #endif | ||
| 905 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | 935 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); |
| 906 | extern int xfrm_state_delete(struct xfrm_state *x); | 936 | extern int xfrm_state_delete(struct xfrm_state *x); |
| 907 | extern void xfrm_state_flush(u8 proto); | 937 | extern void xfrm_state_flush(u8 proto); |
| 908 | extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); | 938 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); |
| 909 | extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); | 939 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
| 910 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); | 940 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); |
| 911 | extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); | 941 | extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); |
| 912 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | 942 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); |
| @@ -915,14 +945,18 @@ extern int xfrm4_rcv(struct sk_buff *skb); | |||
| 915 | extern int xfrm4_output(struct sk_buff *skb); | 945 | extern int xfrm4_output(struct sk_buff *skb); |
| 916 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); | 946 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); |
| 917 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); | 947 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); |
| 918 | extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi); | 948 | extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi); |
| 919 | extern int xfrm6_rcv(struct sk_buff **pskb); | 949 | extern int xfrm6_rcv(struct sk_buff **pskb); |
| 950 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | ||
| 951 | xfrm_address_t *saddr, u8 proto); | ||
| 920 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); | 952 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); |
| 921 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); | 953 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); |
| 922 | extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | 954 | extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); |
| 923 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | 955 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); |
| 924 | extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | 956 | extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); |
| 925 | extern int xfrm6_output(struct sk_buff *skb); | 957 | extern int xfrm6_output(struct sk_buff *skb); |
| 958 | extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | ||
| 959 | u8 **prevhdr); | ||
| 926 | 960 | ||
| 927 | #ifdef CONFIG_XFRM | 961 | #ifdef CONFIG_XFRM |
| 928 | extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type); | 962 | extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type); |
| @@ -947,30 +981,30 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig | |||
| 947 | #endif | 981 | #endif |
| 948 | 982 | ||
| 949 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); | 983 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); |
| 950 | extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); | 984 | extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int, void*), void *); |
| 951 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | 985 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); |
| 952 | struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel, | 986 | struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, |
| 987 | struct xfrm_selector *sel, | ||
| 953 | struct xfrm_sec_ctx *ctx, int delete); | 988 | struct xfrm_sec_ctx *ctx, int delete); |
| 954 | struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); | 989 | struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); |
| 955 | void xfrm_policy_flush(void); | 990 | void xfrm_policy_flush(u8 type); |
| 956 | u32 xfrm_get_acqseq(void); | 991 | u32 xfrm_get_acqseq(void); |
| 957 | void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | 992 | void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi); |
| 958 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, | 993 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, |
| 959 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 994 | xfrm_address_t *daddr, xfrm_address_t *saddr, |
| 960 | int create, unsigned short family); | 995 | int create, unsigned short family); |
| 961 | extern void xfrm_policy_flush(void); | 996 | extern void xfrm_policy_flush(u8 type); |
| 962 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 997 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
| 963 | extern int xfrm_flush_bundles(void); | 998 | extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family, int strict); |
| 964 | extern void xfrm_flush_all_bundles(void); | ||
| 965 | extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family); | ||
| 966 | extern void xfrm_init_pmtu(struct dst_entry *dst); | 999 | extern void xfrm_init_pmtu(struct dst_entry *dst); |
| 967 | 1000 | ||
| 968 | extern wait_queue_head_t km_waitq; | 1001 | extern wait_queue_head_t km_waitq; |
| 969 | extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); | 1002 | extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); |
| 970 | extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); | 1003 | extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); |
| 1004 | extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); | ||
| 971 | 1005 | ||
| 972 | extern void xfrm_input_init(void); | 1006 | extern void xfrm_input_init(void); |
| 973 | extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq); | 1007 | extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); |
| 974 | 1008 | ||
| 975 | extern void xfrm_probe_algs(void); | 1009 | extern void xfrm_probe_algs(void); |
| 976 | extern int xfrm_count_auth_supported(void); | 1010 | extern int xfrm_count_auth_supported(void); |
| @@ -984,11 +1018,13 @@ extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe); | |||
| 984 | extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); | 1018 | extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); |
| 985 | extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); | 1019 | extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); |
| 986 | 1020 | ||
| 987 | struct crypto_tfm; | 1021 | struct hash_desc; |
| 988 | typedef void (icv_update_fn_t)(struct crypto_tfm *, struct scatterlist *, unsigned int); | 1022 | struct scatterlist; |
| 1023 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, | ||
| 1024 | unsigned int); | ||
| 989 | 1025 | ||
| 990 | extern void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm, | 1026 | extern int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *tfm, |
| 991 | int offset, int len, icv_update_fn_t icv_update); | 1027 | int offset, int len, icv_update_fn_t icv_update); |
| 992 | 1028 | ||
| 993 | static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, | 1029 | static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, |
| 994 | int family) | 1030 | int family) |
