Commit bef55aebd560c5a6f8883c421abccee39978c58c
1 parent
1958b856c1
Exists in
master
and in
39 other branches
decnet: Convert to use flowidn where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 10 changed files with 196 additions and 185 deletions Side-by-side Diff
include/net/dn.h
... | ... | @@ -192,10 +192,10 @@ |
192 | 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; | |
198 | - fl->u.dn.uli.ports.dport = scp->addrrem; | |
197 | + fld->fld_sport = scp->addrloc; | |
198 | + fld->fld_dport = scp->addrrem; | |
199 | 199 | } |
200 | 200 | |
201 | 201 | extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); |
include/net/dn_fib.h
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, |
99 | 99 | struct dn_kern_rta *rta, struct nlmsghdr *n, |
100 | 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 | 102 | struct dn_fib_res *res); |
103 | 103 | int (*flush)(struct dn_fib_table *t); |
104 | 104 | int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); |
105 | 105 | |
... | ... | @@ -119,12 +119,12 @@ |
119 | 119 | struct dn_kern_rta *rta, |
120 | 120 | const struct nlmsghdr *nlh, int *errp); |
121 | 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 | 123 | struct dn_fib_res *res); |
124 | 124 | extern void dn_fib_release_info(struct dn_fib_info *fi); |
125 | 125 | extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); |
126 | 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 | 128 | struct dn_fib_res *res); |
129 | 129 | |
130 | 130 | /* |
... | ... | @@ -141,7 +141,7 @@ |
141 | 141 | extern void dn_fib_rules_init(void); |
142 | 142 | extern void dn_fib_rules_cleanup(void); |
143 | 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 | 146 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); |
147 | 147 |
include/net/dn_route.h
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | *******************************************************************************/ |
17 | 17 | |
18 | 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 | 20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); |
21 | 21 | extern void dn_rt_cache_flush(int delay); |
22 | 22 | |
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | struct dn_route { |
68 | 68 | struct dst_entry dst; |
69 | 69 | |
70 | - struct flowi fl; | |
70 | + struct flowidn fld; | |
71 | 71 | |
72 | 72 | __le16 rt_saddr; |
73 | 73 | __le16 rt_daddr; |
74 | 74 | |
... | ... | @@ -82,12 +82,12 @@ |
82 | 82 | |
83 | 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 | 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 | 93 | extern void dn_route_init(void); |
include/net/flow.h
... | ... | @@ -95,9 +95,17 @@ |
95 | 95 | |
96 | 96 | struct flowidn { |
97 | 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 | 104 | __le16 daddr; |
99 | 105 | __le16 saddr; |
100 | 106 | union flowi_uli uli; |
107 | +#define fld_sport uli.ports.sport | |
108 | +#define fld_dport uli.ports.dport | |
101 | 109 | }; |
102 | 110 | |
103 | 111 | struct flowi { |
... | ... | @@ -115,10 +123,6 @@ |
115 | 123 | #define flowi_proto u.__fl_common.flowic_proto |
116 | 124 | #define flowi_flags u.__fl_common.flowic_flags |
117 | 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 | 126 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
123 | 127 | |
124 | 128 | static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4) |
net/decnet/af_decnet.c
... | ... | @@ -908,7 +908,7 @@ |
908 | 908 | struct socket *sock = sk->sk_socket; |
909 | 909 | struct dn_scp *scp = DN_SK(sk); |
910 | 910 | int err = -EISCONN; |
911 | - struct flowi fl; | |
911 | + struct flowidn fld; | |
912 | 912 | |
913 | 913 | if (sock->state == SS_CONNECTED) |
914 | 914 | goto out; |
... | ... | @@ -947,13 +947,13 @@ |
947 | 947 | memcpy(&scp->peer, addr, sizeof(struct sockaddr_dn)); |
948 | 948 | |
949 | 949 | err = -EHOSTUNREACH; |
950 | - memset(&fl, 0, sizeof(fl)); | |
951 | - fl.flowi_oif = sk->sk_bound_dev_if; | |
952 | - fl.fld_dst = dn_saddr2dn(&scp->peer); | |
953 | - fl.fld_src = dn_saddr2dn(&scp->addr); | |
954 | - dn_sk_ports_copy(&fl, scp); | |
955 | - fl.flowi_proto = DNPROTO_NSP; | |
956 | - if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, flags) < 0) | |
950 | + memset(&fld, 0, sizeof(fld)); | |
951 | + fld.flowidn_oif = sk->sk_bound_dev_if; | |
952 | + fld.daddr = dn_saddr2dn(&scp->peer); | |
953 | + fld.saddr = dn_saddr2dn(&scp->addr); | |
954 | + dn_sk_ports_copy(&fld, scp); | |
955 | + fld.flowidn_proto = DNPROTO_NSP; | |
956 | + if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, flags) < 0) | |
957 | 957 | goto out; |
958 | 958 | sk->sk_route_caps = sk->sk_dst_cache->dev->features; |
959 | 959 | sock->state = SS_CONNECTING; |
net/decnet/dn_fib.c
... | ... | @@ -201,7 +201,7 @@ |
201 | 201 | int err; |
202 | 202 | |
203 | 203 | if (nh->nh_gw) { |
204 | - struct flowi fl; | |
204 | + struct flowidn fld; | |
205 | 205 | struct dn_fib_res res; |
206 | 206 | |
207 | 207 | if (nh->nh_flags&RTNH_F_ONLINK) { |
208 | 208 | |
209 | 209 | |
... | ... | @@ -221,15 +221,15 @@ |
221 | 221 | return 0; |
222 | 222 | } |
223 | 223 | |
224 | - memset(&fl, 0, sizeof(fl)); | |
225 | - fl.fld_dst = nh->nh_gw; | |
226 | - fl.flowi_oif = nh->nh_oif; | |
227 | - fl.fld_scope = r->rtm_scope + 1; | |
224 | + memset(&fld, 0, sizeof(fld)); | |
225 | + fld.daddr = nh->nh_gw; | |
226 | + fld.flowidn_oif = nh->nh_oif; | |
227 | + fld.flowidn_scope = r->rtm_scope + 1; | |
228 | 228 | |
229 | - if (fl.fld_scope < RT_SCOPE_LINK) | |
230 | - fl.fld_scope = RT_SCOPE_LINK; | |
229 | + if (fld.flowidn_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 | 233 | return err; |
234 | 234 | |
235 | 235 | err = -EINVAL; |
... | ... | @@ -404,7 +404,7 @@ |
404 | 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 | 409 | int err = dn_fib_props[type].error; |
410 | 410 | |
... | ... | @@ -424,7 +424,8 @@ |
424 | 424 | for_nexthops(fi) { |
425 | 425 | if (nh->nh_flags & RTNH_F_DEAD) |
426 | 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 | 429 | break; |
429 | 430 | } |
430 | 431 | if (nhsel < fi->fib_nhs) { |
... | ... | @@ -445,7 +446,7 @@ |
445 | 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 | 451 | struct dn_fib_info *fi = res->fi; |
451 | 452 | int w; |
net/decnet/dn_nsp_out.c
... | ... | @@ -78,7 +78,7 @@ |
78 | 78 | struct sock *sk = skb->sk; |
79 | 79 | struct dn_scp *scp = DN_SK(sk); |
80 | 80 | struct dst_entry *dst; |
81 | - struct flowi fl; | |
81 | + struct flowidn fld; | |
82 | 82 | |
83 | 83 | skb_reset_transport_header(skb); |
84 | 84 | scp->stamp = jiffies; |
... | ... | @@ -91,13 +91,13 @@ |
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | - memset(&fl, 0, sizeof(fl)); | |
95 | - fl.flowi_oif = sk->sk_bound_dev_if; | |
96 | - fl.fld_src = dn_saddr2dn(&scp->addr); | |
97 | - fl.fld_dst = dn_saddr2dn(&scp->peer); | |
98 | - dn_sk_ports_copy(&fl, scp); | |
99 | - fl.flowi_proto = DNPROTO_NSP; | |
100 | - if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, 0) == 0) { | |
94 | + memset(&fld, 0, sizeof(fld)); | |
95 | + fld.flowidn_oif = sk->sk_bound_dev_if; | |
96 | + fld.saddr = dn_saddr2dn(&scp->addr); | |
97 | + fld.daddr = dn_saddr2dn(&scp->peer); | |
98 | + dn_sk_ports_copy(&fld, scp); | |
99 | + fld.flowidn_proto = DNPROTO_NSP; | |
100 | + if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, 0) == 0) { | |
101 | 101 | dst = sk_dst_get(sk); |
102 | 102 | sk->sk_route_caps = dst->dev->features; |
103 | 103 | goto try_again; |
net/decnet/dn_route.c
... | ... | @@ -282,14 +282,14 @@ |
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) | | |
288 | - (fl1->fld_src ^ fl2->fld_src) | | |
289 | - (fl1->flowi_mark ^ fl2->flowi_mark) | | |
290 | - (fl1->fld_scope ^ fl2->fld_scope) | | |
291 | - (fl1->flowi_oif ^ fl2->flowi_oif) | | |
292 | - (fl1->flowi_iif ^ fl2->flowi_iif)) == 0; | |
287 | + return ((fl1->daddr ^ fl2->daddr) | | |
288 | + (fl1->saddr ^ fl2->saddr) | | |
289 | + (fl1->flowidn_mark ^ fl2->flowidn_mark) | | |
290 | + (fl1->flowidn_scope ^ fl2->flowidn_scope) | | |
291 | + (fl1->flowidn_oif ^ fl2->flowidn_oif) | | |
292 | + (fl1->flowidn_iif ^ fl2->flowidn_iif)) == 0; | |
293 | 293 | } |
294 | 294 | |
295 | 295 | static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route **rp) |
... | ... | @@ -303,7 +303,7 @@ |
303 | 303 | spin_lock_bh(&dn_rt_hash_table[hash].lock); |
304 | 304 | while ((rth = rcu_dereference_protected(*rthp, |
305 | 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 | 307 | /* Put it first */ |
308 | 308 | *rthp = rth->dst.dn_next; |
309 | 309 | rcu_assign_pointer(rth->dst.dn_next, |
310 | 310 | |
... | ... | @@ -903,15 +903,15 @@ |
903 | 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 = { | |
909 | - .fld_dst = oldflp->fld_dst, | |
910 | - .fld_src = oldflp->fld_src, | |
911 | - .fld_scope = RT_SCOPE_UNIVERSE, | |
912 | - .flowi_mark = oldflp->flowi_mark, | |
913 | - .flowi_iif = init_net.loopback_dev->ifindex, | |
914 | - .flowi_oif = oldflp->flowi_oif, | |
908 | + struct flowidn fld = { | |
909 | + .daddr = oldflp->daddr, | |
910 | + .saddr = oldflp->saddr, | |
911 | + .flowidn_scope = RT_SCOPE_UNIVERSE, | |
912 | + .flowidn_mark = oldflp->flowidn_mark, | |
913 | + .flowidn_iif = init_net.loopback_dev->ifindex, | |
914 | + .flowidn_oif = oldflp->flowidn_oif, | |
915 | 915 | }; |
916 | 916 | struct dn_route *rt = NULL; |
917 | 917 | struct net_device *dev_out = NULL, *dev; |
918 | 918 | |
... | ... | @@ -926,13 +926,14 @@ |
926 | 926 | if (decnet_debug_level & 16) |
927 | 927 | printk(KERN_DEBUG |
928 | 928 | "dn_route_output_slow: dst=%04x src=%04x mark=%d" |
929 | - " iif=%d oif=%d\n", le16_to_cpu(oldflp->fld_dst), | |
930 | - le16_to_cpu(oldflp->fld_src), | |
931 | - oldflp->flowi_mark, init_net.loopback_dev->ifindex, oldflp->flowi_oif); | |
929 | + " iif=%d oif=%d\n", le16_to_cpu(oldflp->daddr), | |
930 | + le16_to_cpu(oldflp->saddr), | |
931 | + oldflp->flowidn_mark, init_net.loopback_dev->ifindex, | |
932 | + oldflp->flowidn_oif); | |
932 | 933 | |
933 | 934 | /* If we have an output interface, verify its a DECnet device */ |
934 | - if (oldflp->flowi_oif) { | |
935 | - dev_out = dev_get_by_index(&init_net, oldflp->flowi_oif); | |
935 | + if (oldflp->flowidn_oif) { | |
936 | + dev_out = dev_get_by_index(&init_net, oldflp->flowidn_oif); | |
936 | 937 | err = -ENODEV; |
937 | 938 | if (dev_out && dev_out->dn_ptr == NULL) { |
938 | 939 | dev_put(dev_out); |
939 | 940 | |
... | ... | @@ -943,11 +944,11 @@ |
943 | 944 | } |
944 | 945 | |
945 | 946 | /* If we have a source address, verify that its a local address */ |
946 | - if (oldflp->fld_src) { | |
947 | + if (oldflp->saddr) { | |
947 | 948 | err = -EADDRNOTAVAIL; |
948 | 949 | |
949 | 950 | if (dev_out) { |
950 | - if (dn_dev_islocal(dev_out, oldflp->fld_src)) | |
951 | + if (dn_dev_islocal(dev_out, oldflp->saddr)) | |
951 | 952 | goto source_ok; |
952 | 953 | dev_put(dev_out); |
953 | 954 | goto out; |
954 | 955 | |
... | ... | @@ -956,11 +957,11 @@ |
956 | 957 | for_each_netdev_rcu(&init_net, dev) { |
957 | 958 | if (!dev->dn_ptr) |
958 | 959 | continue; |
959 | - if (!dn_dev_islocal(dev, oldflp->fld_src)) | |
960 | + if (!dn_dev_islocal(dev, oldflp->saddr)) | |
960 | 961 | continue; |
961 | 962 | if ((dev->flags & IFF_LOOPBACK) && |
962 | - oldflp->fld_dst && | |
963 | - !dn_dev_islocal(dev, oldflp->fld_dst)) | |
963 | + oldflp->daddr && | |
964 | + !dn_dev_islocal(dev, oldflp->daddr)) | |
964 | 965 | continue; |
965 | 966 | |
966 | 967 | dev_out = dev; |
967 | 968 | |
968 | 969 | |
969 | 970 | |
... | ... | @@ -975,22 +976,22 @@ |
975 | 976 | } |
976 | 977 | |
977 | 978 | /* No destination? Assume its local */ |
978 | - if (!fl.fld_dst) { | |
979 | - fl.fld_dst = fl.fld_src; | |
979 | + if (!fld.daddr) { | |
980 | + fld.daddr = fld.saddr; | |
980 | 981 | |
981 | 982 | err = -EADDRNOTAVAIL; |
982 | 983 | if (dev_out) |
983 | 984 | dev_put(dev_out); |
984 | 985 | dev_out = init_net.loopback_dev; |
985 | 986 | dev_hold(dev_out); |
986 | - if (!fl.fld_dst) { | |
987 | - fl.fld_dst = | |
988 | - fl.fld_src = dnet_select_source(dev_out, 0, | |
987 | + if (!fld.daddr) { | |
988 | + fld.daddr = | |
989 | + fld.saddr = dnet_select_source(dev_out, 0, | |
989 | 990 | RT_SCOPE_HOST); |
990 | - if (!fl.fld_dst) | |
991 | + if (!fld.daddr) | |
991 | 992 | goto out; |
992 | 993 | } |
993 | - fl.flowi_oif = init_net.loopback_dev->ifindex; | |
994 | + fld.flowidn_oif = init_net.loopback_dev->ifindex; | |
994 | 995 | res.type = RTN_LOCAL; |
995 | 996 | goto make_route; |
996 | 997 | } |
... | ... | @@ -999,8 +1000,8 @@ |
999 | 1000 | printk(KERN_DEBUG |
1000 | 1001 | "dn_route_output_slow: initial checks complete." |
1001 | 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 | - fl.flowi_oif, try_hard); | |
1003 | + le16_to_cpu(fld.daddr), le16_to_cpu(fld.saddr), | |
1004 | + fld.flowidn_oif, try_hard); | |
1004 | 1005 | |
1005 | 1006 | /* |
1006 | 1007 | * N.B. If the kernel is compiled without router support then |
... | ... | @@ -1008,7 +1009,7 @@ |
1008 | 1009 | * will always be executed. |
1009 | 1010 | */ |
1010 | 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 | 1013 | struct dn_dev *dn_db; |
1013 | 1014 | if (err != -ESRCH) |
1014 | 1015 | goto out; |
1015 | 1016 | |
1016 | 1017 | |
1017 | 1018 | |
... | ... | @@ -1023,19 +1024,19 @@ |
1023 | 1024 | * here |
1024 | 1025 | */ |
1025 | 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 | 1028 | if (neigh) { |
1028 | - if ((oldflp->flowi_oif && | |
1029 | - (neigh->dev->ifindex != oldflp->flowi_oif)) || | |
1030 | - (oldflp->fld_src && | |
1029 | + if ((oldflp->flowidn_oif && | |
1030 | + (neigh->dev->ifindex != oldflp->flowidn_oif)) || | |
1031 | + (oldflp->saddr && | |
1031 | 1032 | (!dn_dev_islocal(neigh->dev, |
1032 | - oldflp->fld_src)))) { | |
1033 | + oldflp->saddr)))) { | |
1033 | 1034 | neigh_release(neigh); |
1034 | 1035 | neigh = NULL; |
1035 | 1036 | } else { |
1036 | 1037 | if (dev_out) |
1037 | 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 | 1040 | dev_out = init_net.loopback_dev; |
1040 | 1041 | res.type = RTN_LOCAL; |
1041 | 1042 | } else { |
... | ... | @@ -1055,7 +1056,7 @@ |
1055 | 1056 | goto out; |
1056 | 1057 | dn_db = rcu_dereference_raw(dev_out->dn_ptr); |
1057 | 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 | 1060 | dev_put(dev_out); |
1060 | 1061 | dev_out = init_net.loopback_dev; |
1061 | 1062 | dev_hold(dev_out); |
1062 | 1063 | |
... | ... | @@ -1071,16 +1072,16 @@ |
1071 | 1072 | if (neigh) |
1072 | 1073 | gateway = ((struct dn_neigh *)neigh)->addr; |
1073 | 1074 | if (gateway == 0) |
1074 | - gateway = fl.fld_dst; | |
1075 | - if (fl.fld_src == 0) { | |
1076 | - fl.fld_src = dnet_select_source(dev_out, gateway, | |
1077 | - res.type == RTN_LOCAL ? | |
1078 | - RT_SCOPE_HOST : | |
1079 | - RT_SCOPE_LINK); | |
1080 | - if (fl.fld_src == 0 && res.type != RTN_LOCAL) | |
1075 | + gateway = fld.daddr; | |
1076 | + if (fld.saddr == 0) { | |
1077 | + fld.saddr = dnet_select_source(dev_out, gateway, | |
1078 | + res.type == RTN_LOCAL ? | |
1079 | + RT_SCOPE_HOST : | |
1080 | + RT_SCOPE_LINK); | |
1081 | + if (fld.saddr == 0 && res.type != RTN_LOCAL) | |
1081 | 1082 | goto e_addr; |
1082 | 1083 | } |
1083 | - fl.flowi_oif = dev_out->ifindex; | |
1084 | + fld.flowidn_oif = dev_out->ifindex; | |
1084 | 1085 | goto make_route; |
1085 | 1086 | } |
1086 | 1087 | free_res = 1; |
1087 | 1088 | |
1088 | 1089 | |
1089 | 1090 | |
1090 | 1091 | |
... | ... | @@ -1089,35 +1090,35 @@ |
1089 | 1090 | goto e_inval; |
1090 | 1091 | |
1091 | 1092 | if (res.type == RTN_LOCAL) { |
1092 | - if (!fl.fld_src) | |
1093 | - fl.fld_src = fl.fld_dst; | |
1093 | + if (!fld.saddr) | |
1094 | + fld.saddr = fld.daddr; | |
1094 | 1095 | if (dev_out) |
1095 | 1096 | dev_put(dev_out); |
1096 | 1097 | dev_out = init_net.loopback_dev; |
1097 | 1098 | dev_hold(dev_out); |
1098 | - fl.flowi_oif = dev_out->ifindex; | |
1099 | + fld.flowidn_oif = dev_out->ifindex; | |
1099 | 1100 | if (res.fi) |
1100 | 1101 | dn_fib_info_put(res.fi); |
1101 | 1102 | res.fi = NULL; |
1102 | 1103 | goto make_route; |
1103 | 1104 | } |
1104 | 1105 | |
1105 | - if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0) | |
1106 | - dn_fib_select_multipath(&fl, &res); | |
1106 | + if (res.fi->fib_nhs > 1 && fld.flowidn_oif == 0) | |
1107 | + dn_fib_select_multipath(&fld, &res); | |
1107 | 1108 | |
1108 | 1109 | /* |
1109 | 1110 | * We could add some logic to deal with default routes here and |
1110 | 1111 | * get rid of some of the special casing above. |
1111 | 1112 | */ |
1112 | 1113 | |
1113 | - if (!fl.fld_src) | |
1114 | - fl.fld_src = DN_FIB_RES_PREFSRC(res); | |
1114 | + if (!fld.saddr) | |
1115 | + fld.saddr = DN_FIB_RES_PREFSRC(res); | |
1115 | 1116 | |
1116 | 1117 | if (dev_out) |
1117 | 1118 | dev_put(dev_out); |
1118 | 1119 | dev_out = DN_FIB_RES_DEV(res); |
1119 | 1120 | dev_hold(dev_out); |
1120 | - fl.flowi_oif = dev_out->ifindex; | |
1121 | + fld.flowidn_oif = dev_out->ifindex; | |
1121 | 1122 | gateway = DN_FIB_RES_GW(res); |
1122 | 1123 | |
1123 | 1124 | make_route: |
1124 | 1125 | |
1125 | 1126 | |
... | ... | @@ -1131,19 +1132,19 @@ |
1131 | 1132 | atomic_set(&rt->dst.__refcnt, 1); |
1132 | 1133 | rt->dst.flags = DST_HOST; |
1133 | 1134 | |
1134 | - rt->fl.fld_src = oldflp->fld_src; | |
1135 | - rt->fl.fld_dst = oldflp->fld_dst; | |
1136 | - rt->fl.flowi_oif = oldflp->flowi_oif; | |
1137 | - rt->fl.flowi_iif = 0; | |
1138 | - rt->fl.flowi_mark = oldflp->flowi_mark; | |
1135 | + rt->fld.saddr = oldflp->saddr; | |
1136 | + rt->fld.daddr = oldflp->daddr; | |
1137 | + rt->fld.flowidn_oif = oldflp->flowidn_oif; | |
1138 | + rt->fld.flowidn_iif = 0; | |
1139 | + rt->fld.flowidn_mark = oldflp->flowidn_mark; | |
1139 | 1140 | |
1140 | - rt->rt_saddr = fl.fld_src; | |
1141 | - rt->rt_daddr = fl.fld_dst; | |
1142 | - rt->rt_gateway = gateway ? gateway : fl.fld_dst; | |
1143 | - rt->rt_local_src = fl.fld_src; | |
1141 | + rt->rt_saddr = fld.saddr; | |
1142 | + rt->rt_daddr = fld.daddr; | |
1143 | + rt->rt_gateway = gateway ? gateway : fld.daddr; | |
1144 | + rt->rt_local_src = fld.saddr; | |
1144 | 1145 | |
1145 | - rt->rt_dst_map = fl.fld_dst; | |
1146 | - rt->rt_src_map = fl.fld_src; | |
1146 | + rt->rt_dst_map = fld.daddr; | |
1147 | + rt->rt_src_map = fld.saddr; | |
1147 | 1148 | |
1148 | 1149 | rt->dst.dev = dev_out; |
1149 | 1150 | dev_hold(dev_out); |
... | ... | @@ -1161,7 +1162,7 @@ |
1161 | 1162 | if (err) |
1162 | 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 | 1166 | dn_insert_route(rt, hash, (struct dn_route **)pprt); |
1166 | 1167 | |
1167 | 1168 | done: |
1168 | 1169 | |
1169 | 1170 | |
1170 | 1171 | |
... | ... | @@ -1192,20 +1193,20 @@ |
1192 | 1193 | /* |
1193 | 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 | 1199 | struct dn_route *rt = NULL; |
1199 | 1200 | |
1200 | 1201 | if (!(flags & MSG_TRYHARD)) { |
1201 | 1202 | rcu_read_lock_bh(); |
1202 | 1203 | for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; |
1203 | 1204 | rt = rcu_dereference_bh(rt->dst.dn_next)) { |
1204 | - if ((flp->fld_dst == rt->fl.fld_dst) && | |
1205 | - (flp->fld_src == rt->fl.fld_src) && | |
1206 | - (flp->flowi_mark == rt->fl.flowi_mark) && | |
1205 | + if ((flp->daddr == rt->fld.daddr) && | |
1206 | + (flp->saddr == rt->fld.saddr) && | |
1207 | + (flp->flowidn_mark == rt->fld.flowidn_mark) && | |
1207 | 1208 | dn_is_output_route(rt) && |
1208 | - (rt->fl.flowi_oif == flp->flowi_oif)) { | |
1209 | + (rt->fld.flowidn_oif == flp->flowidn_oif)) { | |
1209 | 1210 | dst_use(&rt->dst, jiffies); |
1210 | 1211 | rcu_read_unlock_bh(); |
1211 | 1212 | *pprt = &rt->dst; |
1212 | 1213 | |
... | ... | @@ -1218,13 +1219,14 @@ |
1218 | 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 | 1224 | int err; |
1224 | 1225 | |
1225 | 1226 | err = __dn_route_output_key(pprt, flp, flags); |
1226 | - if (err == 0 && flp->flowi_proto) { | |
1227 | - *pprt = xfrm_lookup(&init_net, *pprt, flp, NULL, 0); | |
1227 | + if (err == 0 && flp->flowidn_proto) { | |
1228 | + *pprt = xfrm_lookup(&init_net, *pprt, | |
1229 | + flowidn_to_flowi(flp), NULL, 0); | |
1228 | 1230 | if (IS_ERR(*pprt)) { |
1229 | 1231 | err = PTR_ERR(*pprt); |
1230 | 1232 | *pprt = NULL; |
1231 | 1233 | |
1232 | 1234 | |
... | ... | @@ -1233,15 +1235,16 @@ |
1233 | 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 | 1240 | int err; |
1239 | 1241 | |
1240 | 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 | 1244 | if (!(flags & MSG_DONTWAIT)) |
1243 | - fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP; | |
1244 | - *pprt = xfrm_lookup(&init_net, *pprt, fl, sk, 0); | |
1245 | + fl->flowidn_flags |= FLOWI_FLAG_CAN_SLEEP; | |
1246 | + *pprt = xfrm_lookup(&init_net, *pprt, | |
1247 | + flowidn_to_flowi(fl), sk, 0); | |
1245 | 1248 | if (IS_ERR(*pprt)) { |
1246 | 1249 | err = PTR_ERR(*pprt); |
1247 | 1250 | *pprt = NULL; |
... | ... | @@ -1262,12 +1265,12 @@ |
1262 | 1265 | int flags = 0; |
1263 | 1266 | __le16 gateway = 0; |
1264 | 1267 | __le16 local_src = 0; |
1265 | - struct flowi fl = { | |
1266 | - .fld_dst = cb->dst, | |
1267 | - .fld_src = cb->src, | |
1268 | - .fld_scope = RT_SCOPE_UNIVERSE, | |
1269 | - .flowi_mark = skb->mark, | |
1270 | - .flowi_iif = skb->dev->ifindex, | |
1268 | + struct flowidn fld = { | |
1269 | + .daddr = cb->dst, | |
1270 | + .saddr = cb->src, | |
1271 | + .flowidn_scope = RT_SCOPE_UNIVERSE, | |
1272 | + .flowidn_mark = skb->mark, | |
1273 | + .flowidn_iif = skb->dev->ifindex, | |
1271 | 1274 | }; |
1272 | 1275 | struct dn_fib_res res = { .fi = NULL, .type = RTN_UNREACHABLE }; |
1273 | 1276 | int err = -EINVAL; |
... | ... | @@ -1279,7 +1282,7 @@ |
1279 | 1282 | goto out; |
1280 | 1283 | |
1281 | 1284 | /* Zero source addresses are not allowed */ |
1282 | - if (fl.fld_src == 0) | |
1285 | + if (fld.saddr == 0) | |
1283 | 1286 | goto out; |
1284 | 1287 | |
1285 | 1288 | /* |
... | ... | @@ -1293,7 +1296,7 @@ |
1293 | 1296 | if (dn_dev_islocal(in_dev, cb->src)) |
1294 | 1297 | goto out; |
1295 | 1298 | |
1296 | - err = dn_fib_lookup(&fl, &res); | |
1299 | + err = dn_fib_lookup(&fld, &res); | |
1297 | 1300 | if (err) { |
1298 | 1301 | if (err != -ESRCH) |
1299 | 1302 | goto out; |
... | ... | @@ -1305,7 +1308,7 @@ |
1305 | 1308 | |
1306 | 1309 | res.type = RTN_LOCAL; |
1307 | 1310 | } else { |
1308 | - __le16 src_map = fl.fld_src; | |
1311 | + __le16 src_map = fld.saddr; | |
1309 | 1312 | free_res = 1; |
1310 | 1313 | |
1311 | 1314 | out_dev = DN_FIB_RES_DEV(res); |
1312 | 1315 | |
1313 | 1316 | |
1314 | 1317 | |
1315 | 1318 | |
... | ... | @@ -1318,22 +1321,22 @@ |
1318 | 1321 | dev_hold(out_dev); |
1319 | 1322 | |
1320 | 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 | 1326 | gateway = DN_FIB_RES_GW(res); |
1324 | 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 | 1329 | dn_fib_res_put(&res); |
1327 | 1330 | free_res = 0; |
1328 | - if (dn_fib_lookup(&fl, &res)) | |
1331 | + if (dn_fib_lookup(&fld, &res)) | |
1329 | 1332 | goto e_inval; |
1330 | 1333 | free_res = 1; |
1331 | 1334 | if (res.type != RTN_UNICAST) |
1332 | 1335 | goto e_inval; |
1333 | 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 | 1342 | switch(res.type) { |
... | ... | @@ -1347,8 +1350,8 @@ |
1347 | 1350 | if (dn_db->parms.forwarding == 0) |
1348 | 1351 | goto e_inval; |
1349 | 1352 | |
1350 | - if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0) | |
1351 | - dn_fib_select_multipath(&fl, &res); | |
1353 | + if (res.fi->fib_nhs > 1 && fld.flowidn_oif == 0) | |
1354 | + dn_fib_select_multipath(&fld, &res); | |
1352 | 1355 | |
1353 | 1356 | /* |
1354 | 1357 | * Check for out_dev == in_dev. We use the RTCF_DOREDIRECT |
... | ... | @@ -1366,8 +1369,8 @@ |
1366 | 1369 | break; |
1367 | 1370 | case RTN_LOCAL: |
1368 | 1371 | flags |= RTCF_LOCAL; |
1369 | - fl.fld_src = cb->dst; | |
1370 | - fl.fld_dst = cb->src; | |
1372 | + fld.saddr = cb->dst; | |
1373 | + fld.daddr = cb->src; | |
1371 | 1374 | |
1372 | 1375 | /* Routing tables gave us a gateway */ |
1373 | 1376 | if (gateway) |
1374 | 1377 | |
1375 | 1378 | |
... | ... | @@ -1400,21 +1403,21 @@ |
1400 | 1403 | if (rt == NULL) |
1401 | 1404 | goto e_nobufs; |
1402 | 1405 | |
1403 | - rt->rt_saddr = fl.fld_src; | |
1404 | - rt->rt_daddr = fl.fld_dst; | |
1405 | - rt->rt_gateway = fl.fld_dst; | |
1406 | + rt->rt_saddr = fld.saddr; | |
1407 | + rt->rt_daddr = fld.daddr; | |
1408 | + rt->rt_gateway = fld.daddr; | |
1406 | 1409 | if (gateway) |
1407 | 1410 | rt->rt_gateway = gateway; |
1408 | 1411 | rt->rt_local_src = local_src ? local_src : rt->rt_saddr; |
1409 | 1412 | |
1410 | - rt->rt_dst_map = fl.fld_dst; | |
1411 | - rt->rt_src_map = fl.fld_src; | |
1413 | + rt->rt_dst_map = fld.daddr; | |
1414 | + rt->rt_src_map = fld.saddr; | |
1412 | 1415 | |
1413 | - rt->fl.fld_src = cb->src; | |
1414 | - rt->fl.fld_dst = cb->dst; | |
1415 | - rt->fl.flowi_oif = 0; | |
1416 | - rt->fl.flowi_iif = in_dev->ifindex; | |
1417 | - rt->fl.flowi_mark = fl.flowi_mark; | |
1416 | + rt->fld.saddr = cb->src; | |
1417 | + rt->fld.daddr = cb->dst; | |
1418 | + rt->fld.flowidn_oif = 0; | |
1419 | + rt->fld.flowidn_iif = in_dev->ifindex; | |
1420 | + rt->fld.flowidn_mark = fld.flowidn_mark; | |
1418 | 1421 | |
1419 | 1422 | rt->dst.flags = DST_HOST; |
1420 | 1423 | rt->dst.neighbour = neigh; |
... | ... | @@ -1444,7 +1447,7 @@ |
1444 | 1447 | if (err) |
1445 | 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 | 1451 | dn_insert_route(rt, hash, &rt); |
1449 | 1452 | skb_dst_set(skb, &rt->dst); |
1450 | 1453 | |
... | ... | @@ -1484,11 +1487,11 @@ |
1484 | 1487 | rcu_read_lock(); |
1485 | 1488 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; |
1486 | 1489 | rt = rcu_dereference(rt->dst.dn_next)) { |
1487 | - if ((rt->fl.fld_src == cb->src) && | |
1488 | - (rt->fl.fld_dst == cb->dst) && | |
1489 | - (rt->fl.flowi_oif == 0) && | |
1490 | - (rt->fl.flowi_mark == skb->mark) && | |
1491 | - (rt->fl.flowi_iif == cb->iif)) { | |
1490 | + if ((rt->fld.saddr == cb->src) && | |
1491 | + (rt->fld.daddr == cb->dst) && | |
1492 | + (rt->fld.flowidn_oif == 0) && | |
1493 | + (rt->fld.flowidn_mark == skb->mark) && | |
1494 | + (rt->fld.flowidn_iif == cb->iif)) { | |
1492 | 1495 | dst_use(&rt->dst, jiffies); |
1493 | 1496 | rcu_read_unlock(); |
1494 | 1497 | skb_dst_set(skb, (struct dst_entry *)rt); |
1495 | 1498 | |
... | ... | @@ -1524,9 +1527,9 @@ |
1524 | 1527 | if (rt->rt_flags & RTCF_NOTIFY) |
1525 | 1528 | r->rtm_flags |= RTM_F_NOTIFY; |
1526 | 1529 | RTA_PUT(skb, RTA_DST, 2, &rt->rt_daddr); |
1527 | - if (rt->fl.fld_src) { | |
1530 | + if (rt->fld.saddr) { | |
1528 | 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 | 1534 | if (rt->dst.dev) |
1532 | 1535 | RTA_PUT(skb, RTA_OIF, sizeof(int), &rt->dst.dev->ifindex); |
... | ... | @@ -1545,7 +1548,7 @@ |
1545 | 1548 | rt->dst.error) < 0) |
1546 | 1549 | goto rtattr_failure; |
1547 | 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 | 1553 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1551 | 1554 | return skb->len; |
1552 | 1555 | |
... | ... | @@ -1568,13 +1571,13 @@ |
1568 | 1571 | struct dn_skb_cb *cb; |
1569 | 1572 | int err; |
1570 | 1573 | struct sk_buff *skb; |
1571 | - struct flowi fl; | |
1574 | + struct flowidn fld; | |
1572 | 1575 | |
1573 | 1576 | if (!net_eq(net, &init_net)) |
1574 | 1577 | return -EINVAL; |
1575 | 1578 | |
1576 | - memset(&fl, 0, sizeof(fl)); | |
1577 | - fl.flowi_proto = DNPROTO_NSP; | |
1579 | + memset(&fld, 0, sizeof(fld)); | |
1580 | + fld.flowidn_proto = DNPROTO_NSP; | |
1578 | 1581 | |
1579 | 1582 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); |
1580 | 1583 | if (skb == NULL) |
1581 | 1584 | |
1582 | 1585 | |
1583 | 1586 | |
1584 | 1587 | |
... | ... | @@ -1583,15 +1586,15 @@ |
1583 | 1586 | cb = DN_SKB_CB(skb); |
1584 | 1587 | |
1585 | 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 | 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 | 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 | 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 | 1598 | kfree_skb(skb); |
1596 | 1599 | return -ENODEV; |
1597 | 1600 | } |
... | ... | @@ -1602,8 +1605,8 @@ |
1602 | 1605 | } |
1603 | 1606 | skb->protocol = htons(ETH_P_DNA_RT); |
1604 | 1607 | skb->dev = dev; |
1605 | - cb->src = fl.fld_src; | |
1606 | - cb->dst = fl.fld_dst; | |
1608 | + cb->src = fld.saddr; | |
1609 | + cb->dst = fld.daddr; | |
1607 | 1610 | local_bh_disable(); |
1608 | 1611 | err = dn_route_input(skb); |
1609 | 1612 | local_bh_enable(); |
... | ... | @@ -1615,8 +1618,8 @@ |
1615 | 1618 | int oif = 0; |
1616 | 1619 | if (rta[RTA_OIF - 1]) |
1617 | 1620 | memcpy(&oif, RTA_DATA(rta[RTA_OIF - 1]), sizeof(int)); |
1618 | - fl.flowi_oif = oif; | |
1619 | - err = dn_route_output_key((struct dst_entry **)&rt, &fl, 0); | |
1621 | + fld.flowidn_oif = oif; | |
1622 | + err = dn_route_output_key((struct dst_entry **)&rt, &fld, 0); | |
1620 | 1623 | } |
1621 | 1624 | |
1622 | 1625 | if (skb->dev) |
net/decnet/dn_rules.c
... | ... | @@ -49,14 +49,15 @@ |
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 | 54 | struct fib_lookup_arg arg = { |
55 | 55 | .result = res, |
56 | 56 | }; |
57 | 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 | 61 | res->r = arg.rule; |
61 | 62 | |
62 | 63 | return err; |
... | ... | @@ -65,6 +66,7 @@ |
65 | 66 | static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp, |
66 | 67 | int flags, struct fib_lookup_arg *arg) |
67 | 68 | { |
69 | + struct flowidn *fld = &flp->u.dn; | |
68 | 70 | int err = -EAGAIN; |
69 | 71 | struct dn_fib_table *tbl; |
70 | 72 | |
... | ... | @@ -90,7 +92,7 @@ |
90 | 92 | if (tbl == NULL) |
91 | 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 | 96 | if (err > 0) |
95 | 97 | err = -EAGAIN; |
96 | 98 | errout: |
... | ... | @@ -104,8 +106,9 @@ |
104 | 106 | static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) |
105 | 107 | { |
106 | 108 | struct dn_fib_rule *r = (struct dn_fib_rule *)rule; |
107 | - __le16 daddr = fl->fld_dst; | |
108 | - __le16 saddr = fl->fld_src; | |
109 | + struct flowidn *fld = &fl->u.dn; | |
110 | + __le16 daddr = fld->daddr; | |
111 | + __le16 saddr = fld->saddr; | |
109 | 112 | |
110 | 113 | if (((saddr ^ r->src) & r->srcmask) || |
111 | 114 | ((daddr ^ r->dst) & r->dstmask)) |
... | ... | @@ -175,7 +178,7 @@ |
175 | 178 | |
176 | 179 | unsigned dnet_addr_type(__le16 addr) |
177 | 180 | { |
178 | - struct flowi fl = { .fld_dst = addr }; | |
181 | + struct flowidn fld = { .daddr = addr }; | |
179 | 182 | struct dn_fib_res res; |
180 | 183 | unsigned ret = RTN_UNICAST; |
181 | 184 | struct dn_fib_table *tb = dn_fib_get_table(RT_TABLE_LOCAL, 0); |
... | ... | @@ -183,7 +186,7 @@ |
183 | 186 | res.r = NULL; |
184 | 187 | |
185 | 188 | if (tb) { |
186 | - if (!tb->lookup(tb, &fl, &res)) { | |
189 | + if (!tb->lookup(tb, &fld, &res)) { | |
187 | 190 | ret = res.type; |
188 | 191 | dn_fib_res_put(&res); |
189 | 192 | } |
net/decnet/dn_table.c
... | ... | @@ -764,7 +764,7 @@ |
764 | 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 | 769 | int err; |
770 | 770 | struct dn_zone *dz; |
... | ... | @@ -773,7 +773,7 @@ |
773 | 773 | read_lock(&dn_fib_tables_lock); |
774 | 774 | for(dz = t->dh_zone_list; dz; dz = dz->dz_next) { |
775 | 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 | 778 | for(f = dz_chain(k, dz); f; f = f->fn_next) { |
779 | 779 | if (!dn_key_eq(k, f->fn_key)) { |
... | ... | @@ -788,7 +788,7 @@ |
788 | 788 | if (f->fn_state&DN_S_ZOMBIE) |
789 | 789 | continue; |
790 | 790 | |
791 | - if (f->fn_scope < flp->fld_scope) | |
791 | + if (f->fn_scope < flp->flowidn_scope) | |
792 | 792 | continue; |
793 | 793 | |
794 | 794 | err = dn_fib_semantic_match(f->fn_type, DN_FIB_INFO(f), flp, res); |