summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 03:00:33 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:54 -0500
commit9cce96df5b76691712dba22e83ff5efe900361e1 (patch)
treeeecf99e64c6866af944e1e1644d87737392b2da2
parentf42454d632753d71ea1a2df09be7bbda32b6372d (diff)
net: Put fl4_* macros to struct flowi4 and use them again.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/flow.h18
-rw-r--r--include/net/route.h14
-rw-r--r--net/dccp/ipv4.c4
-rw-r--r--net/ipv4/icmp.c4
-rw-r--r--net/ipv4/inet_connection_sock.c4
-rw-r--r--net/ipv4/ip_output.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_standalone.c4
-rw-r--r--net/ipv4/raw.c4
-rw-r--r--net/ipv4/syncookies.c4
-rw-r--r--net/ipv4/udp.c10
-rw-r--r--net/ipv4/xfrm4_policy.c18
-rw-r--r--net/sctp/protocol.c8
12 files changed, 46 insertions, 50 deletions
diff --git a/include/net/flow.h b/include/net/flow.h
index 8d5b402d600a..44bd37628f55 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -61,6 +61,13 @@ struct flowi4 {
61 __be32 daddr; 61 __be32 daddr;
62 __be32 saddr; 62 __be32 saddr;
63 union flowi_uli uli; 63 union flowi_uli uli;
64#define fl4_sport uli.ports.sport
65#define fl4_dport uli.ports.dport
66#define fl4_icmp_type uli.icmpt.type
67#define fl4_icmp_code uli.icmpt.code
68#define fl4_ipsec_spi uli.spi
69#define fl4_mh_type uli.mht.type
70#define fl4_gre_key uli.gre_key
64}; 71};
65 72
66struct flowi6 { 73struct flowi6 {
@@ -101,8 +108,6 @@ struct flowi {
101#define flowi_proto u.__fl_common.flowic_proto 108#define flowi_proto u.__fl_common.flowic_proto
102#define flowi_flags u.__fl_common.flowic_flags 109#define flowi_flags u.__fl_common.flowic_flags
103#define flowi_secid u.__fl_common.flowic_secid 110#define flowi_secid u.__fl_common.flowic_secid
104#define fl4_tos flowi_tos
105#define fl4_scope flowi_scope
106#define fld_scope flowi_scope 111#define fld_scope flowi_scope
107 112
108#define fld_dst u.dn.daddr 113#define fld_dst u.dn.daddr
@@ -110,15 +115,6 @@ struct flowi {
110#define fl6_dst u.ip6.daddr 115#define fl6_dst u.ip6.daddr
111#define fl6_src u.ip6.saddr 116#define fl6_src u.ip6.saddr
112#define fl6_flowlabel u.ip6.flowlabel 117#define fl6_flowlabel u.ip6.flowlabel
113#define fl4_dst u.ip4.daddr
114#define fl4_src u.ip4.saddr
115#define fl4_sport u.ip4.uli.ports.sport
116#define fl4_dport u.ip4.uli.ports.dport
117#define fl4_icmp_type u.ip4.uli.icmpt.type
118#define fl4_icmp_code u.ip4.uli.icmpt.code
119#define fl4_ipsec_spi u.ip4.uli.spi
120#define fl4_mh_type u.ip4.uli.mht.type
121#define fl4_gre_key u.ip4.uli.gre_key
122#define fl6_sport u.ip6.uli.ports.sport 118#define fl6_sport u.ip6.uli.ports.sport
123#define fl6_dport u.ip6.uli.ports.dport 119#define fl6_dport u.ip6.uli.ports.dport
124#define fl6_icmp_type u.ip6.uli.icmpt.type 120#define fl6_icmp_type u.ip6.uli.icmpt.type
diff --git a/include/net/route.h b/include/net/route.h
index 80b0353f4f41..30d6cae3841a 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -157,8 +157,8 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct sock
157 .saddr = saddr, 157 .saddr = saddr,
158 .flowi4_tos = tos, 158 .flowi4_tos = tos,
159 .flowi4_proto = proto, 159 .flowi4_proto = proto,
160 .uli.ports.dport = dport, 160 .fl4_dport = dport,
161 .uli.ports.sport = sport, 161 .fl4_sport = sport,
162 }; 162 };
163 if (sk) 163 if (sk)
164 security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); 164 security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
@@ -175,7 +175,7 @@ static inline struct rtable *ip_route_output_gre(struct net *net,
175 .saddr = saddr, 175 .saddr = saddr,
176 .flowi4_tos = tos, 176 .flowi4_tos = tos,
177 .flowi4_proto = IPPROTO_GRE, 177 .flowi4_proto = IPPROTO_GRE,
178 .uli.gre_key = gre_key, 178 .fl4_gre_key = gre_key,
179 }; 179 };
180 return ip_route_output_key(net, &fl4); 180 return ip_route_output_key(net, &fl4);
181} 181}
@@ -235,8 +235,8 @@ static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos,
235 .saddr = src, 235 .saddr = src,
236 .flowi4_tos = tos, 236 .flowi4_tos = tos,
237 .flowi4_proto = protocol, 237 .flowi4_proto = protocol,
238 .uli.ports.sport = sport, 238 .fl4_sport = sport,
239 .uli.ports.dport = dport, 239 .fl4_dport = dport,
240 }; 240 };
241 struct net *net = sock_net(sk); 241 struct net *net = sock_net(sk);
242 struct rtable *rt; 242 struct rtable *rt;
@@ -273,8 +273,8 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
273 .saddr = rt->rt_key_src, 273 .saddr = rt->rt_key_src,
274 .flowi4_tos = rt->rt_tos, 274 .flowi4_tos = rt->rt_tos,
275 .flowi4_proto = protocol, 275 .flowi4_proto = protocol,
276 .uli.ports.sport = sport, 276 .fl4_sport = sport,
277 .uli.ports.dport = dport 277 .fl4_dport = dport
278 }; 278 };
279 if (inet_sk(sk)->transparent) 279 if (inet_sk(sk)->transparent)
280 fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; 280 fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index be984706126b..ae451c6d83ba 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -471,8 +471,8 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
471 .saddr = ip_hdr(skb)->daddr, 471 .saddr = ip_hdr(skb)->daddr,
472 .flowi4_tos = RT_CONN_FLAGS(sk), 472 .flowi4_tos = RT_CONN_FLAGS(sk),
473 .flowi4_proto = sk->sk_protocol, 473 .flowi4_proto = sk->sk_protocol,
474 .uli.ports.sport = dccp_hdr(skb)->dccph_dport, 474 .fl4_sport = dccp_hdr(skb)->dccph_dport,
475 .uli.ports.dport = dccp_hdr(skb)->dccph_sport, 475 .fl4_dport = dccp_hdr(skb)->dccph_sport,
476 }; 476 };
477 477
478 security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); 478 security_skb_classify_flow(skb, flowi4_to_flowi(&fl4));
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 8eca3c28cbc3..a91dc1611081 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -384,8 +384,8 @@ static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in,
384 .saddr = saddr, 384 .saddr = saddr,
385 .flowi4_tos = RT_TOS(tos), 385 .flowi4_tos = RT_TOS(tos),
386 .flowi4_proto = IPPROTO_ICMP, 386 .flowi4_proto = IPPROTO_ICMP,
387 .uli.icmpt.type = type, 387 .fl4_icmp_type = type,
388 .uli.icmpt.code = code, 388 .fl4_icmp_code = code,
389 }; 389 };
390 struct rtable *rt, *rt2; 390 struct rtable *rt, *rt2;
391 int err; 391 int err;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index beecc1272169..6c0b7f4a3d7d 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -365,8 +365,8 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,
365 .flowi4_tos = RT_CONN_FLAGS(sk), 365 .flowi4_tos = RT_CONN_FLAGS(sk),
366 .flowi4_proto = sk->sk_protocol, 366 .flowi4_proto = sk->sk_protocol,
367 .flowi4_flags = inet_sk_flowi_flags(sk), 367 .flowi4_flags = inet_sk_flowi_flags(sk),
368 .uli.ports.sport = inet_sk(sk)->inet_sport, 368 .fl4_sport = inet_sk(sk)->inet_sport,
369 .uli.ports.dport = ireq->rmt_port, 369 .fl4_dport = ireq->rmt_port,
370 }; 370 };
371 struct net *net = sock_net(sk); 371 struct net *net = sock_net(sk);
372 372
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 2b9cc40397ee..67f241b97649 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1479,8 +1479,8 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
1479 .daddr = daddr, 1479 .daddr = daddr,
1480 .saddr = rt->rt_spec_dst, 1480 .saddr = rt->rt_spec_dst,
1481 .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), 1481 .flowi4_tos = RT_TOS(ip_hdr(skb)->tos),
1482 .uli.ports.sport = tcp_hdr(skb)->dest, 1482 .fl4_sport = tcp_hdr(skb)->dest,
1483 .uli.ports.dport = tcp_hdr(skb)->source, 1483 .fl4_dport = tcp_hdr(skb)->source,
1484 .flowi4_proto = sk->sk_protocol, 1484 .flowi4_proto = sk->sk_protocol,
1485 .flowi4_flags = ip_reply_arg_flowi_flags(arg), 1485 .flowi4_flags = ip_reply_arg_flowi_flags(arg),
1486 }; 1486 };
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c
index 963320b295e2..7317bdf1d457 100644
--- a/net/ipv4/netfilter/nf_nat_standalone.c
+++ b/net/ipv4/netfilter/nf_nat_standalone.c
@@ -56,7 +56,7 @@ static void nat_decode_session(struct sk_buff *skb, struct flowi *fl)
56 t->dst.protonum == IPPROTO_UDPLITE || 56 t->dst.protonum == IPPROTO_UDPLITE ||
57 t->dst.protonum == IPPROTO_DCCP || 57 t->dst.protonum == IPPROTO_DCCP ||
58 t->dst.protonum == IPPROTO_SCTP) 58 t->dst.protonum == IPPROTO_SCTP)
59 fl4->uli.ports.dport = t->dst.u.tcp.port; 59 fl4->fl4_dport = t->dst.u.tcp.port;
60 } 60 }
61 61
62 statusbit ^= IPS_NAT_MASK; 62 statusbit ^= IPS_NAT_MASK;
@@ -68,7 +68,7 @@ static void nat_decode_session(struct sk_buff *skb, struct flowi *fl)
68 t->dst.protonum == IPPROTO_UDPLITE || 68 t->dst.protonum == IPPROTO_UDPLITE ||
69 t->dst.protonum == IPPROTO_DCCP || 69 t->dst.protonum == IPPROTO_DCCP ||
70 t->dst.protonum == IPPROTO_SCTP) 70 t->dst.protonum == IPPROTO_SCTP)
71 fl4->uli.ports.sport = t->src.u.tcp.port; 71 fl4->fl4_sport = t->src.u.tcp.port;
72 } 72 }
73} 73}
74#endif 74#endif
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 452e178d962d..e837ffd3edc3 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -433,8 +433,8 @@ static int raw_probe_proto_opt(struct flowi4 *fl4, struct msghdr *msg)
433 code = iov->iov_base; 433 code = iov->iov_base;
434 434
435 if (type && code) { 435 if (type && code) {
436 if (get_user(fl4->uli.icmpt.type, type) || 436 if (get_user(fl4->fl4_icmp_type, type) ||
437 get_user(fl4->uli.icmpt.code, code)) 437 get_user(fl4->fl4_icmp_code, code))
438 return -EFAULT; 438 return -EFAULT;
439 probed = 1; 439 probed = 1;
440 } 440 }
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index e3b5b754311c..8b44c6d2a79b 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -353,8 +353,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
353 .flowi4_tos = RT_CONN_FLAGS(sk), 353 .flowi4_tos = RT_CONN_FLAGS(sk),
354 .flowi4_proto = IPPROTO_TCP, 354 .flowi4_proto = IPPROTO_TCP,
355 .flowi4_flags = inet_sk_flowi_flags(sk), 355 .flowi4_flags = inet_sk_flowi_flags(sk),
356 .uli.ports.sport = th->dest, 356 .fl4_sport = th->dest,
357 .uli.ports.dport = th->source, 357 .fl4_dport = th->source,
358 }; 358 };
359 security_req_classify_flow(req, flowi4_to_flowi(&fl4)); 359 security_req_classify_flow(req, flowi4_to_flowi(&fl4));
360 rt = ip_route_output_key(sock_net(sk), &fl4); 360 rt = ip_route_output_key(sock_net(sk), &fl4);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 91cba3ca37c4..588f47af5faf 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -778,7 +778,7 @@ static int udp_push_pending_frames(struct sock *sk)
778 if (!skb) 778 if (!skb)
779 goto out; 779 goto out;
780 780
781 err = udp_send_skb(skb, fl4->daddr, fl4->uli.ports.dport); 781 err = udp_send_skb(skb, fl4->daddr, fl4->fl4_dport);
782 782
783out: 783out:
784 up->len = 0; 784 up->len = 0;
@@ -918,8 +918,8 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
918 .flowi4_proto = sk->sk_protocol, 918 .flowi4_proto = sk->sk_protocol,
919 .flowi4_flags = (inet_sk_flowi_flags(sk) | 919 .flowi4_flags = (inet_sk_flowi_flags(sk) |
920 FLOWI_FLAG_CAN_SLEEP), 920 FLOWI_FLAG_CAN_SLEEP),
921 .uli.ports.sport = inet->inet_sport, 921 .fl4_sport = inet->inet_sport,
922 .uli.ports.dport = dport, 922 .fl4_dport = dport,
923 }; 923 };
924 struct net *net = sock_net(sk); 924 struct net *net = sock_net(sk);
925 925
@@ -976,8 +976,8 @@ back_from_confirm:
976 fl4 = &inet->cork.fl.u.ip4; 976 fl4 = &inet->cork.fl.u.ip4;
977 fl4->daddr = daddr; 977 fl4->daddr = daddr;
978 fl4->saddr = saddr; 978 fl4->saddr = saddr;
979 fl4->uli.ports.dport = dport; 979 fl4->fl4_dport = dport;
980 fl4->uli.ports.sport = inet->inet_sport; 980 fl4->fl4_sport = inet->inet_sport;
981 up->pending = AF_INET; 981 up->pending = AF_INET;
982 982
983do_append_data: 983do_append_data:
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 30b312c577bc..13e0e7f659ff 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -119,8 +119,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
119 pskb_may_pull(skb, xprth + 4 - skb->data)) { 119 pskb_may_pull(skb, xprth + 4 - skb->data)) {
120 __be16 *ports = (__be16 *)xprth; 120 __be16 *ports = (__be16 *)xprth;
121 121
122 fl4->uli.ports.sport = ports[!!reverse]; 122 fl4->fl4_sport = ports[!!reverse];
123 fl4->uli.ports.dport = ports[!reverse]; 123 fl4->fl4_dport = ports[!reverse];
124 } 124 }
125 break; 125 break;
126 126
@@ -128,8 +128,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
128 if (pskb_may_pull(skb, xprth + 2 - skb->data)) { 128 if (pskb_may_pull(skb, xprth + 2 - skb->data)) {
129 u8 *icmp = xprth; 129 u8 *icmp = xprth;
130 130
131 fl4->uli.icmpt.type = icmp[0]; 131 fl4->fl4_icmp_type = icmp[0];
132 fl4->uli.icmpt.code = icmp[1]; 132 fl4->fl4_icmp_code = icmp[1];
133 } 133 }
134 break; 134 break;
135 135
@@ -137,7 +137,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
137 if (pskb_may_pull(skb, xprth + 4 - skb->data)) { 137 if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
138 __be32 *ehdr = (__be32 *)xprth; 138 __be32 *ehdr = (__be32 *)xprth;
139 139
140 fl4->uli.spi = ehdr[0]; 140 fl4->fl4_ipsec_spi = ehdr[0];
141 } 141 }
142 break; 142 break;
143 143
@@ -145,7 +145,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
145 if (pskb_may_pull(skb, xprth + 8 - skb->data)) { 145 if (pskb_may_pull(skb, xprth + 8 - skb->data)) {
146 __be32 *ah_hdr = (__be32*)xprth; 146 __be32 *ah_hdr = (__be32*)xprth;
147 147
148 fl4->uli.spi = ah_hdr[1]; 148 fl4->fl4_ipsec_spi = ah_hdr[1];
149 } 149 }
150 break; 150 break;
151 151
@@ -153,7 +153,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
153 if (pskb_may_pull(skb, xprth + 4 - skb->data)) { 153 if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
154 __be16 *ipcomp_hdr = (__be16 *)xprth; 154 __be16 *ipcomp_hdr = (__be16 *)xprth;
155 155
156 fl4->uli.spi = htonl(ntohs(ipcomp_hdr[1])); 156 fl4->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
157 } 157 }
158 break; 158 break;
159 159
@@ -165,13 +165,13 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
165 if (greflags[0] & GRE_KEY) { 165 if (greflags[0] & GRE_KEY) {
166 if (greflags[0] & GRE_CSUM) 166 if (greflags[0] & GRE_CSUM)
167 gre_hdr++; 167 gre_hdr++;
168 fl4->uli.gre_key = gre_hdr[1]; 168 fl4->fl4_gre_key = gre_hdr[1];
169 } 169 }
170 } 170 }
171 break; 171 break;
172 172
173 default: 173 default:
174 fl4->uli.spi = 0; 174 fl4->fl4_ipsec_spi = 0;
175 break; 175 break;
176 } 176 }
177 } 177 }
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 31c04568b23c..152976ec0b74 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -476,16 +476,16 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
476 476
477 memset(&fl4, 0x0, sizeof(struct flowi4)); 477 memset(&fl4, 0x0, sizeof(struct flowi4));
478 fl4.daddr = daddr->v4.sin_addr.s_addr; 478 fl4.daddr = daddr->v4.sin_addr.s_addr;
479 fl4.uli.ports.dport = daddr->v4.sin_port; 479 fl4.fl4_dport = daddr->v4.sin_port;
480 fl4.flowi4_proto = IPPROTO_SCTP; 480 fl4.flowi4_proto = IPPROTO_SCTP;
481 if (asoc) { 481 if (asoc) {
482 fl4.flowi4_tos = RT_CONN_FLAGS(asoc->base.sk); 482 fl4.flowi4_tos = RT_CONN_FLAGS(asoc->base.sk);
483 fl4.flowi4_oif = asoc->base.sk->sk_bound_dev_if; 483 fl4.flowi4_oif = asoc->base.sk->sk_bound_dev_if;
484 fl4.uli.ports.sport = htons(asoc->base.bind_addr.port); 484 fl4.fl4_sport = htons(asoc->base.bind_addr.port);
485 } 485 }
486 if (saddr) { 486 if (saddr) {
487 fl4.saddr = saddr->v4.sin_addr.s_addr; 487 fl4.saddr = saddr->v4.sin_addr.s_addr;
488 fl4.uli.ports.sport = saddr->v4.sin_port; 488 fl4.fl4_sport = saddr->v4.sin_port;
489 } 489 }
490 490
491 SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ", 491 SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ",
@@ -534,7 +534,7 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
534 if ((laddr->state == SCTP_ADDR_SRC) && 534 if ((laddr->state == SCTP_ADDR_SRC) &&
535 (AF_INET == laddr->a.sa.sa_family)) { 535 (AF_INET == laddr->a.sa.sa_family)) {
536 fl4.saddr = laddr->a.v4.sin_addr.s_addr; 536 fl4.saddr = laddr->a.v4.sin_addr.s_addr;
537 fl4.uli.ports.sport = laddr->a.v4.sin_port; 537 fl4.fl4_sport = laddr->a.v4.sin_port;
538 rt = ip_route_output_key(&init_net, &fl4); 538 rt = ip_route_output_key(&init_net, &fl4);
539 if (!IS_ERR(rt)) { 539 if (!IS_ERR(rt)) {
540 dst = &rt->dst; 540 dst = &rt->dst;