diff options
author | Changli Gao <xiaosuo@gmail.com> | 2010-11-12 13:43:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-17 15:27:45 -0500 |
commit | 5811662b15db018c740c57d037523683fd3e6123 (patch) | |
tree | f820610a6024799a26699f22dc9a4ef5dee07978 /net/ipv4 | |
parent | dd68ad2235b4625e0dc928b2b4c614d265f976d3 (diff) |
net: use the macros defined for the members of flowi
Use the macros defined for the members of flowi to clean the code up.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/af_inet.c | 18 | ||||
-rw-r--r-- | net/ipv4/arp.c | 12 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 28 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 8 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 28 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 8 | ||||
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 15 | ||||
-rw-r--r-- | net/ipv4/ip_gre.c | 31 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 25 | ||||
-rw-r--r-- | net/ipv4/ipip.c | 20 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 18 | ||||
-rw-r--r-- | net/ipv4/netfilter.c | 8 | ||||
-rw-r--r-- | net/ipv4/raw.c | 7 | ||||
-rw-r--r-- | net/ipv4/route.c | 43 | ||||
-rw-r--r-- | net/ipv4/syncookies.c | 15 | ||||
-rw-r--r-- | net/ipv4/udp.c | 12 | ||||
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 8 |
17 files changed, 106 insertions, 198 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index f581f77d1097..f2b61107df6c 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1148,21 +1148,13 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1148 | struct flowi fl = { | 1148 | struct flowi fl = { |
1149 | .oif = sk->sk_bound_dev_if, | 1149 | .oif = sk->sk_bound_dev_if, |
1150 | .mark = sk->sk_mark, | 1150 | .mark = sk->sk_mark, |
1151 | .nl_u = { | 1151 | .fl4_dst = daddr, |
1152 | .ip4_u = { | 1152 | .fl4_src = inet->inet_saddr, |
1153 | .daddr = daddr, | 1153 | .fl4_tos = RT_CONN_FLAGS(sk), |
1154 | .saddr = inet->inet_saddr, | ||
1155 | .tos = RT_CONN_FLAGS(sk), | ||
1156 | }, | ||
1157 | }, | ||
1158 | .proto = sk->sk_protocol, | 1154 | .proto = sk->sk_protocol, |
1159 | .flags = inet_sk_flowi_flags(sk), | 1155 | .flags = inet_sk_flowi_flags(sk), |
1160 | .uli_u = { | 1156 | .fl_ip_sport = inet->inet_sport, |
1161 | .ports = { | 1157 | .fl_ip_dport = inet->inet_dport, |
1162 | .sport = inet->inet_sport, | ||
1163 | .dport = inet->inet_dport, | ||
1164 | }, | ||
1165 | }, | ||
1166 | }; | 1158 | }; |
1167 | 1159 | ||
1168 | security_sk_classify_flow(sk, &fl); | 1160 | security_sk_classify_flow(sk, &fl); |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index d8e540c5b071..7833f17b648a 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -433,8 +433,8 @@ static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) | |||
433 | 433 | ||
434 | static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) | 434 | static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) |
435 | { | 435 | { |
436 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, | 436 | struct flowi fl = { .fl4_dst = sip, |
437 | .saddr = tip } } }; | 437 | .fl4_src = tip }; |
438 | struct rtable *rt; | 438 | struct rtable *rt; |
439 | int flag = 0; | 439 | int flag = 0; |
440 | /*unsigned long now; */ | 440 | /*unsigned long now; */ |
@@ -1061,8 +1061,8 @@ static int arp_req_set(struct net *net, struct arpreq *r, | |||
1061 | if (r->arp_flags & ATF_PERM) | 1061 | if (r->arp_flags & ATF_PERM) |
1062 | r->arp_flags |= ATF_COM; | 1062 | r->arp_flags |= ATF_COM; |
1063 | if (dev == NULL) { | 1063 | if (dev == NULL) { |
1064 | struct flowi fl = { .nl_u.ip4_u = { .daddr = ip, | 1064 | struct flowi fl = { .fl4_dst = ip, |
1065 | .tos = RTO_ONLINK } }; | 1065 | .fl4_tos = RTO_ONLINK }; |
1066 | struct rtable *rt; | 1066 | struct rtable *rt; |
1067 | err = ip_route_output_key(net, &rt, &fl); | 1067 | err = ip_route_output_key(net, &rt, &fl); |
1068 | if (err != 0) | 1068 | if (err != 0) |
@@ -1169,8 +1169,8 @@ static int arp_req_delete(struct net *net, struct arpreq *r, | |||
1169 | 1169 | ||
1170 | ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; | 1170 | ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; |
1171 | if (dev == NULL) { | 1171 | if (dev == NULL) { |
1172 | struct flowi fl = { .nl_u.ip4_u = { .daddr = ip, | 1172 | struct flowi fl = { .fl4_dst = ip, |
1173 | .tos = RTO_ONLINK } }; | 1173 | .fl4_tos = RTO_ONLINK }; |
1174 | struct rtable *rt; | 1174 | struct rtable *rt; |
1175 | err = ip_route_output_key(net, &rt, &fl); | 1175 | err = ip_route_output_key(net, &rt, &fl); |
1176 | if (err != 0) | 1176 | if (err != 0) |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index eb6f69a8f27a..d3a1112b9d9c 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -158,11 +158,7 @@ static void fib_flush(struct net *net) | |||
158 | struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) | 158 | struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) |
159 | { | 159 | { |
160 | struct flowi fl = { | 160 | struct flowi fl = { |
161 | .nl_u = { | 161 | .fl4_dst = addr, |
162 | .ip4_u = { | ||
163 | .daddr = addr | ||
164 | } | ||
165 | }, | ||
166 | .flags = FLOWI_FLAG_MATCH_ANY_IIF | 162 | .flags = FLOWI_FLAG_MATCH_ANY_IIF |
167 | }; | 163 | }; |
168 | struct fib_result res = { 0 }; | 164 | struct fib_result res = { 0 }; |
@@ -193,7 +189,7 @@ static inline unsigned __inet_dev_addr_type(struct net *net, | |||
193 | const struct net_device *dev, | 189 | const struct net_device *dev, |
194 | __be32 addr) | 190 | __be32 addr) |
195 | { | 191 | { |
196 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; | 192 | struct flowi fl = { .fl4_dst = addr }; |
197 | struct fib_result res; | 193 | struct fib_result res; |
198 | unsigned ret = RTN_BROADCAST; | 194 | unsigned ret = RTN_BROADCAST; |
199 | struct fib_table *local_table; | 195 | struct fib_table *local_table; |
@@ -247,13 +243,9 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
247 | { | 243 | { |
248 | struct in_device *in_dev; | 244 | struct in_device *in_dev; |
249 | struct flowi fl = { | 245 | struct flowi fl = { |
250 | .nl_u = { | 246 | .fl4_dst = src, |
251 | .ip4_u = { | 247 | .fl4_src = dst, |
252 | .daddr = src, | 248 | .fl4_tos = tos, |
253 | .saddr = dst, | ||
254 | .tos = tos | ||
255 | } | ||
256 | }, | ||
257 | .mark = mark, | 249 | .mark = mark, |
258 | .iif = oif | 250 | .iif = oif |
259 | }; | 251 | }; |
@@ -853,13 +845,9 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb) | |||
853 | struct fib_result res; | 845 | struct fib_result res; |
854 | struct flowi fl = { | 846 | struct flowi fl = { |
855 | .mark = frn->fl_mark, | 847 | .mark = frn->fl_mark, |
856 | .nl_u = { | 848 | .fl4_dst = frn->fl_addr, |
857 | .ip4_u = { | 849 | .fl4_tos = frn->fl_tos, |
858 | .daddr = frn->fl_addr, | 850 | .fl4_scope = frn->fl_scope, |
859 | .tos = frn->fl_tos, | ||
860 | .scope = frn->fl_scope | ||
861 | } | ||
862 | } | ||
863 | }; | 851 | }; |
864 | 852 | ||
865 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 853 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 3e0da3ef6116..12d3dc3df1b7 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -563,12 +563,8 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, | |||
563 | rcu_read_lock(); | 563 | rcu_read_lock(); |
564 | { | 564 | { |
565 | struct flowi fl = { | 565 | struct flowi fl = { |
566 | .nl_u = { | 566 | .fl4_dst = nh->nh_gw, |
567 | .ip4_u = { | 567 | .fl4_scope = cfg->fc_scope + 1, |
568 | .daddr = nh->nh_gw, | ||
569 | .scope = cfg->fc_scope + 1, | ||
570 | }, | ||
571 | }, | ||
572 | .oif = nh->nh_oif, | 568 | .oif = nh->nh_oif, |
573 | }; | 569 | }; |
574 | 570 | ||
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index c6e2affafbd3..4daebd17b6ed 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -386,10 +386,9 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) | |||
386 | daddr = icmp_param->replyopts.faddr; | 386 | daddr = icmp_param->replyopts.faddr; |
387 | } | 387 | } |
388 | { | 388 | { |
389 | struct flowi fl = { .nl_u = { .ip4_u = | 389 | struct flowi fl = { .fl4_dst= daddr, |
390 | { .daddr = daddr, | 390 | .fl4_src = rt->rt_spec_dst, |
391 | .saddr = rt->rt_spec_dst, | 391 | .fl4_tos = RT_TOS(ip_hdr(skb)->tos), |
392 | .tos = RT_TOS(ip_hdr(skb)->tos) } }, | ||
393 | .proto = IPPROTO_ICMP }; | 392 | .proto = IPPROTO_ICMP }; |
394 | security_skb_classify_flow(skb, &fl); | 393 | security_skb_classify_flow(skb, &fl); |
395 | if (ip_route_output_key(net, &rt, &fl)) | 394 | if (ip_route_output_key(net, &rt, &fl)) |
@@ -542,22 +541,13 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
542 | 541 | ||
543 | { | 542 | { |
544 | struct flowi fl = { | 543 | struct flowi fl = { |
545 | .nl_u = { | 544 | .fl4_dst = icmp_param.replyopts.srr ? |
546 | .ip4_u = { | 545 | icmp_param.replyopts.faddr : iph->saddr, |
547 | .daddr = icmp_param.replyopts.srr ? | 546 | .fl4_src = saddr, |
548 | icmp_param.replyopts.faddr : | 547 | .fl4_tos = RT_TOS(tos), |
549 | iph->saddr, | ||
550 | .saddr = saddr, | ||
551 | .tos = RT_TOS(tos) | ||
552 | } | ||
553 | }, | ||
554 | .proto = IPPROTO_ICMP, | 548 | .proto = IPPROTO_ICMP, |
555 | .uli_u = { | 549 | .fl_icmp_type = type, |
556 | .icmpt = { | 550 | .fl_icmp_code = code, |
557 | .type = type, | ||
558 | .code = code | ||
559 | } | ||
560 | } | ||
561 | }; | 551 | }; |
562 | int err; | 552 | int err; |
563 | struct rtable *rt2; | 553 | struct rtable *rt2; |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index a1bf2f49e716..afb1e82a59f9 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -314,8 +314,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
314 | 314 | ||
315 | { | 315 | { |
316 | struct flowi fl = { .oif = dev->ifindex, | 316 | struct flowi fl = { .oif = dev->ifindex, |
317 | .nl_u = { .ip4_u = { | 317 | .fl4_dst = IGMPV3_ALL_MCR, |
318 | .daddr = IGMPV3_ALL_MCR } }, | ||
319 | .proto = IPPROTO_IGMP }; | 318 | .proto = IPPROTO_IGMP }; |
320 | if (ip_route_output_key(net, &rt, &fl)) { | 319 | if (ip_route_output_key(net, &rt, &fl)) { |
321 | kfree_skb(skb); | 320 | kfree_skb(skb); |
@@ -660,7 +659,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, | |||
660 | 659 | ||
661 | { | 660 | { |
662 | struct flowi fl = { .oif = dev->ifindex, | 661 | struct flowi fl = { .oif = dev->ifindex, |
663 | .nl_u = { .ip4_u = { .daddr = dst } }, | 662 | .fl4_dst = dst, |
664 | .proto = IPPROTO_IGMP }; | 663 | .proto = IPPROTO_IGMP }; |
665 | if (ip_route_output_key(net, &rt, &fl)) | 664 | if (ip_route_output_key(net, &rt, &fl)) |
666 | return -1; | 665 | return -1; |
@@ -1425,8 +1424,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev) | |||
1425 | /* RTNL is locked */ | 1424 | /* RTNL is locked */ |
1426 | static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr) | 1425 | static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr) |
1427 | { | 1426 | { |
1428 | struct flowi fl = { .nl_u = { .ip4_u = | 1427 | struct flowi fl = { .fl4_dst = imr->imr_multiaddr.s_addr }; |
1429 | { .daddr = imr->imr_multiaddr.s_addr } } }; | ||
1430 | struct rtable *rt; | 1428 | struct rtable *rt; |
1431 | struct net_device *dev = NULL; | 1429 | struct net_device *dev = NULL; |
1432 | struct in_device *idev = NULL; | 1430 | struct in_device *idev = NULL; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 7174370b1195..06f5f8f482f0 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -358,17 +358,14 @@ struct dst_entry *inet_csk_route_req(struct sock *sk, | |||
358 | struct ip_options *opt = inet_rsk(req)->opt; | 358 | struct ip_options *opt = inet_rsk(req)->opt; |
359 | struct flowi fl = { .oif = sk->sk_bound_dev_if, | 359 | struct flowi fl = { .oif = sk->sk_bound_dev_if, |
360 | .mark = sk->sk_mark, | 360 | .mark = sk->sk_mark, |
361 | .nl_u = { .ip4_u = | 361 | .fl4_dst = ((opt && opt->srr) ? |
362 | { .daddr = ((opt && opt->srr) ? | 362 | opt->faddr : ireq->rmt_addr), |
363 | opt->faddr : | 363 | .fl4_src = ireq->loc_addr, |
364 | ireq->rmt_addr), | 364 | .fl4_tos = RT_CONN_FLAGS(sk), |
365 | .saddr = ireq->loc_addr, | ||
366 | .tos = RT_CONN_FLAGS(sk) } }, | ||
367 | .proto = sk->sk_protocol, | 365 | .proto = sk->sk_protocol, |
368 | .flags = inet_sk_flowi_flags(sk), | 366 | .flags = inet_sk_flowi_flags(sk), |
369 | .uli_u = { .ports = | 367 | .fl_ip_sport = inet_sk(sk)->inet_sport, |
370 | { .sport = inet_sk(sk)->inet_sport, | 368 | .fl_ip_dport = ireq->rmt_port }; |
371 | .dport = ireq->rmt_port } } }; | ||
372 | struct net *net = sock_net(sk); | 369 | struct net *net = sock_net(sk); |
373 | 370 | ||
374 | security_req_classify_flow(req, &fl); | 371 | security_req_classify_flow(req, &fl); |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index aace653710f6..897210adaa77 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -772,14 +772,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
772 | { | 772 | { |
773 | struct flowi fl = { | 773 | struct flowi fl = { |
774 | .oif = tunnel->parms.link, | 774 | .oif = tunnel->parms.link, |
775 | .nl_u = { | 775 | .fl4_dst = dst, |
776 | .ip4_u = { | 776 | .fl4_src = tiph->saddr, |
777 | .daddr = dst, | 777 | .fl4_tos = RT_TOS(tos), |
778 | .saddr = tiph->saddr, | ||
779 | .tos = RT_TOS(tos) | ||
780 | } | ||
781 | }, | ||
782 | .proto = IPPROTO_GRE, | ||
783 | .fl_gre_key = tunnel->parms.o_key | 778 | .fl_gre_key = tunnel->parms.o_key |
784 | }; | 779 | }; |
785 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { | 780 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { |
@@ -951,13 +946,9 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev) | |||
951 | if (iph->daddr) { | 946 | if (iph->daddr) { |
952 | struct flowi fl = { | 947 | struct flowi fl = { |
953 | .oif = tunnel->parms.link, | 948 | .oif = tunnel->parms.link, |
954 | .nl_u = { | 949 | .fl4_dst = iph->daddr, |
955 | .ip4_u = { | 950 | .fl4_src = iph->saddr, |
956 | .daddr = iph->daddr, | 951 | .fl4_tos = RT_TOS(iph->tos), |
957 | .saddr = iph->saddr, | ||
958 | .tos = RT_TOS(iph->tos) | ||
959 | } | ||
960 | }, | ||
961 | .proto = IPPROTO_GRE, | 952 | .proto = IPPROTO_GRE, |
962 | .fl_gre_key = tunnel->parms.o_key | 953 | .fl_gre_key = tunnel->parms.o_key |
963 | }; | 954 | }; |
@@ -1217,13 +1208,9 @@ static int ipgre_open(struct net_device *dev) | |||
1217 | if (ipv4_is_multicast(t->parms.iph.daddr)) { | 1208 | if (ipv4_is_multicast(t->parms.iph.daddr)) { |
1218 | struct flowi fl = { | 1209 | struct flowi fl = { |
1219 | .oif = t->parms.link, | 1210 | .oif = t->parms.link, |
1220 | .nl_u = { | 1211 | .fl4_dst = t->parms.iph.daddr, |
1221 | .ip4_u = { | 1212 | .fl4_src = t->parms.iph.saddr, |
1222 | .daddr = t->parms.iph.daddr, | 1213 | .fl4_tos = RT_TOS(t->parms.iph.tos), |
1223 | .saddr = t->parms.iph.saddr, | ||
1224 | .tos = RT_TOS(t->parms.iph.tos) | ||
1225 | } | ||
1226 | }, | ||
1227 | .proto = IPPROTO_GRE, | 1214 | .proto = IPPROTO_GRE, |
1228 | .fl_gre_key = t->parms.o_key | 1215 | .fl_gre_key = t->parms.o_key |
1229 | }; | 1216 | }; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 439d2a34ee44..5090c7ff525e 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -341,15 +341,13 @@ int ip_queue_xmit(struct sk_buff *skb) | |||
341 | { | 341 | { |
342 | struct flowi fl = { .oif = sk->sk_bound_dev_if, | 342 | struct flowi fl = { .oif = sk->sk_bound_dev_if, |
343 | .mark = sk->sk_mark, | 343 | .mark = sk->sk_mark, |
344 | .nl_u = { .ip4_u = | 344 | .fl4_dst = daddr, |
345 | { .daddr = daddr, | 345 | .fl4_src = inet->inet_saddr, |
346 | .saddr = inet->inet_saddr, | 346 | .fl4_tos = RT_CONN_FLAGS(sk), |
347 | .tos = RT_CONN_FLAGS(sk) } }, | ||
348 | .proto = sk->sk_protocol, | 347 | .proto = sk->sk_protocol, |
349 | .flags = inet_sk_flowi_flags(sk), | 348 | .flags = inet_sk_flowi_flags(sk), |
350 | .uli_u = { .ports = | 349 | .fl_ip_sport = inet->inet_sport, |
351 | { .sport = inet->inet_sport, | 350 | .fl_ip_dport = inet->inet_dport }; |
352 | .dport = inet->inet_dport } } }; | ||
353 | 351 | ||
354 | /* If this fails, retransmit mechanism of transport layer will | 352 | /* If this fails, retransmit mechanism of transport layer will |
355 | * keep trying until route appears or the connection times | 353 | * keep trying until route appears or the connection times |
@@ -1404,14 +1402,11 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
1404 | 1402 | ||
1405 | { | 1403 | { |
1406 | struct flowi fl = { .oif = arg->bound_dev_if, | 1404 | struct flowi fl = { .oif = arg->bound_dev_if, |
1407 | .nl_u = { .ip4_u = | 1405 | .fl4_dst = daddr, |
1408 | { .daddr = daddr, | 1406 | .fl4_src = rt->rt_spec_dst, |
1409 | .saddr = rt->rt_spec_dst, | 1407 | .fl4_tos = RT_TOS(ip_hdr(skb)->tos), |
1410 | .tos = RT_TOS(ip_hdr(skb)->tos) } }, | 1408 | .fl_ip_sport = tcp_hdr(skb)->dest, |
1411 | /* Not quite clean, but right. */ | 1409 | .fl_ip_dport = tcp_hdr(skb)->source, |
1412 | .uli_u = { .ports = | ||
1413 | { .sport = tcp_hdr(skb)->dest, | ||
1414 | .dport = tcp_hdr(skb)->source } }, | ||
1415 | .proto = sk->sk_protocol, | 1410 | .proto = sk->sk_protocol, |
1416 | .flags = ip_reply_arg_flowi_flags(arg) }; | 1411 | .flags = ip_reply_arg_flowi_flags(arg) }; |
1417 | security_skb_classify_flow(skb, &fl); | 1412 | security_skb_classify_flow(skb, &fl); |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index cd300aaee78f..e70ad581398e 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -463,13 +463,9 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
463 | { | 463 | { |
464 | struct flowi fl = { | 464 | struct flowi fl = { |
465 | .oif = tunnel->parms.link, | 465 | .oif = tunnel->parms.link, |
466 | .nl_u = { | 466 | .fl4_dst = dst, |
467 | .ip4_u = { | 467 | .fl4_src= tiph->saddr, |
468 | .daddr = dst, | 468 | .fl4_tos = RT_TOS(tos), |
469 | .saddr = tiph->saddr, | ||
470 | .tos = RT_TOS(tos) | ||
471 | } | ||
472 | }, | ||
473 | .proto = IPPROTO_IPIP | 469 | .proto = IPPROTO_IPIP |
474 | }; | 470 | }; |
475 | 471 | ||
@@ -589,13 +585,9 @@ static void ipip_tunnel_bind_dev(struct net_device *dev) | |||
589 | if (iph->daddr) { | 585 | if (iph->daddr) { |
590 | struct flowi fl = { | 586 | struct flowi fl = { |
591 | .oif = tunnel->parms.link, | 587 | .oif = tunnel->parms.link, |
592 | .nl_u = { | 588 | .fl4_dst = iph->daddr, |
593 | .ip4_u = { | 589 | .fl4_src = iph->saddr, |
594 | .daddr = iph->daddr, | 590 | .fl4_tos = RT_TOS(iph->tos), |
595 | .saddr = iph->saddr, | ||
596 | .tos = RT_TOS(iph->tos) | ||
597 | } | ||
598 | }, | ||
599 | .proto = IPPROTO_IPIP | 591 | .proto = IPPROTO_IPIP |
600 | }; | 592 | }; |
601 | struct rtable *rt; | 593 | struct rtable *rt; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index ef2b0089e0ea..3f3a9afd73e0 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1537,13 +1537,9 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt, | |||
1537 | if (vif->flags & VIFF_TUNNEL) { | 1537 | if (vif->flags & VIFF_TUNNEL) { |
1538 | struct flowi fl = { | 1538 | struct flowi fl = { |
1539 | .oif = vif->link, | 1539 | .oif = vif->link, |
1540 | .nl_u = { | 1540 | .fl4_dst = vif->remote, |
1541 | .ip4_u = { | 1541 | .fl4_src = vif->local, |
1542 | .daddr = vif->remote, | 1542 | .fl4_tos = RT_TOS(iph->tos), |
1543 | .saddr = vif->local, | ||
1544 | .tos = RT_TOS(iph->tos) | ||
1545 | } | ||
1546 | }, | ||
1547 | .proto = IPPROTO_IPIP | 1543 | .proto = IPPROTO_IPIP |
1548 | }; | 1544 | }; |
1549 | 1545 | ||
@@ -1553,12 +1549,8 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt, | |||
1553 | } else { | 1549 | } else { |
1554 | struct flowi fl = { | 1550 | struct flowi fl = { |
1555 | .oif = vif->link, | 1551 | .oif = vif->link, |
1556 | .nl_u = { | 1552 | .fl4_dst = iph->daddr, |
1557 | .ip4_u = { | 1553 | .fl4_tos = RT_TOS(iph->tos), |
1558 | .daddr = iph->daddr, | ||
1559 | .tos = RT_TOS(iph->tos) | ||
1560 | } | ||
1561 | }, | ||
1562 | .proto = IPPROTO_IPIP | 1554 | .proto = IPPROTO_IPIP |
1563 | }; | 1555 | }; |
1564 | 1556 | ||
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index d88a46c54fd1..994a1f29ebbc 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -31,10 +31,10 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | |||
31 | * packets with foreign saddr to appear on the NF_INET_LOCAL_OUT hook. | 31 | * packets with foreign saddr to appear on the NF_INET_LOCAL_OUT hook. |
32 | */ | 32 | */ |
33 | if (addr_type == RTN_LOCAL) { | 33 | if (addr_type == RTN_LOCAL) { |
34 | fl.nl_u.ip4_u.daddr = iph->daddr; | 34 | fl.fl4_dst = iph->daddr; |
35 | if (type == RTN_LOCAL) | 35 | if (type == RTN_LOCAL) |
36 | fl.nl_u.ip4_u.saddr = iph->saddr; | 36 | fl.fl4_src = iph->saddr; |
37 | fl.nl_u.ip4_u.tos = RT_TOS(iph->tos); | 37 | fl.fl4_tos = RT_TOS(iph->tos); |
38 | fl.oif = skb->sk ? skb->sk->sk_bound_dev_if : 0; | 38 | fl.oif = skb->sk ? skb->sk->sk_bound_dev_if : 0; |
39 | fl.mark = skb->mark; | 39 | fl.mark = skb->mark; |
40 | fl.flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0; | 40 | fl.flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0; |
@@ -47,7 +47,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | |||
47 | } else { | 47 | } else { |
48 | /* non-local src, find valid iif to satisfy | 48 | /* non-local src, find valid iif to satisfy |
49 | * rp-filter when calling ip_route_input. */ | 49 | * rp-filter when calling ip_route_input. */ |
50 | fl.nl_u.ip4_u.daddr = iph->saddr; | 50 | fl.fl4_dst = iph->saddr; |
51 | if (ip_route_output_key(net, &rt, &fl) != 0) | 51 | if (ip_route_output_key(net, &rt, &fl) != 0) |
52 | return -1; | 52 | return -1; |
53 | 53 | ||
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 1f85ef289895..a3d5ab786e81 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -549,10 +549,9 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
549 | { | 549 | { |
550 | struct flowi fl = { .oif = ipc.oif, | 550 | struct flowi fl = { .oif = ipc.oif, |
551 | .mark = sk->sk_mark, | 551 | .mark = sk->sk_mark, |
552 | .nl_u = { .ip4_u = | 552 | .fl4_dst = daddr, |
553 | { .daddr = daddr, | 553 | .fl4_src = saddr, |
554 | .saddr = saddr, | 554 | .fl4_tos = tos, |
555 | .tos = tos } }, | ||
556 | .proto = inet->hdrincl ? IPPROTO_RAW : | 555 | .proto = inet->hdrincl ? IPPROTO_RAW : |
557 | sk->sk_protocol, | 556 | sk->sk_protocol, |
558 | }; | 557 | }; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 66610ea3c87b..ec2333fb637e 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -684,17 +684,17 @@ static inline bool rt_caching(const struct net *net) | |||
684 | static inline bool compare_hash_inputs(const struct flowi *fl1, | 684 | static inline bool compare_hash_inputs(const struct flowi *fl1, |
685 | const struct flowi *fl2) | 685 | const struct flowi *fl2) |
686 | { | 686 | { |
687 | return ((((__force u32)fl1->nl_u.ip4_u.daddr ^ (__force u32)fl2->nl_u.ip4_u.daddr) | | 687 | return ((((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) | |
688 | ((__force u32)fl1->nl_u.ip4_u.saddr ^ (__force u32)fl2->nl_u.ip4_u.saddr) | | 688 | ((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) | |
689 | (fl1->iif ^ fl2->iif)) == 0); | 689 | (fl1->iif ^ fl2->iif)) == 0); |
690 | } | 690 | } |
691 | 691 | ||
692 | static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) | 692 | static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) |
693 | { | 693 | { |
694 | return (((__force u32)fl1->nl_u.ip4_u.daddr ^ (__force u32)fl2->nl_u.ip4_u.daddr) | | 694 | return (((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) | |
695 | ((__force u32)fl1->nl_u.ip4_u.saddr ^ (__force u32)fl2->nl_u.ip4_u.saddr) | | 695 | ((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) | |
696 | (fl1->mark ^ fl2->mark) | | 696 | (fl1->mark ^ fl2->mark) | |
697 | (*(u16 *)&fl1->nl_u.ip4_u.tos ^ *(u16 *)&fl2->nl_u.ip4_u.tos) | | 697 | (*(u16 *)&fl1->fl4_tos ^ *(u16 *)&fl2->fl4_tos) | |
698 | (fl1->oif ^ fl2->oif) | | 698 | (fl1->oif ^ fl2->oif) | |
699 | (fl1->iif ^ fl2->iif)) == 0; | 699 | (fl1->iif ^ fl2->iif)) == 0; |
700 | } | 700 | } |
@@ -2089,12 +2089,10 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2089 | { | 2089 | { |
2090 | struct fib_result res; | 2090 | struct fib_result res; |
2091 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 2091 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
2092 | struct flowi fl = { .nl_u = { .ip4_u = | 2092 | struct flowi fl = { .fl4_dst = daddr, |
2093 | { .daddr = daddr, | 2093 | .fl4_src = saddr, |
2094 | .saddr = saddr, | 2094 | .fl4_tos = tos, |
2095 | .tos = tos, | 2095 | .fl4_scope = RT_SCOPE_UNIVERSE, |
2096 | .scope = RT_SCOPE_UNIVERSE, | ||
2097 | } }, | ||
2098 | .mark = skb->mark, | 2096 | .mark = skb->mark, |
2099 | .iif = dev->ifindex }; | 2097 | .iif = dev->ifindex }; |
2100 | unsigned flags = 0; | 2098 | unsigned flags = 0; |
@@ -2480,14 +2478,11 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, | |||
2480 | const struct flowi *oldflp) | 2478 | const struct flowi *oldflp) |
2481 | { | 2479 | { |
2482 | u32 tos = RT_FL_TOS(oldflp); | 2480 | u32 tos = RT_FL_TOS(oldflp); |
2483 | struct flowi fl = { .nl_u = { .ip4_u = | 2481 | struct flowi fl = { .fl4_dst = oldflp->fl4_dst, |
2484 | { .daddr = oldflp->fl4_dst, | 2482 | .fl4_src = oldflp->fl4_src, |
2485 | .saddr = oldflp->fl4_src, | 2483 | .fl4_tos = tos & IPTOS_RT_MASK, |
2486 | .tos = tos & IPTOS_RT_MASK, | 2484 | .fl4_scope = ((tos & RTO_ONLINK) ? |
2487 | .scope = ((tos & RTO_ONLINK) ? | 2485 | RT_SCOPE_LINK : RT_SCOPE_UNIVERSE), |
2488 | RT_SCOPE_LINK : | ||
2489 | RT_SCOPE_UNIVERSE), | ||
2490 | } }, | ||
2491 | .mark = oldflp->mark, | 2486 | .mark = oldflp->mark, |
2492 | .iif = net->loopback_dev->ifindex, | 2487 | .iif = net->loopback_dev->ifindex, |
2493 | .oif = oldflp->oif }; | 2488 | .oif = oldflp->oif }; |
@@ -2944,13 +2939,9 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2944 | err = -rt->dst.error; | 2939 | err = -rt->dst.error; |
2945 | } else { | 2940 | } else { |
2946 | struct flowi fl = { | 2941 | struct flowi fl = { |
2947 | .nl_u = { | 2942 | .fl4_dst = dst, |
2948 | .ip4_u = { | 2943 | .fl4_src = src, |
2949 | .daddr = dst, | 2944 | .fl4_tos = rtm->rtm_tos, |
2950 | .saddr = src, | ||
2951 | .tos = rtm->rtm_tos, | ||
2952 | }, | ||
2953 | }, | ||
2954 | .oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0, | 2945 | .oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0, |
2955 | .mark = mark, | 2946 | .mark = mark, |
2956 | }; | 2947 | }; |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 650cace2180d..47519205a014 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -346,17 +346,14 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
346 | */ | 346 | */ |
347 | { | 347 | { |
348 | struct flowi fl = { .mark = sk->sk_mark, | 348 | struct flowi fl = { .mark = sk->sk_mark, |
349 | .nl_u = { .ip4_u = | 349 | .fl4_dst = ((opt && opt->srr) ? |
350 | { .daddr = ((opt && opt->srr) ? | 350 | opt->faddr : ireq->rmt_addr), |
351 | opt->faddr : | 351 | .fl4_src = ireq->loc_addr, |
352 | ireq->rmt_addr), | 352 | .fl4_tos = RT_CONN_FLAGS(sk), |
353 | .saddr = ireq->loc_addr, | ||
354 | .tos = RT_CONN_FLAGS(sk) } }, | ||
355 | .proto = IPPROTO_TCP, | 353 | .proto = IPPROTO_TCP, |
356 | .flags = inet_sk_flowi_flags(sk), | 354 | .flags = inet_sk_flowi_flags(sk), |
357 | .uli_u = { .ports = | 355 | .fl_ip_sport = th->dest, |
358 | { .sport = th->dest, | 356 | .fl_ip_dport = th->source }; |
359 | .dport = th->source } } }; | ||
360 | security_req_classify_flow(req, &fl); | 357 | security_req_classify_flow(req, &fl); |
361 | if (ip_route_output_key(sock_net(sk), &rt, &fl)) { | 358 | if (ip_route_output_key(sock_net(sk), &rt, &fl)) { |
362 | reqsk_free(req); | 359 | reqsk_free(req); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 491ecd3f7a01..b37181da487c 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -890,15 +890,13 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
890 | if (rt == NULL) { | 890 | if (rt == NULL) { |
891 | struct flowi fl = { .oif = ipc.oif, | 891 | struct flowi fl = { .oif = ipc.oif, |
892 | .mark = sk->sk_mark, | 892 | .mark = sk->sk_mark, |
893 | .nl_u = { .ip4_u = | 893 | .fl4_dst = faddr, |
894 | { .daddr = faddr, | 894 | .fl4_src = saddr, |
895 | .saddr = saddr, | 895 | .fl4_tos = tos, |
896 | .tos = tos } }, | ||
897 | .proto = sk->sk_protocol, | 896 | .proto = sk->sk_protocol, |
898 | .flags = inet_sk_flowi_flags(sk), | 897 | .flags = inet_sk_flowi_flags(sk), |
899 | .uli_u = { .ports = | 898 | .fl_ip_sport = inet->inet_sport, |
900 | { .sport = inet->inet_sport, | 899 | .fl_ip_dport = dport }; |
901 | .dport = dport } } }; | ||
902 | struct net *net = sock_net(sk); | 900 | struct net *net = sock_net(sk); |
903 | 901 | ||
904 | security_sk_classify_flow(sk, &fl); | 902 | security_sk_classify_flow(sk, &fl); |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 4a8c5335770c..b057d40addec 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -23,12 +23,8 @@ static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, | |||
23 | xfrm_address_t *daddr) | 23 | xfrm_address_t *daddr) |
24 | { | 24 | { |
25 | struct flowi fl = { | 25 | struct flowi fl = { |
26 | .nl_u = { | 26 | .fl4_dst = daddr->a4, |
27 | .ip4_u = { | 27 | .fl4_tos = tos, |
28 | .tos = tos, | ||
29 | .daddr = daddr->a4, | ||
30 | }, | ||
31 | }, | ||
32 | }; | 28 | }; |
33 | struct dst_entry *dst; | 29 | struct dst_entry *dst; |
34 | struct rtable *rt; | 30 | struct rtable *rt; |