aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 00:43:55 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:46 -0500
commit6281dcc94a96bd73017b2baa8fa83925405109ef (patch)
tree8deee4d66d256d10ea25f66520eb96b1fade1545 /net/ipv4
parent08704bcbf022786532b5f188935ab6619906049f (diff)
net: Make flowi ports AF dependent.
Create two sets of port member accessors, one set prefixed by fl4_* and the other prefixed by fl6_* This will let us to create AF optimal flow instances. It will work because every context in which we access the ports, we have to be fully aware of which AF the flowi is anyways. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-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/ipv4/xfrm4_state.c4
9 files changed, 28 insertions, 28 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 3fde7f23c70b..8d091954625b 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 .fl4_src = saddr, 384 .fl4_src = saddr,
385 .fl4_tos = RT_TOS(tos), 385 .fl4_tos = RT_TOS(tos),
386 .flowi_proto = IPPROTO_ICMP, 386 .flowi_proto = IPPROTO_ICMP,
387 .fl_icmp_type = type, 387 .fl4_icmp_type = type,
388 .fl_icmp_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 97081702dffd..10a8e9523578 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 .fl4_tos = RT_CONN_FLAGS(sk), 365 .fl4_tos = RT_CONN_FLAGS(sk),
366 .flowi_proto = sk->sk_protocol, 366 .flowi_proto = sk->sk_protocol,
367 .flowi_flags = inet_sk_flowi_flags(sk), 367 .flowi_flags = inet_sk_flowi_flags(sk),
368 .fl_ip_sport = inet_sk(sk)->inet_sport, 368 .fl4_sport = inet_sk(sk)->inet_sport,
369 .fl_ip_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 e35ca40df03b..67e5f7130322 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 .fl4_dst = daddr, 1479 .fl4_dst = daddr,
1480 .fl4_src = rt->rt_spec_dst, 1480 .fl4_src = rt->rt_spec_dst,
1481 .fl4_tos = RT_TOS(ip_hdr(skb)->tos), 1481 .fl4_tos = RT_TOS(ip_hdr(skb)->tos),
1482 .fl_ip_sport = tcp_hdr(skb)->dest, 1482 .fl4_sport = tcp_hdr(skb)->dest,
1483 .fl_ip_dport = tcp_hdr(skb)->source, 1483 .fl4_dport = tcp_hdr(skb)->source,
1484 .flowi_proto = sk->sk_protocol, 1484 .flowi_proto = sk->sk_protocol,
1485 .flowi_flags = ip_reply_arg_flowi_flags(arg), 1485 .flowi_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 95481fee8bdb..1f3c695a47c8 100644
--- a/net/ipv4/netfilter/nf_nat_standalone.c
+++ b/net/ipv4/netfilter/nf_nat_standalone.c
@@ -55,7 +55,7 @@ static void nat_decode_session(struct sk_buff *skb, struct flowi *fl)
55 t->dst.protonum == IPPROTO_UDPLITE || 55 t->dst.protonum == IPPROTO_UDPLITE ||
56 t->dst.protonum == IPPROTO_DCCP || 56 t->dst.protonum == IPPROTO_DCCP ||
57 t->dst.protonum == IPPROTO_SCTP) 57 t->dst.protonum == IPPROTO_SCTP)
58 fl->fl_ip_dport = t->dst.u.tcp.port; 58 fl->fl4_dport = t->dst.u.tcp.port;
59 } 59 }
60 60
61 statusbit ^= IPS_NAT_MASK; 61 statusbit ^= IPS_NAT_MASK;
@@ -67,7 +67,7 @@ static void nat_decode_session(struct sk_buff *skb, struct flowi *fl)
67 t->dst.protonum == IPPROTO_UDPLITE || 67 t->dst.protonum == IPPROTO_UDPLITE ||
68 t->dst.protonum == IPPROTO_DCCP || 68 t->dst.protonum == IPPROTO_DCCP ||
69 t->dst.protonum == IPPROTO_SCTP) 69 t->dst.protonum == IPPROTO_SCTP)
70 fl->fl_ip_sport = t->src.u.tcp.port; 70 fl->fl4_sport = t->src.u.tcp.port;
71 } 71 }
72} 72}
73#endif 73#endif
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index b42b7cd56c03..333b826c1871 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -433,8 +433,8 @@ static int raw_probe_proto_opt(struct flowi *fl, 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(fl->fl_icmp_type, type) || 436 if (get_user(fl->fl4_icmp_type, type) ||
437 get_user(fl->fl_icmp_code, code)) 437 get_user(fl->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 98d47dc60c89..d90529d45ee6 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 .fl4_tos = RT_CONN_FLAGS(sk), 353 .fl4_tos = RT_CONN_FLAGS(sk),
354 .flowi_proto = IPPROTO_TCP, 354 .flowi_proto = IPPROTO_TCP,
355 .flowi_flags = inet_sk_flowi_flags(sk), 355 .flowi_flags = inet_sk_flowi_flags(sk),
356 .fl_ip_sport = th->dest, 356 .fl4_sport = th->dest,
357 .fl_ip_dport = th->source, 357 .fl4_dport = th->source,
358 }; 358 };
359 security_req_classify_flow(req, &fl); 359 security_req_classify_flow(req, &fl);
360 rt = ip_route_output_key(sock_net(sk), &fl); 360 rt = ip_route_output_key(sock_net(sk), &fl);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index e10f62e6c07c..116e4a8bfb73 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, fl->fl4_dst, fl->fl_ip_dport); 781 err = udp_send_skb(skb, fl->fl4_dst, fl->fl4_dport);
782 782
783out: 783out:
784 up->len = 0; 784 up->len = 0;
@@ -917,8 +917,8 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
917 .flowi_proto = sk->sk_protocol, 917 .flowi_proto = sk->sk_protocol,
918 .flowi_flags = (inet_sk_flowi_flags(sk) | 918 .flowi_flags = (inet_sk_flowi_flags(sk) |
919 FLOWI_FLAG_CAN_SLEEP), 919 FLOWI_FLAG_CAN_SLEEP),
920 .fl_ip_sport = inet->inet_sport, 920 .fl4_sport = inet->inet_sport,
921 .fl_ip_dport = dport, 921 .fl4_dport = dport,
922 }; 922 };
923 struct net *net = sock_net(sk); 923 struct net *net = sock_net(sk);
924 924
@@ -973,9 +973,9 @@ back_from_confirm:
973 * Now cork the socket to pend data. 973 * Now cork the socket to pend data.
974 */ 974 */
975 inet->cork.fl.fl4_dst = daddr; 975 inet->cork.fl.fl4_dst = daddr;
976 inet->cork.fl.fl_ip_dport = dport; 976 inet->cork.fl.fl4_dport = dport;
977 inet->cork.fl.fl4_src = saddr; 977 inet->cork.fl.fl4_src = saddr;
978 inet->cork.fl.fl_ip_sport = inet->inet_sport; 978 inet->cork.fl.fl4_sport = inet->inet_sport;
979 up->pending = AF_INET; 979 up->pending = AF_INET;
980 980
981do_append_data: 981do_append_data:
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 4294f121a749..b7b0921b425d 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -117,8 +117,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
117 pskb_may_pull(skb, xprth + 4 - skb->data)) { 117 pskb_may_pull(skb, xprth + 4 - skb->data)) {
118 __be16 *ports = (__be16 *)xprth; 118 __be16 *ports = (__be16 *)xprth;
119 119
120 fl->fl_ip_sport = ports[!!reverse]; 120 fl->fl4_sport = ports[!!reverse];
121 fl->fl_ip_dport = ports[!reverse]; 121 fl->fl4_dport = ports[!reverse];
122 } 122 }
123 break; 123 break;
124 124
@@ -126,8 +126,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
126 if (pskb_may_pull(skb, xprth + 2 - skb->data)) { 126 if (pskb_may_pull(skb, xprth + 2 - skb->data)) {
127 u8 *icmp = xprth; 127 u8 *icmp = xprth;
128 128
129 fl->fl_icmp_type = icmp[0]; 129 fl->fl4_icmp_type = icmp[0];
130 fl->fl_icmp_code = icmp[1]; 130 fl->fl4_icmp_code = icmp[1];
131 } 131 }
132 break; 132 break;
133 133
@@ -135,7 +135,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
135 if (pskb_may_pull(skb, xprth + 4 - skb->data)) { 135 if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
136 __be32 *ehdr = (__be32 *)xprth; 136 __be32 *ehdr = (__be32 *)xprth;
137 137
138 fl->fl_ipsec_spi = ehdr[0]; 138 fl->fl4_ipsec_spi = ehdr[0];
139 } 139 }
140 break; 140 break;
141 141
@@ -143,7 +143,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
143 if (pskb_may_pull(skb, xprth + 8 - skb->data)) { 143 if (pskb_may_pull(skb, xprth + 8 - skb->data)) {
144 __be32 *ah_hdr = (__be32*)xprth; 144 __be32 *ah_hdr = (__be32*)xprth;
145 145
146 fl->fl_ipsec_spi = ah_hdr[1]; 146 fl->fl4_ipsec_spi = ah_hdr[1];
147 } 147 }
148 break; 148 break;
149 149
@@ -151,7 +151,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
151 if (pskb_may_pull(skb, xprth + 4 - skb->data)) { 151 if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
152 __be16 *ipcomp_hdr = (__be16 *)xprth; 152 __be16 *ipcomp_hdr = (__be16 *)xprth;
153 153
154 fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1])); 154 fl->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
155 } 155 }
156 break; 156 break;
157 157
@@ -163,13 +163,13 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
163 if (greflags[0] & GRE_KEY) { 163 if (greflags[0] & GRE_KEY) {
164 if (greflags[0] & GRE_CSUM) 164 if (greflags[0] & GRE_CSUM)
165 gre_hdr++; 165 gre_hdr++;
166 fl->fl_gre_key = gre_hdr[1]; 166 fl->fl4_gre_key = gre_hdr[1];
167 } 167 }
168 } 168 }
169 break; 169 break;
170 170
171 default: 171 default:
172 fl->fl_ipsec_spi = 0; 172 fl->fl4_ipsec_spi = 0;
173 break; 173 break;
174 } 174 }
175 } 175 }
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c
index d2314348dd2a..663b5501abcd 100644
--- a/net/ipv4/xfrm4_state.c
+++ b/net/ipv4/xfrm4_state.c
@@ -25,9 +25,9 @@ __xfrm4_init_tempsel(struct xfrm_selector *sel, const struct flowi *fl)
25{ 25{
26 sel->daddr.a4 = fl->fl4_dst; 26 sel->daddr.a4 = fl->fl4_dst;
27 sel->saddr.a4 = fl->fl4_src; 27 sel->saddr.a4 = fl->fl4_src;
28 sel->dport = xfrm_flowi_dport(fl); 28 sel->dport = xfrm_flowi_dport(fl, &fl->uli_u);
29 sel->dport_mask = htons(0xffff); 29 sel->dport_mask = htons(0xffff);
30 sel->sport = xfrm_flowi_sport(fl); 30 sel->sport = xfrm_flowi_sport(fl, &fl->uli_u);
31 sel->sport_mask = htons(0xffff); 31 sel->sport_mask = htons(0xffff);
32 sel->family = AF_INET; 32 sel->family = AF_INET;
33 sel->prefixlen_d = 32; 33 sel->prefixlen_d = 32;