diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-12 17:17:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-12 18:08:55 -0500 |
commit | bef55aebd560c5a6f8883c421abccee39978c58c (patch) | |
tree | b1adbe59af8817ee6ef3009fe8c296d3c87fc067 | |
parent | 1958b856c1a59c0f1e892b92debb8c9fe4f364dc (diff) |
decnet: Convert to use flowidn where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/dn.h | 6 | ||||
-rw-r--r-- | include/net/dn_fib.h | 8 | ||||
-rw-r--r-- | include/net/dn_route.h | 8 | ||||
-rw-r--r-- | include/net/flow.h | 12 | ||||
-rw-r--r-- | net/decnet/af_decnet.c | 16 | ||||
-rw-r--r-- | net/decnet/dn_fib.c | 23 | ||||
-rw-r--r-- | net/decnet/dn_nsp_out.c | 16 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 269 | ||||
-rw-r--r-- | net/decnet/dn_rules.c | 17 | ||||
-rw-r--r-- | net/decnet/dn_table.c | 6 |
10 files changed, 196 insertions, 185 deletions
diff --git a/include/net/dn.h b/include/net/dn.h index 558dc7f93fb3..298521e0d8a2 100644 --- a/include/net/dn.h +++ b/include/net/dn.h | |||
@@ -192,10 +192,10 @@ static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) | |||
192 | ethaddr[5] = (__u8)(a >> 8); | 192 | ethaddr[5] = (__u8)(a >> 8); |
193 | } | 193 | } |
194 | 194 | ||
195 | static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp) | 195 | static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp) |
196 | { | 196 | { |
197 | fl->u.dn.uli.ports.sport = scp->addrloc; | 197 | fld->fld_sport = scp->addrloc; |
198 | fl->u.dn.uli.ports.dport = scp->addrrem; | 198 | fld->fld_dport = scp->addrrem; |
199 | } | 199 | } |
200 | 200 | ||
201 | extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); | 201 | extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); |
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index bbcde3238e58..782ef7cb4930 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
@@ -98,7 +98,7 @@ struct dn_fib_table { | |||
98 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, | 98 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, |
99 | struct dn_kern_rta *rta, struct nlmsghdr *n, | 99 | struct dn_kern_rta *rta, struct nlmsghdr *n, |
100 | struct netlink_skb_parms *req); | 100 | struct netlink_skb_parms *req); |
101 | int (*lookup)(struct dn_fib_table *t, const struct flowi *fl, | 101 | int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld, |
102 | struct dn_fib_res *res); | 102 | struct dn_fib_res *res); |
103 | int (*flush)(struct dn_fib_table *t); | 103 | int (*flush)(struct dn_fib_table *t); |
104 | int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); | 104 | int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); |
@@ -119,12 +119,12 @@ extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, | |||
119 | struct dn_kern_rta *rta, | 119 | struct dn_kern_rta *rta, |
120 | const struct nlmsghdr *nlh, int *errp); | 120 | const struct nlmsghdr *nlh, int *errp); |
121 | extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, | 121 | extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, |
122 | const struct flowi *fl, | 122 | const struct flowidn *fld, |
123 | struct dn_fib_res *res); | 123 | struct dn_fib_res *res); |
124 | extern void dn_fib_release_info(struct dn_fib_info *fi); | 124 | extern void dn_fib_release_info(struct dn_fib_info *fi); |
125 | extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); | 125 | extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); |
126 | extern void dn_fib_flush(void); | 126 | extern void dn_fib_flush(void); |
127 | extern void dn_fib_select_multipath(const struct flowi *fl, | 127 | extern void dn_fib_select_multipath(const struct flowidn *fld, |
128 | struct dn_fib_res *res); | 128 | struct dn_fib_res *res); |
129 | 129 | ||
130 | /* | 130 | /* |
@@ -141,7 +141,7 @@ extern void dn_fib_table_cleanup(void); | |||
141 | extern void dn_fib_rules_init(void); | 141 | extern void dn_fib_rules_init(void); |
142 | extern void dn_fib_rules_cleanup(void); | 142 | extern void dn_fib_rules_cleanup(void); |
143 | extern unsigned dnet_addr_type(__le16 addr); | 143 | extern unsigned dnet_addr_type(__le16 addr); |
144 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); | 144 | extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res); |
145 | 145 | ||
146 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); | 146 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); |
147 | 147 | ||
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index 1f59005e4979..81712cfa1ddf 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
@@ -16,7 +16,7 @@ | |||
16 | *******************************************************************************/ | 16 | *******************************************************************************/ |
17 | 17 | ||
18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); | 18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); |
19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); | 19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowidn *, struct sock *sk, int flags); |
20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); | 20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); |
21 | extern void dn_rt_cache_flush(int delay); | 21 | extern void dn_rt_cache_flush(int delay); |
22 | 22 | ||
@@ -67,7 +67,7 @@ extern void dn_rt_cache_flush(int delay); | |||
67 | struct dn_route { | 67 | struct dn_route { |
68 | struct dst_entry dst; | 68 | struct dst_entry dst; |
69 | 69 | ||
70 | struct flowi fl; | 70 | struct flowidn fld; |
71 | 71 | ||
72 | __le16 rt_saddr; | 72 | __le16 rt_saddr; |
73 | __le16 rt_daddr; | 73 | __le16 rt_daddr; |
@@ -82,12 +82,12 @@ struct dn_route { | |||
82 | 82 | ||
83 | static inline bool dn_is_input_route(struct dn_route *rt) | 83 | static inline bool dn_is_input_route(struct dn_route *rt) |
84 | { | 84 | { |
85 | return rt->fl.flowi_iif != 0; | 85 | return rt->fld.flowidn_iif != 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | static inline bool dn_is_output_route(struct dn_route *rt) | 88 | static inline bool dn_is_output_route(struct dn_route *rt) |
89 | { | 89 | { |
90 | return rt->fl.flowi_iif == 0; | 90 | return rt->fld.flowidn_iif == 0; |
91 | } | 91 | } |
92 | 92 | ||
93 | extern void dn_route_init(void); | 93 | extern void dn_route_init(void); |
diff --git a/include/net/flow.h b/include/net/flow.h index 172d76dd8731..7fe5a0f9483a 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -95,9 +95,17 @@ struct flowi6 { | |||
95 | 95 | ||
96 | struct flowidn { | 96 | struct flowidn { |
97 | struct flowi_common __fl_common; | 97 | struct flowi_common __fl_common; |
98 | #define flowidn_oif __fl_common.flowic_oif | ||
99 | #define flowidn_iif __fl_common.flowic_iif | ||
100 | #define flowidn_mark __fl_common.flowic_mark | ||
101 | #define flowidn_scope __fl_common.flowic_scope | ||
102 | #define flowidn_proto __fl_common.flowic_proto | ||
103 | #define flowidn_flags __fl_common.flowic_flags | ||
98 | __le16 daddr; | 104 | __le16 daddr; |
99 | __le16 saddr; | 105 | __le16 saddr; |
100 | union flowi_uli uli; | 106 | union flowi_uli uli; |
107 | #define fld_sport uli.ports.sport | ||
108 | #define fld_dport uli.ports.dport | ||
101 | }; | 109 | }; |
102 | 110 | ||
103 | struct flowi { | 111 | struct flowi { |
@@ -115,10 +123,6 @@ struct flowi { | |||
115 | #define flowi_proto u.__fl_common.flowic_proto | 123 | #define flowi_proto u.__fl_common.flowic_proto |
116 | #define flowi_flags u.__fl_common.flowic_flags | 124 | #define flowi_flags u.__fl_common.flowic_flags |
117 | #define flowi_secid u.__fl_common.flowic_secid | 125 | #define flowi_secid u.__fl_common.flowic_secid |
118 | #define fld_scope flowi_scope | ||
119 | |||
120 | #define fld_dst u.dn.daddr | ||
121 | #define fld_src u.dn.saddr | ||
122 | } __attribute__((__aligned__(BITS_PER_LONG/8))); | 126 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
123 | 127 | ||
124 | static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4) | 128 | static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4) |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index aafd15a01575..ea3b6ee21fc9 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -908,7 +908,7 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen, | |||
908 | struct socket *sock = sk->sk_socket; | 908 | struct socket *sock = sk->sk_socket; |
909 | struct dn_scp *scp = DN_SK(sk); | 909 | struct dn_scp *scp = DN_SK(sk); |
910 | int err = -EISCONN; | 910 | int err = -EISCONN; |
911 | struct flowi fl; | 911 | struct flowidn fld; |
912 | 912 | ||
913 | if (sock->state == SS_CONNECTED) | 913 | if (sock->state == SS_CONNECTED) |
914 | goto out; | 914 | goto out; |
@@ -947,13 +947,13 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen, | |||
947 | memcpy(&scp->peer, addr, sizeof(struct sockaddr_dn)); | 947 | memcpy(&scp->peer, addr, sizeof(struct sockaddr_dn)); |
948 | 948 | ||
949 | err = -EHOSTUNREACH; | 949 | err = -EHOSTUNREACH; |
950 | memset(&fl, 0, sizeof(fl)); | 950 | memset(&fld, 0, sizeof(fld)); |
951 | fl.flowi_oif = sk->sk_bound_dev_if; | 951 | fld.flowidn_oif = sk->sk_bound_dev_if; |
952 | fl.fld_dst = dn_saddr2dn(&scp->peer); | 952 | fld.daddr = dn_saddr2dn(&scp->peer); |
953 | fl.fld_src = dn_saddr2dn(&scp->addr); | 953 | fld.saddr = dn_saddr2dn(&scp->addr); |
954 | dn_sk_ports_copy(&fl, scp); | 954 | dn_sk_ports_copy(&fld, scp); |
955 | fl.flowi_proto = DNPROTO_NSP; | 955 | fld.flowidn_proto = DNPROTO_NSP; |
956 | if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, flags) < 0) | 956 | if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, flags) < 0) |
957 | goto out; | 957 | goto out; |
958 | sk->sk_route_caps = sk->sk_dst_cache->dev->features; | 958 | sk->sk_route_caps = sk->sk_dst_cache->dev->features; |
959 | sock->state = SS_CONNECTING; | 959 | sock->state = SS_CONNECTING; |
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index 4dfffa0b67a8..1c74ed36ce8f 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c | |||
@@ -201,7 +201,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct | |||
201 | int err; | 201 | int err; |
202 | 202 | ||
203 | if (nh->nh_gw) { | 203 | if (nh->nh_gw) { |
204 | struct flowi fl; | 204 | struct flowidn fld; |
205 | struct dn_fib_res res; | 205 | struct dn_fib_res res; |
206 | 206 | ||
207 | if (nh->nh_flags&RTNH_F_ONLINK) { | 207 | if (nh->nh_flags&RTNH_F_ONLINK) { |
@@ -221,15 +221,15 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct | |||
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | 223 | ||
224 | memset(&fl, 0, sizeof(fl)); | 224 | memset(&fld, 0, sizeof(fld)); |
225 | fl.fld_dst = nh->nh_gw; | 225 | fld.daddr = nh->nh_gw; |
226 | fl.flowi_oif = nh->nh_oif; | 226 | fld.flowidn_oif = nh->nh_oif; |
227 | fl.fld_scope = r->rtm_scope + 1; | 227 | fld.flowidn_scope = r->rtm_scope + 1; |
228 | 228 | ||
229 | if (fl.fld_scope < RT_SCOPE_LINK) | 229 | if (fld.flowidn_scope < RT_SCOPE_LINK) |
230 | fl.fld_scope = RT_SCOPE_LINK; | 230 | fld.flowidn_scope = RT_SCOPE_LINK; |
231 | 231 | ||
232 | if ((err = dn_fib_lookup(&fl, &res)) != 0) | 232 | if ((err = dn_fib_lookup(&fld, &res)) != 0) |
233 | return err; | 233 | return err; |
234 | 234 | ||
235 | err = -EINVAL; | 235 | err = -EINVAL; |
@@ -404,7 +404,7 @@ failure: | |||
404 | return NULL; | 404 | return NULL; |
405 | } | 405 | } |
406 | 406 | ||
407 | int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowi *fl, struct dn_fib_res *res) | 407 | int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowidn *fld, struct dn_fib_res *res) |
408 | { | 408 | { |
409 | int err = dn_fib_props[type].error; | 409 | int err = dn_fib_props[type].error; |
410 | 410 | ||
@@ -424,7 +424,8 @@ int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowi * | |||
424 | for_nexthops(fi) { | 424 | for_nexthops(fi) { |
425 | if (nh->nh_flags & RTNH_F_DEAD) | 425 | if (nh->nh_flags & RTNH_F_DEAD) |
426 | continue; | 426 | continue; |
427 | if (!fl->flowi_oif || fl->flowi_oif == nh->nh_oif) | 427 | if (!fld->flowidn_oif || |
428 | fld->flowidn_oif == nh->nh_oif) | ||
428 | break; | 429 | break; |
429 | } | 430 | } |
430 | if (nhsel < fi->fib_nhs) { | 431 | if (nhsel < fi->fib_nhs) { |
@@ -445,7 +446,7 @@ int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowi * | |||
445 | return err; | 446 | return err; |
446 | } | 447 | } |
447 | 448 | ||
448 | void dn_fib_select_multipath(const struct flowi *fl, struct dn_fib_res *res) | 449 | void dn_fib_select_multipath(const struct flowidn *fld, struct dn_fib_res *res) |
449 | { | 450 | { |
450 | struct dn_fib_info *fi = res->fi; | 451 | struct dn_fib_info *fi = res->fi; |
451 | int w; | 452 | int w; |
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index b3d66742a01f..bd78836a81eb 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c | |||
@@ -78,7 +78,7 @@ static void dn_nsp_send(struct sk_buff *skb) | |||
78 | struct sock *sk = skb->sk; | 78 | struct sock *sk = skb->sk; |
79 | struct dn_scp *scp = DN_SK(sk); | 79 | struct dn_scp *scp = DN_SK(sk); |
80 | struct dst_entry *dst; | 80 | struct dst_entry *dst; |
81 | struct flowi fl; | 81 | struct flowidn fld; |
82 | 82 | ||
83 | skb_reset_transport_header(skb); | 83 | skb_reset_transport_header(skb); |
84 | scp->stamp = jiffies; | 84 | scp->stamp = jiffies; |
@@ -91,13 +91,13 @@ try_again: | |||
91 | return; | 91 | return; |
92 | } | 92 | } |
93 | 93 | ||
94 | memset(&fl, 0, sizeof(fl)); | 94 | memset(&fld, 0, sizeof(fld)); |
95 | fl.flowi_oif = sk->sk_bound_dev_if; | 95 | fld.flowidn_oif = sk->sk_bound_dev_if; |
96 | fl.fld_src = dn_saddr2dn(&scp->addr); | 96 | fld.saddr = dn_saddr2dn(&scp->addr); |
97 | fl.fld_dst = dn_saddr2dn(&scp->peer); | 97 | fld.daddr = dn_saddr2dn(&scp->peer); |
98 | dn_sk_ports_copy(&fl, scp); | 98 | dn_sk_ports_copy(&fld, scp); |
99 | fl.flowi_proto = DNPROTO_NSP; | 99 | fld.flowidn_proto = DNPROTO_NSP; |
100 | if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, 0) == 0) { | 100 | if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, 0) == 0) { |
101 | dst = sk_dst_get(sk); | 101 | dst = sk_dst_get(sk); |
102 | sk->sk_route_caps = dst->dev->features; | 102 | sk->sk_route_caps = dst->dev->features; |
103 | goto try_again; | 103 | goto try_again; |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index d74d34b93f80..9f09d4fc2880 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -282,14 +282,14 @@ static void dn_dst_link_failure(struct sk_buff *skb) | |||
282 | { | 282 | { |
283 | } | 283 | } |
284 | 284 | ||
285 | static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) | 285 | static inline int compare_keys(struct flowidn *fl1, struct flowidn *fl2) |
286 | { | 286 | { |
287 | return ((fl1->fld_dst ^ fl2->fld_dst) | | 287 | return ((fl1->daddr ^ fl2->daddr) | |
288 | (fl1->fld_src ^ fl2->fld_src) | | 288 | (fl1->saddr ^ fl2->saddr) | |
289 | (fl1->flowi_mark ^ fl2->flowi_mark) | | 289 | (fl1->flowidn_mark ^ fl2->flowidn_mark) | |
290 | (fl1->fld_scope ^ fl2->fld_scope) | | 290 | (fl1->flowidn_scope ^ fl2->flowidn_scope) | |
291 | (fl1->flowi_oif ^ fl2->flowi_oif) | | 291 | (fl1->flowidn_oif ^ fl2->flowidn_oif) | |
292 | (fl1->flowi_iif ^ fl2->flowi_iif)) == 0; | 292 | (fl1->flowidn_iif ^ fl2->flowidn_iif)) == 0; |
293 | } | 293 | } |
294 | 294 | ||
295 | static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route **rp) | 295 | static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route **rp) |
@@ -303,7 +303,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route * | |||
303 | spin_lock_bh(&dn_rt_hash_table[hash].lock); | 303 | spin_lock_bh(&dn_rt_hash_table[hash].lock); |
304 | while ((rth = rcu_dereference_protected(*rthp, | 304 | while ((rth = rcu_dereference_protected(*rthp, |
305 | lockdep_is_held(&dn_rt_hash_table[hash].lock))) != NULL) { | 305 | lockdep_is_held(&dn_rt_hash_table[hash].lock))) != NULL) { |
306 | if (compare_keys(&rth->fl, &rt->fl)) { | 306 | if (compare_keys(&rth->fld, &rt->fld)) { |
307 | /* Put it first */ | 307 | /* Put it first */ |
308 | *rthp = rth->dst.dn_next; | 308 | *rthp = rth->dst.dn_next; |
309 | rcu_assign_pointer(rth->dst.dn_next, | 309 | rcu_assign_pointer(rth->dst.dn_next, |
@@ -903,15 +903,15 @@ static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_re | |||
903 | return (daddr&~mask)|res->fi->fib_nh->nh_gw; | 903 | return (daddr&~mask)|res->fi->fib_nh->nh_gw; |
904 | } | 904 | } |
905 | 905 | ||
906 | static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *oldflp, int try_hard) | 906 | static int dn_route_output_slow(struct dst_entry **pprt, const struct flowidn *oldflp, int try_hard) |
907 | { | 907 | { |
908 | struct flowi fl = { | 908 | struct flowidn fld = { |
909 | .fld_dst = oldflp->fld_dst, | 909 | .daddr = oldflp->daddr, |
910 | .fld_src = oldflp->fld_src, | 910 | .saddr = oldflp->saddr, |
911 | .fld_scope = RT_SCOPE_UNIVERSE, | 911 | .flowidn_scope = RT_SCOPE_UNIVERSE, |
912 | .flowi_mark = oldflp->flowi_mark, | 912 | .flowidn_mark = oldflp->flowidn_mark, |
913 | .flowi_iif = init_net.loopback_dev->ifindex, | 913 | .flowidn_iif = init_net.loopback_dev->ifindex, |
914 | .flowi_oif = oldflp->flowi_oif, | 914 | .flowidn_oif = oldflp->flowidn_oif, |
915 | }; | 915 | }; |
916 | struct dn_route *rt = NULL; | 916 | struct dn_route *rt = NULL; |
917 | struct net_device *dev_out = NULL, *dev; | 917 | struct net_device *dev_out = NULL, *dev; |
@@ -926,13 +926,14 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old | |||
926 | if (decnet_debug_level & 16) | 926 | if (decnet_debug_level & 16) |
927 | printk(KERN_DEBUG | 927 | printk(KERN_DEBUG |
928 | "dn_route_output_slow: dst=%04x src=%04x mark=%d" | 928 | "dn_route_output_slow: dst=%04x src=%04x mark=%d" |
929 | " iif=%d oif=%d\n", le16_to_cpu(oldflp->fld_dst), | 929 | " iif=%d oif=%d\n", le16_to_cpu(oldflp->daddr), |
930 | le16_to_cpu(oldflp->fld_src), | 930 | le16_to_cpu(oldflp->saddr), |
931 | oldflp->flowi_mark, init_net.loopback_dev->ifindex, oldflp->flowi_oif); | 931 | oldflp->flowidn_mark, init_net.loopback_dev->ifindex, |
932 | oldflp->flowidn_oif); | ||
932 | 933 | ||
933 | /* If we have an output interface, verify its a DECnet device */ | 934 | /* If we have an output interface, verify its a DECnet device */ |
934 | if (oldflp->flowi_oif) { | 935 | if (oldflp->flowidn_oif) { |
935 | dev_out = dev_get_by_index(&init_net, oldflp->flowi_oif); | 936 | dev_out = dev_get_by_index(&init_net, oldflp->flowidn_oif); |
936 | err = -ENODEV; | 937 | err = -ENODEV; |
937 | if (dev_out && dev_out->dn_ptr == NULL) { | 938 | if (dev_out && dev_out->dn_ptr == NULL) { |
938 | dev_put(dev_out); | 939 | dev_put(dev_out); |
@@ -943,11 +944,11 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old | |||
943 | } | 944 | } |
944 | 945 | ||
945 | /* If we have a source address, verify that its a local address */ | 946 | /* If we have a source address, verify that its a local address */ |
946 | if (oldflp->fld_src) { | 947 | if (oldflp->saddr) { |
947 | err = -EADDRNOTAVAIL; | 948 | err = -EADDRNOTAVAIL; |
948 | 949 | ||
949 | if (dev_out) { | 950 | if (dev_out) { |
950 | if (dn_dev_islocal(dev_out, oldflp->fld_src)) | 951 | if (dn_dev_islocal(dev_out, oldflp->saddr)) |
951 | goto source_ok; | 952 | goto source_ok; |
952 | dev_put(dev_out); | 953 | dev_put(dev_out); |
953 | goto out; | 954 | goto out; |
@@ -956,11 +957,11 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old | |||
956 | for_each_netdev_rcu(&init_net, dev) { | 957 | for_each_netdev_rcu(&init_net, dev) { |
957 | if (!dev->dn_ptr) | 958 | if (!dev->dn_ptr) |
958 | continue; | 959 | continue; |
959 | if (!dn_dev_islocal(dev, oldflp->fld_src)) | 960 | if (!dn_dev_islocal(dev, oldflp->saddr)) |
960 | continue; | 961 | continue; |
961 | if ((dev->flags & IFF_LOOPBACK) && | 962 | if ((dev->flags & IFF_LOOPBACK) && |
962 | oldflp->fld_dst && | 963 | oldflp->daddr && |
963 | !dn_dev_islocal(dev, oldflp->fld_dst)) | 964 | !dn_dev_islocal(dev, oldflp->daddr)) |
964 | continue; | 965 | continue; |
965 | 966 | ||
966 | dev_out = dev; | 967 | dev_out = dev; |
@@ -975,22 +976,22 @@ source_ok: | |||
975 | } | 976 | } |
976 | 977 | ||
977 | /* No destination? Assume its local */ | 978 | /* No destination? Assume its local */ |
978 | if (!fl.fld_dst) { | 979 | if (!fld.daddr) { |
979 | fl.fld_dst = fl.fld_src; | 980 | fld.daddr = fld.saddr; |
980 | 981 | ||
981 | err = -EADDRNOTAVAIL; | 982 | err = -EADDRNOTAVAIL; |
982 | if (dev_out) | 983 | if (dev_out) |
983 | dev_put(dev_out); | 984 | dev_put(dev_out); |
984 | dev_out = init_net.loopback_dev; | 985 | dev_out = init_net.loopback_dev; |
985 | dev_hold(dev_out); | 986 | dev_hold(dev_out); |
986 | if (!fl.fld_dst) { | 987 | if (!fld.daddr) { |
987 | fl.fld_dst = | 988 | fld.daddr = |
988 | fl.fld_src = dnet_select_source(dev_out, 0, | 989 | fld.saddr = dnet_select_source(dev_out, 0, |
989 | RT_SCOPE_HOST); | 990 | RT_SCOPE_HOST); |
990 | if (!fl.fld_dst) | 991 | if (!fld.daddr) |
991 | goto out; | 992 | goto out; |
992 | } | 993 | } |
993 | fl.flowi_oif = init_net.loopback_dev->ifindex; | 994 | fld.flowidn_oif = init_net.loopback_dev->ifindex; |
994 | res.type = RTN_LOCAL; | 995 | res.type = RTN_LOCAL; |
995 | goto make_route; | 996 | goto make_route; |
996 | } | 997 | } |
@@ -999,8 +1000,8 @@ source_ok: | |||
999 | printk(KERN_DEBUG | 1000 | printk(KERN_DEBUG |
1000 | "dn_route_output_slow: initial checks complete." | 1001 | "dn_route_output_slow: initial checks complete." |
1001 | " dst=%o4x src=%04x oif=%d try_hard=%d\n", | 1002 | " dst=%o4x src=%04x oif=%d try_hard=%d\n", |
1002 | le16_to_cpu(fl.fld_dst), le16_to_cpu(fl.fld_src), | 1003 | le16_to_cpu(fld.daddr), le16_to_cpu(fld.saddr), |
1003 | fl.flowi_oif, try_hard); | 1004 | fld.flowidn_oif, try_hard); |
1004 | 1005 | ||
1005 | /* | 1006 | /* |
1006 | * N.B. If the kernel is compiled without router support then | 1007 | * N.B. If the kernel is compiled without router support then |
@@ -1008,7 +1009,7 @@ source_ok: | |||
1008 | * will always be executed. | 1009 | * will always be executed. |
1009 | */ | 1010 | */ |
1010 | err = -ESRCH; | 1011 | err = -ESRCH; |
1011 | if (try_hard || (err = dn_fib_lookup(&fl, &res)) != 0) { | 1012 | if (try_hard || (err = dn_fib_lookup(&fld, &res)) != 0) { |
1012 | struct dn_dev *dn_db; | 1013 | struct dn_dev *dn_db; |
1013 | if (err != -ESRCH) | 1014 | if (err != -ESRCH) |
1014 | goto out; | 1015 | goto out; |
@@ -1023,19 +1024,19 @@ source_ok: | |||
1023 | * here | 1024 | * here |
1024 | */ | 1025 | */ |
1025 | if (!try_hard) { | 1026 | if (!try_hard) { |
1026 | neigh = neigh_lookup_nodev(&dn_neigh_table, &init_net, &fl.fld_dst); | 1027 | neigh = neigh_lookup_nodev(&dn_neigh_table, &init_net, &fld.daddr); |
1027 | if (neigh) { | 1028 | if (neigh) { |
1028 | if ((oldflp->flowi_oif && | 1029 | if ((oldflp->flowidn_oif && |
1029 | (neigh->dev->ifindex != oldflp->flowi_oif)) || | 1030 | (neigh->dev->ifindex != oldflp->flowidn_oif)) || |
1030 | (oldflp->fld_src && | 1031 | (oldflp->saddr && |
1031 | (!dn_dev_islocal(neigh->dev, | 1032 | (!dn_dev_islocal(neigh->dev, |
1032 | oldflp->fld_src)))) { | 1033 | oldflp->saddr)))) { |
1033 | neigh_release(neigh); | 1034 | neigh_release(neigh); |
1034 | neigh = NULL; | 1035 | neigh = NULL; |
1035 | } else { | 1036 | } else { |
1036 | if (dev_out) | 1037 | if (dev_out) |
1037 | dev_put(dev_out); | 1038 | dev_put(dev_out); |
1038 | if (dn_dev_islocal(neigh->dev, fl.fld_dst)) { | 1039 | if (dn_dev_islocal(neigh->dev, fld.daddr)) { |
1039 | dev_out = init_net.loopback_dev; | 1040 | dev_out = init_net.loopback_dev; |
1040 | res.type = RTN_LOCAL; | 1041 | res.type = RTN_LOCAL; |
1041 | } else { | 1042 | } else { |
@@ -1055,7 +1056,7 @@ source_ok: | |||
1055 | goto out; | 1056 | goto out; |
1056 | dn_db = rcu_dereference_raw(dev_out->dn_ptr); | 1057 | dn_db = rcu_dereference_raw(dev_out->dn_ptr); |
1057 | /* Possible improvement - check all devices for local addr */ | 1058 | /* Possible improvement - check all devices for local addr */ |
1058 | if (dn_dev_islocal(dev_out, fl.fld_dst)) { | 1059 | if (dn_dev_islocal(dev_out, fld.daddr)) { |
1059 | dev_put(dev_out); | 1060 | dev_put(dev_out); |
1060 | dev_out = init_net.loopback_dev; | 1061 | dev_out = init_net.loopback_dev; |
1061 | dev_hold(dev_out); | 1062 | dev_hold(dev_out); |
@@ -1071,16 +1072,16 @@ select_source: | |||
1071 | if (neigh) | 1072 | if (neigh) |
1072 | gateway = ((struct dn_neigh *)neigh)->addr; | 1073 | gateway = ((struct dn_neigh *)neigh)->addr; |
1073 | if (gateway == 0) | 1074 | if (gateway == 0) |
1074 | gateway = fl.fld_dst; | 1075 | gateway = fld.daddr; |
1075 | if (fl.fld_src == 0) { | 1076 | if (fld.saddr == 0) { |
1076 | fl.fld_src = dnet_select_source(dev_out, gateway, | 1077 | fld.saddr = dnet_select_source(dev_out, gateway, |
1077 | res.type == RTN_LOCAL ? | 1078 | res.type == RTN_LOCAL ? |
1078 | RT_SCOPE_HOST : | 1079 | RT_SCOPE_HOST : |
1079 | RT_SCOPE_LINK); | 1080 | RT_SCOPE_LINK); |
1080 | if (fl.fld_src == 0 && res.type != RTN_LOCAL) | 1081 | if (fld.saddr == 0 && res.type != RTN_LOCAL) |
1081 | goto e_addr; | 1082 | goto e_addr; |
1082 | } | 1083 | } |
1083 | fl.flowi_oif = dev_out->ifindex; | 1084 | fld.flowidn_oif = dev_out->ifindex; |
1084 | goto make_route; | 1085 | goto make_route; |
1085 | } | 1086 | } |
1086 | free_res = 1; | 1087 | free_res = 1; |
@@ -1089,35 +1090,35 @@ select_source: | |||
1089 | goto e_inval; | 1090 | goto e_inval; |
1090 | 1091 | ||
1091 | if (res.type == RTN_LOCAL) { | 1092 | if (res.type == RTN_LOCAL) { |
1092 | if (!fl.fld_src) | 1093 | if (!fld.saddr) |
1093 | fl.fld_src = fl.fld_dst; | 1094 | fld.saddr = fld.daddr; |
1094 | if (dev_out) | 1095 | if (dev_out) |
1095 | dev_put(dev_out); | 1096 | dev_put(dev_out); |
1096 | dev_out = init_net.loopback_dev; | 1097 | dev_out = init_net.loopback_dev; |
1097 | dev_hold(dev_out); | 1098 | dev_hold(dev_out); |
1098 | fl.flowi_oif = dev_out->ifindex; | 1099 | fld.flowidn_oif = dev_out->ifindex; |
1099 | if (res.fi) | 1100 | if (res.fi) |
1100 | dn_fib_info_put(res.fi); | 1101 | dn_fib_info_put(res.fi); |
1101 | res.fi = NULL; | 1102 | res.fi = NULL; |
1102 | goto make_route; | 1103 | goto make_route; |
1103 | } | 1104 | } |
1104 | 1105 | ||
1105 | if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0) | 1106 | if (res.fi->fib_nhs > 1 && fld.flowidn_oif == 0) |
1106 | dn_fib_select_multipath(&fl, &res); | 1107 | dn_fib_select_multipath(&fld, &res); |
1107 | 1108 | ||
1108 | /* | 1109 | /* |
1109 | * We could add some logic to deal with default routes here and | 1110 | * We could add some logic to deal with default routes here and |
1110 | * get rid of some of the special casing above. | 1111 | * get rid of some of the special casing above. |
1111 | */ | 1112 | */ |
1112 | 1113 | ||
1113 | if (!fl.fld_src) | 1114 | if (!fld.saddr) |
1114 | fl.fld_src = DN_FIB_RES_PREFSRC(res); | 1115 | fld.saddr = DN_FIB_RES_PREFSRC(res); |
1115 | 1116 | ||
1116 | if (dev_out) | 1117 | if (dev_out) |
1117 | dev_put(dev_out); | 1118 | dev_put(dev_out); |
1118 | dev_out = DN_FIB_RES_DEV(res); | 1119 | dev_out = DN_FIB_RES_DEV(res); |
1119 | dev_hold(dev_out); | 1120 | dev_hold(dev_out); |
1120 | fl.flowi_oif = dev_out->ifindex; | 1121 | fld.flowidn_oif = dev_out->ifindex; |
1121 | gateway = DN_FIB_RES_GW(res); | 1122 | gateway = DN_FIB_RES_GW(res); |
1122 | 1123 | ||
1123 | make_route: | 1124 | make_route: |
@@ -1131,19 +1132,19 @@ make_route: | |||
1131 | atomic_set(&rt->dst.__refcnt, 1); | 1132 | atomic_set(&rt->dst.__refcnt, 1); |
1132 | rt->dst.flags = DST_HOST; | 1133 | rt->dst.flags = DST_HOST; |
1133 | 1134 | ||
1134 | rt->fl.fld_src = oldflp->fld_src; | 1135 | rt->fld.saddr = oldflp->saddr; |
1135 | rt->fl.fld_dst = oldflp->fld_dst; | 1136 | rt->fld.daddr = oldflp->daddr; |
1136 | rt->fl.flowi_oif = oldflp->flowi_oif; | 1137 | rt->fld.flowidn_oif = oldflp->flowidn_oif; |
1137 | rt->fl.flowi_iif = 0; | 1138 | rt->fld.flowidn_iif = 0; |
1138 | rt->fl.flowi_mark = oldflp->flowi_mark; | 1139 | rt->fld.flowidn_mark = oldflp->flowidn_mark; |
1139 | 1140 | ||
1140 | rt->rt_saddr = fl.fld_src; | 1141 | rt->rt_saddr = fld.saddr; |
1141 | rt->rt_daddr = fl.fld_dst; | 1142 | rt->rt_daddr = fld.daddr; |
1142 | rt->rt_gateway = gateway ? gateway : fl.fld_dst; | 1143 | rt->rt_gateway = gateway ? gateway : fld.daddr; |
1143 | rt->rt_local_src = fl.fld_src; | 1144 | rt->rt_local_src = fld.saddr; |
1144 | 1145 | ||
1145 | rt->rt_dst_map = fl.fld_dst; | 1146 | rt->rt_dst_map = fld.daddr; |
1146 | rt->rt_src_map = fl.fld_src; | 1147 | rt->rt_src_map = fld.saddr; |
1147 | 1148 | ||
1148 | rt->dst.dev = dev_out; | 1149 | rt->dst.dev = dev_out; |
1149 | dev_hold(dev_out); | 1150 | dev_hold(dev_out); |
@@ -1161,7 +1162,7 @@ make_route: | |||
1161 | if (err) | 1162 | if (err) |
1162 | goto e_neighbour; | 1163 | goto e_neighbour; |
1163 | 1164 | ||
1164 | hash = dn_hash(rt->fl.fld_src, rt->fl.fld_dst); | 1165 | hash = dn_hash(rt->fld.saddr, rt->fld.daddr); |
1165 | dn_insert_route(rt, hash, (struct dn_route **)pprt); | 1166 | dn_insert_route(rt, hash, (struct dn_route **)pprt); |
1166 | 1167 | ||
1167 | done: | 1168 | done: |
@@ -1192,20 +1193,20 @@ e_neighbour: | |||
1192 | /* | 1193 | /* |
1193 | * N.B. The flags may be moved into the flowi at some future stage. | 1194 | * N.B. The flags may be moved into the flowi at some future stage. |
1194 | */ | 1195 | */ |
1195 | static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *flp, int flags) | 1196 | static int __dn_route_output_key(struct dst_entry **pprt, const struct flowidn *flp, int flags) |
1196 | { | 1197 | { |
1197 | unsigned hash = dn_hash(flp->fld_src, flp->fld_dst); | 1198 | unsigned hash = dn_hash(flp->saddr, flp->daddr); |
1198 | struct dn_route *rt = NULL; | 1199 | struct dn_route *rt = NULL; |
1199 | 1200 | ||
1200 | if (!(flags & MSG_TRYHARD)) { | 1201 | if (!(flags & MSG_TRYHARD)) { |
1201 | rcu_read_lock_bh(); | 1202 | rcu_read_lock_bh(); |
1202 | for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; | 1203 | for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; |
1203 | rt = rcu_dereference_bh(rt->dst.dn_next)) { | 1204 | rt = rcu_dereference_bh(rt->dst.dn_next)) { |
1204 | if ((flp->fld_dst == rt->fl.fld_dst) && | 1205 | if ((flp->daddr == rt->fld.daddr) && |
1205 | (flp->fld_src == rt->fl.fld_src) && | 1206 | (flp->saddr == rt->fld.saddr) && |
1206 | (flp->flowi_mark == rt->fl.flowi_mark) && | 1207 | (flp->flowidn_mark == rt->fld.flowidn_mark) && |
1207 | dn_is_output_route(rt) && | 1208 | dn_is_output_route(rt) && |
1208 | (rt->fl.flowi_oif == flp->flowi_oif)) { | 1209 | (rt->fld.flowidn_oif == flp->flowidn_oif)) { |
1209 | dst_use(&rt->dst, jiffies); | 1210 | dst_use(&rt->dst, jiffies); |
1210 | rcu_read_unlock_bh(); | 1211 | rcu_read_unlock_bh(); |
1211 | *pprt = &rt->dst; | 1212 | *pprt = &rt->dst; |
@@ -1218,13 +1219,14 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl | |||
1218 | return dn_route_output_slow(pprt, flp, flags); | 1219 | return dn_route_output_slow(pprt, flp, flags); |
1219 | } | 1220 | } |
1220 | 1221 | ||
1221 | static int dn_route_output_key(struct dst_entry **pprt, struct flowi *flp, int flags) | 1222 | static int dn_route_output_key(struct dst_entry **pprt, struct flowidn *flp, int flags) |
1222 | { | 1223 | { |
1223 | int err; | 1224 | int err; |
1224 | 1225 | ||
1225 | err = __dn_route_output_key(pprt, flp, flags); | 1226 | err = __dn_route_output_key(pprt, flp, flags); |
1226 | if (err == 0 && flp->flowi_proto) { | 1227 | if (err == 0 && flp->flowidn_proto) { |
1227 | *pprt = xfrm_lookup(&init_net, *pprt, flp, NULL, 0); | 1228 | *pprt = xfrm_lookup(&init_net, *pprt, |
1229 | flowidn_to_flowi(flp), NULL, 0); | ||
1228 | if (IS_ERR(*pprt)) { | 1230 | if (IS_ERR(*pprt)) { |
1229 | err = PTR_ERR(*pprt); | 1231 | err = PTR_ERR(*pprt); |
1230 | *pprt = NULL; | 1232 | *pprt = NULL; |
@@ -1233,15 +1235,16 @@ static int dn_route_output_key(struct dst_entry **pprt, struct flowi *flp, int f | |||
1233 | return err; | 1235 | return err; |
1234 | } | 1236 | } |
1235 | 1237 | ||
1236 | int dn_route_output_sock(struct dst_entry **pprt, struct flowi *fl, struct sock *sk, int flags) | 1238 | int dn_route_output_sock(struct dst_entry **pprt, struct flowidn *fl, struct sock *sk, int flags) |
1237 | { | 1239 | { |
1238 | int err; | 1240 | int err; |
1239 | 1241 | ||
1240 | err = __dn_route_output_key(pprt, fl, flags & MSG_TRYHARD); | 1242 | err = __dn_route_output_key(pprt, fl, flags & MSG_TRYHARD); |
1241 | if (err == 0 && fl->flowi_proto) { | 1243 | if (err == 0 && fl->flowidn_proto) { |
1242 | if (!(flags & MSG_DONTWAIT)) | 1244 | if (!(flags & MSG_DONTWAIT)) |
1243 | fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP; | 1245 | fl->flowidn_flags |= FLOWI_FLAG_CAN_SLEEP; |
1244 | *pprt = xfrm_lookup(&init_net, *pprt, fl, sk, 0); | 1246 | *pprt = xfrm_lookup(&init_net, *pprt, |
1247 | flowidn_to_flowi(fl), sk, 0); | ||
1245 | if (IS_ERR(*pprt)) { | 1248 | if (IS_ERR(*pprt)) { |
1246 | err = PTR_ERR(*pprt); | 1249 | err = PTR_ERR(*pprt); |
1247 | *pprt = NULL; | 1250 | *pprt = NULL; |
@@ -1262,12 +1265,12 @@ static int dn_route_input_slow(struct sk_buff *skb) | |||
1262 | int flags = 0; | 1265 | int flags = 0; |
1263 | __le16 gateway = 0; | 1266 | __le16 gateway = 0; |
1264 | __le16 local_src = 0; | 1267 | __le16 local_src = 0; |
1265 | struct flowi fl = { | 1268 | struct flowidn fld = { |
1266 | .fld_dst = cb->dst, | 1269 | .daddr = cb->dst, |
1267 | .fld_src = cb->src, | 1270 | .saddr = cb->src, |
1268 | .fld_scope = RT_SCOPE_UNIVERSE, | 1271 | .flowidn_scope = RT_SCOPE_UNIVERSE, |
1269 | .flowi_mark = skb->mark, | 1272 | .flowidn_mark = skb->mark, |
1270 | .flowi_iif = skb->dev->ifindex, | 1273 | .flowidn_iif = skb->dev->ifindex, |
1271 | }; | 1274 | }; |
1272 | struct dn_fib_res res = { .fi = NULL, .type = RTN_UNREACHABLE }; | 1275 | struct dn_fib_res res = { .fi = NULL, .type = RTN_UNREACHABLE }; |
1273 | int err = -EINVAL; | 1276 | int err = -EINVAL; |
@@ -1279,7 +1282,7 @@ static int dn_route_input_slow(struct sk_buff *skb) | |||
1279 | goto out; | 1282 | goto out; |
1280 | 1283 | ||
1281 | /* Zero source addresses are not allowed */ | 1284 | /* Zero source addresses are not allowed */ |
1282 | if (fl.fld_src == 0) | 1285 | if (fld.saddr == 0) |
1283 | goto out; | 1286 | goto out; |
1284 | 1287 | ||
1285 | /* | 1288 | /* |
@@ -1293,7 +1296,7 @@ static int dn_route_input_slow(struct sk_buff *skb) | |||
1293 | if (dn_dev_islocal(in_dev, cb->src)) | 1296 | if (dn_dev_islocal(in_dev, cb->src)) |
1294 | goto out; | 1297 | goto out; |
1295 | 1298 | ||
1296 | err = dn_fib_lookup(&fl, &res); | 1299 | err = dn_fib_lookup(&fld, &res); |
1297 | if (err) { | 1300 | if (err) { |
1298 | if (err != -ESRCH) | 1301 | if (err != -ESRCH) |
1299 | goto out; | 1302 | goto out; |
@@ -1305,7 +1308,7 @@ static int dn_route_input_slow(struct sk_buff *skb) | |||
1305 | 1308 | ||
1306 | res.type = RTN_LOCAL; | 1309 | res.type = RTN_LOCAL; |
1307 | } else { | 1310 | } else { |
1308 | __le16 src_map = fl.fld_src; | 1311 | __le16 src_map = fld.saddr; |
1309 | free_res = 1; | 1312 | free_res = 1; |
1310 | 1313 | ||
1311 | out_dev = DN_FIB_RES_DEV(res); | 1314 | out_dev = DN_FIB_RES_DEV(res); |
@@ -1318,22 +1321,22 @@ static int dn_route_input_slow(struct sk_buff *skb) | |||
1318 | dev_hold(out_dev); | 1321 | dev_hold(out_dev); |
1319 | 1322 | ||
1320 | if (res.r) | 1323 | if (res.r) |
1321 | src_map = fl.fld_src; /* no NAT support for now */ | 1324 | src_map = fld.saddr; /* no NAT support for now */ |
1322 | 1325 | ||
1323 | gateway = DN_FIB_RES_GW(res); | 1326 | gateway = DN_FIB_RES_GW(res); |
1324 | if (res.type == RTN_NAT) { | 1327 | if (res.type == RTN_NAT) { |
1325 | fl.fld_dst = dn_fib_rules_map_destination(fl.fld_dst, &res); | 1328 | fld.daddr = dn_fib_rules_map_destination(fld.daddr, &res); |
1326 | dn_fib_res_put(&res); | 1329 | dn_fib_res_put(&res); |
1327 | free_res = 0; | 1330 | free_res = 0; |
1328 | if (dn_fib_lookup(&fl, &res)) | 1331 | if (dn_fib_lookup(&fld, &res)) |
1329 | goto e_inval; | 1332 | goto e_inval; |
1330 | free_res = 1; | 1333 | free_res = 1; |
1331 | if (res.type != RTN_UNICAST) | 1334 | if (res.type != RTN_UNICAST) |
1332 | goto e_inval; | 1335 | goto e_inval; |
1333 | flags |= RTCF_DNAT; | 1336 | flags |= RTCF_DNAT; |
1334 | gateway = fl.fld_dst; | 1337 | gateway = fld.daddr; |
1335 | } | 1338 | } |
1336 | fl.fld_src = src_map; | 1339 | fld.saddr = src_map; |
1337 | } | 1340 | } |
1338 | 1341 | ||
1339 | switch(res.type) { | 1342 | switch(res.type) { |
@@ -1347,8 +1350,8 @@ static int dn_route_input_slow(struct sk_buff *skb) | |||
1347 | if (dn_db->parms.forwarding == 0) | 1350 | if (dn_db->parms.forwarding == 0) |
1348 | goto e_inval; | 1351 | goto e_inval; |
1349 | 1352 | ||
1350 | if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0) | 1353 | if (res.fi->fib_nhs > 1 && fld.flowidn_oif == 0) |
1351 | dn_fib_select_multipath(&fl, &res); | 1354 | dn_fib_select_multipath(&fld, &res); |
1352 | 1355 | ||
1353 | /* | 1356 | /* |
1354 | * Check for out_dev == in_dev. We use the RTCF_DOREDIRECT | 1357 | * Check for out_dev == in_dev. We use the RTCF_DOREDIRECT |
@@ -1366,8 +1369,8 @@ static int dn_route_input_slow(struct sk_buff *skb) | |||
1366 | break; | 1369 | break; |
1367 | case RTN_LOCAL: | 1370 | case RTN_LOCAL: |
1368 | flags |= RTCF_LOCAL; | 1371 | flags |= RTCF_LOCAL; |
1369 | fl.fld_src = cb->dst; | 1372 | fld.saddr = cb->dst; |
1370 | fl.fld_dst = cb->src; | 1373 | fld.daddr = cb->src; |
1371 | 1374 | ||
1372 | /* Routing tables gave us a gateway */ | 1375 | /* Routing tables gave us a gateway */ |
1373 | if (gateway) | 1376 | if (gateway) |
@@ -1400,21 +1403,21 @@ make_route: | |||
1400 | if (rt == NULL) | 1403 | if (rt == NULL) |
1401 | goto e_nobufs; | 1404 | goto e_nobufs; |
1402 | 1405 | ||
1403 | rt->rt_saddr = fl.fld_src; | 1406 | rt->rt_saddr = fld.saddr; |
1404 | rt->rt_daddr = fl.fld_dst; | 1407 | rt->rt_daddr = fld.daddr; |
1405 | rt->rt_gateway = fl.fld_dst; | 1408 | rt->rt_gateway = fld.daddr; |
1406 | if (gateway) | 1409 | if (gateway) |
1407 | rt->rt_gateway = gateway; | 1410 | rt->rt_gateway = gateway; |
1408 | rt->rt_local_src = local_src ? local_src : rt->rt_saddr; | 1411 | rt->rt_local_src = local_src ? local_src : rt->rt_saddr; |
1409 | 1412 | ||
1410 | rt->rt_dst_map = fl.fld_dst; | 1413 | rt->rt_dst_map = fld.daddr; |
1411 | rt->rt_src_map = fl.fld_src; | 1414 | rt->rt_src_map = fld.saddr; |
1412 | 1415 | ||
1413 | rt->fl.fld_src = cb->src; | 1416 | rt->fld.saddr = cb->src; |
1414 | rt->fl.fld_dst = cb->dst; | 1417 | rt->fld.daddr = cb->dst; |
1415 | rt->fl.flowi_oif = 0; | 1418 | rt->fld.flowidn_oif = 0; |
1416 | rt->fl.flowi_iif = in_dev->ifindex; | 1419 | rt->fld.flowidn_iif = in_dev->ifindex; |
1417 | rt->fl.flowi_mark = fl.flowi_mark; | 1420 | rt->fld.flowidn_mark = fld.flowidn_mark; |
1418 | 1421 | ||
1419 | rt->dst.flags = DST_HOST; | 1422 | rt->dst.flags = DST_HOST; |
1420 | rt->dst.neighbour = neigh; | 1423 | rt->dst.neighbour = neigh; |
@@ -1444,7 +1447,7 @@ make_route: | |||
1444 | if (err) | 1447 | if (err) |
1445 | goto e_neighbour; | 1448 | goto e_neighbour; |
1446 | 1449 | ||
1447 | hash = dn_hash(rt->fl.fld_src, rt->fl.fld_dst); | 1450 | hash = dn_hash(rt->fld.saddr, rt->fld.daddr); |
1448 | dn_insert_route(rt, hash, &rt); | 1451 | dn_insert_route(rt, hash, &rt); |
1449 | skb_dst_set(skb, &rt->dst); | 1452 | skb_dst_set(skb, &rt->dst); |
1450 | 1453 | ||
@@ -1484,11 +1487,11 @@ static int dn_route_input(struct sk_buff *skb) | |||
1484 | rcu_read_lock(); | 1487 | rcu_read_lock(); |
1485 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; | 1488 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; |
1486 | rt = rcu_dereference(rt->dst.dn_next)) { | 1489 | rt = rcu_dereference(rt->dst.dn_next)) { |
1487 | if ((rt->fl.fld_src == cb->src) && | 1490 | if ((rt->fld.saddr == cb->src) && |
1488 | (rt->fl.fld_dst == cb->dst) && | 1491 | (rt->fld.daddr == cb->dst) && |
1489 | (rt->fl.flowi_oif == 0) && | 1492 | (rt->fld.flowidn_oif == 0) && |
1490 | (rt->fl.flowi_mark == skb->mark) && | 1493 | (rt->fld.flowidn_mark == skb->mark) && |
1491 | (rt->fl.flowi_iif == cb->iif)) { | 1494 | (rt->fld.flowidn_iif == cb->iif)) { |
1492 | dst_use(&rt->dst, jiffies); | 1495 | dst_use(&rt->dst, jiffies); |
1493 | rcu_read_unlock(); | 1496 | rcu_read_unlock(); |
1494 | skb_dst_set(skb, (struct dst_entry *)rt); | 1497 | skb_dst_set(skb, (struct dst_entry *)rt); |
@@ -1524,9 +1527,9 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
1524 | if (rt->rt_flags & RTCF_NOTIFY) | 1527 | if (rt->rt_flags & RTCF_NOTIFY) |
1525 | r->rtm_flags |= RTM_F_NOTIFY; | 1528 | r->rtm_flags |= RTM_F_NOTIFY; |
1526 | RTA_PUT(skb, RTA_DST, 2, &rt->rt_daddr); | 1529 | RTA_PUT(skb, RTA_DST, 2, &rt->rt_daddr); |
1527 | if (rt->fl.fld_src) { | 1530 | if (rt->fld.saddr) { |
1528 | r->rtm_src_len = 16; | 1531 | r->rtm_src_len = 16; |
1529 | RTA_PUT(skb, RTA_SRC, 2, &rt->fl.fld_src); | 1532 | RTA_PUT(skb, RTA_SRC, 2, &rt->fld.saddr); |
1530 | } | 1533 | } |
1531 | if (rt->dst.dev) | 1534 | if (rt->dst.dev) |
1532 | RTA_PUT(skb, RTA_OIF, sizeof(int), &rt->dst.dev->ifindex); | 1535 | RTA_PUT(skb, RTA_OIF, sizeof(int), &rt->dst.dev->ifindex); |
@@ -1545,7 +1548,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
1545 | rt->dst.error) < 0) | 1548 | rt->dst.error) < 0) |
1546 | goto rtattr_failure; | 1549 | goto rtattr_failure; |
1547 | if (dn_is_input_route(rt)) | 1550 | if (dn_is_input_route(rt)) |
1548 | RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.flowi_iif); | 1551 | RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fld.flowidn_iif); |
1549 | 1552 | ||
1550 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; | 1553 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1551 | return skb->len; | 1554 | return skb->len; |
@@ -1568,13 +1571,13 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
1568 | struct dn_skb_cb *cb; | 1571 | struct dn_skb_cb *cb; |
1569 | int err; | 1572 | int err; |
1570 | struct sk_buff *skb; | 1573 | struct sk_buff *skb; |
1571 | struct flowi fl; | 1574 | struct flowidn fld; |
1572 | 1575 | ||
1573 | if (!net_eq(net, &init_net)) | 1576 | if (!net_eq(net, &init_net)) |
1574 | return -EINVAL; | 1577 | return -EINVAL; |
1575 | 1578 | ||
1576 | memset(&fl, 0, sizeof(fl)); | 1579 | memset(&fld, 0, sizeof(fld)); |
1577 | fl.flowi_proto = DNPROTO_NSP; | 1580 | fld.flowidn_proto = DNPROTO_NSP; |
1578 | 1581 | ||
1579 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | 1582 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); |
1580 | if (skb == NULL) | 1583 | if (skb == NULL) |
@@ -1583,15 +1586,15 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
1583 | cb = DN_SKB_CB(skb); | 1586 | cb = DN_SKB_CB(skb); |
1584 | 1587 | ||
1585 | if (rta[RTA_SRC-1]) | 1588 | if (rta[RTA_SRC-1]) |
1586 | memcpy(&fl.fld_src, RTA_DATA(rta[RTA_SRC-1]), 2); | 1589 | memcpy(&fld.saddr, RTA_DATA(rta[RTA_SRC-1]), 2); |
1587 | if (rta[RTA_DST-1]) | 1590 | if (rta[RTA_DST-1]) |
1588 | memcpy(&fl.fld_dst, RTA_DATA(rta[RTA_DST-1]), 2); | 1591 | memcpy(&fld.daddr, RTA_DATA(rta[RTA_DST-1]), 2); |
1589 | if (rta[RTA_IIF-1]) | 1592 | if (rta[RTA_IIF-1]) |
1590 | memcpy(&fl.flowi_iif, RTA_DATA(rta[RTA_IIF-1]), sizeof(int)); | 1593 | memcpy(&fld.flowidn_iif, RTA_DATA(rta[RTA_IIF-1]), sizeof(int)); |
1591 | 1594 | ||
1592 | if (fl.flowi_iif) { | 1595 | if (fld.flowidn_iif) { |
1593 | struct net_device *dev; | 1596 | struct net_device *dev; |
1594 | if ((dev = dev_get_by_index(&init_net, fl.flowi_iif)) == NULL) { | 1597 | if ((dev = dev_get_by_index(&init_net, fld.flowidn_iif)) == NULL) { |
1595 | kfree_skb(skb); | 1598 | kfree_skb(skb); |
1596 | return -ENODEV; | 1599 | return -ENODEV; |
1597 | } | 1600 | } |
@@ -1602,8 +1605,8 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
1602 | } | 1605 | } |
1603 | skb->protocol = htons(ETH_P_DNA_RT); | 1606 | skb->protocol = htons(ETH_P_DNA_RT); |
1604 | skb->dev = dev; | 1607 | skb->dev = dev; |
1605 | cb->src = fl.fld_src; | 1608 | cb->src = fld.saddr; |
1606 | cb->dst = fl.fld_dst; | 1609 | cb->dst = fld.daddr; |
1607 | local_bh_disable(); | 1610 | local_bh_disable(); |
1608 | err = dn_route_input(skb); | 1611 | err = dn_route_input(skb); |
1609 | local_bh_enable(); | 1612 | local_bh_enable(); |
@@ -1615,8 +1618,8 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
1615 | int oif = 0; | 1618 | int oif = 0; |
1616 | if (rta[RTA_OIF - 1]) | 1619 | if (rta[RTA_OIF - 1]) |
1617 | memcpy(&oif, RTA_DATA(rta[RTA_OIF - 1]), sizeof(int)); | 1620 | memcpy(&oif, RTA_DATA(rta[RTA_OIF - 1]), sizeof(int)); |
1618 | fl.flowi_oif = oif; | 1621 | fld.flowidn_oif = oif; |
1619 | err = dn_route_output_key((struct dst_entry **)&rt, &fl, 0); | 1622 | err = dn_route_output_key((struct dst_entry **)&rt, &fld, 0); |
1620 | } | 1623 | } |
1621 | 1624 | ||
1622 | if (skb->dev) | 1625 | if (skb->dev) |
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c index 6eb91df3c550..f0efb0ccfeca 100644 --- a/net/decnet/dn_rules.c +++ b/net/decnet/dn_rules.c | |||
@@ -49,14 +49,15 @@ struct dn_fib_rule | |||
49 | }; | 49 | }; |
50 | 50 | ||
51 | 51 | ||
52 | int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) | 52 | int dn_fib_lookup(struct flowidn *flp, struct dn_fib_res *res) |
53 | { | 53 | { |
54 | struct fib_lookup_arg arg = { | 54 | struct fib_lookup_arg arg = { |
55 | .result = res, | 55 | .result = res, |
56 | }; | 56 | }; |
57 | int err; | 57 | int err; |
58 | 58 | ||
59 | err = fib_rules_lookup(dn_fib_rules_ops, flp, 0, &arg); | 59 | err = fib_rules_lookup(dn_fib_rules_ops, |
60 | flowidn_to_flowi(flp), 0, &arg); | ||
60 | res->r = arg.rule; | 61 | res->r = arg.rule; |
61 | 62 | ||
62 | return err; | 63 | return err; |
@@ -65,6 +66,7 @@ int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) | |||
65 | static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp, | 66 | static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp, |
66 | int flags, struct fib_lookup_arg *arg) | 67 | int flags, struct fib_lookup_arg *arg) |
67 | { | 68 | { |
69 | struct flowidn *fld = &flp->u.dn; | ||
68 | int err = -EAGAIN; | 70 | int err = -EAGAIN; |
69 | struct dn_fib_table *tbl; | 71 | struct dn_fib_table *tbl; |
70 | 72 | ||
@@ -90,7 +92,7 @@ static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp, | |||
90 | if (tbl == NULL) | 92 | if (tbl == NULL) |
91 | goto errout; | 93 | goto errout; |
92 | 94 | ||
93 | err = tbl->lookup(tbl, flp, (struct dn_fib_res *)arg->result); | 95 | err = tbl->lookup(tbl, fld, (struct dn_fib_res *)arg->result); |
94 | if (err > 0) | 96 | if (err > 0) |
95 | err = -EAGAIN; | 97 | err = -EAGAIN; |
96 | errout: | 98 | errout: |
@@ -104,8 +106,9 @@ static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = { | |||
104 | static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | 106 | static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) |
105 | { | 107 | { |
106 | struct dn_fib_rule *r = (struct dn_fib_rule *)rule; | 108 | struct dn_fib_rule *r = (struct dn_fib_rule *)rule; |
107 | __le16 daddr = fl->fld_dst; | 109 | struct flowidn *fld = &fl->u.dn; |
108 | __le16 saddr = fl->fld_src; | 110 | __le16 daddr = fld->daddr; |
111 | __le16 saddr = fld->saddr; | ||
109 | 112 | ||
110 | if (((saddr ^ r->src) & r->srcmask) || | 113 | if (((saddr ^ r->src) & r->srcmask) || |
111 | ((daddr ^ r->dst) & r->dstmask)) | 114 | ((daddr ^ r->dst) & r->dstmask)) |
@@ -175,7 +178,7 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, | |||
175 | 178 | ||
176 | unsigned dnet_addr_type(__le16 addr) | 179 | unsigned dnet_addr_type(__le16 addr) |
177 | { | 180 | { |
178 | struct flowi fl = { .fld_dst = addr }; | 181 | struct flowidn fld = { .daddr = addr }; |
179 | struct dn_fib_res res; | 182 | struct dn_fib_res res; |
180 | unsigned ret = RTN_UNICAST; | 183 | unsigned ret = RTN_UNICAST; |
181 | struct dn_fib_table *tb = dn_fib_get_table(RT_TABLE_LOCAL, 0); | 184 | struct dn_fib_table *tb = dn_fib_get_table(RT_TABLE_LOCAL, 0); |
@@ -183,7 +186,7 @@ unsigned dnet_addr_type(__le16 addr) | |||
183 | res.r = NULL; | 186 | res.r = NULL; |
184 | 187 | ||
185 | if (tb) { | 188 | if (tb) { |
186 | if (!tb->lookup(tb, &fl, &res)) { | 189 | if (!tb->lookup(tb, &fld, &res)) { |
187 | ret = res.type; | 190 | ret = res.type; |
188 | dn_fib_res_put(&res); | 191 | dn_fib_res_put(&res); |
189 | } | 192 | } |
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index b66600b3f4b5..99d8d3a40998 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -764,7 +764,7 @@ static int dn_fib_table_flush(struct dn_fib_table *tb) | |||
764 | return found; | 764 | return found; |
765 | } | 765 | } |
766 | 766 | ||
767 | static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, struct dn_fib_res *res) | 767 | static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowidn *flp, struct dn_fib_res *res) |
768 | { | 768 | { |
769 | int err; | 769 | int err; |
770 | struct dn_zone *dz; | 770 | struct dn_zone *dz; |
@@ -773,7 +773,7 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, | |||
773 | read_lock(&dn_fib_tables_lock); | 773 | read_lock(&dn_fib_tables_lock); |
774 | for(dz = t->dh_zone_list; dz; dz = dz->dz_next) { | 774 | for(dz = t->dh_zone_list; dz; dz = dz->dz_next) { |
775 | struct dn_fib_node *f; | 775 | struct dn_fib_node *f; |
776 | dn_fib_key_t k = dz_key(flp->fld_dst, dz); | 776 | dn_fib_key_t k = dz_key(flp->daddr, dz); |
777 | 777 | ||
778 | for(f = dz_chain(k, dz); f; f = f->fn_next) { | 778 | for(f = dz_chain(k, dz); f; f = f->fn_next) { |
779 | if (!dn_key_eq(k, f->fn_key)) { | 779 | if (!dn_key_eq(k, f->fn_key)) { |
@@ -788,7 +788,7 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, | |||
788 | if (f->fn_state&DN_S_ZOMBIE) | 788 | if (f->fn_state&DN_S_ZOMBIE) |
789 | continue; | 789 | continue; |
790 | 790 | ||
791 | if (f->fn_scope < flp->fld_scope) | 791 | if (f->fn_scope < flp->flowidn_scope) |
792 | continue; | 792 | continue; |
793 | 793 | ||
794 | err = dn_fib_semantic_match(f->fn_type, DN_FIB_INFO(f), flp, res); | 794 | err = dn_fib_semantic_match(f->fn_type, DN_FIB_INFO(f), flp, res); |