aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-01-31 20:35:35 -0500
committerDavid S. Miller <davem@davemloft.net>2006-01-31 20:35:35 -0500
commit5d39a795bfa217b5f7637028c83ab5cb291f37bf (patch)
tree025bee4ea9c90b5fac7a7c939664a89120303170
parent7fb76aa07facce5cb9c8d26a0de09001a31eed0c (diff)
[IPV4]: Always set fl.proto in ip_route_newports
ip_route_newports uses the struct flowi from the struct rtable returned by ip_route_connect for the new route lookup and just replaces the port numbers if they have changed. If an IPsec policy exists which doesn't match port 0 the struct flowi won't have the proto field set and no xfrm lookup is done for the changed ports. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/route.h5
-rw-r--r--net/dccp/ipv4.c3
-rw-r--r--net/ipv4/tcp_ipv4.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/include/net/route.h b/include/net/route.h
index e3e5436f8017..9c04f15090d2 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -170,8 +170,8 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst,
170 return ip_route_output_flow(rp, &fl, sk, 0); 170 return ip_route_output_flow(rp, &fl, sk, 0);
171} 171}
172 172
173static inline int ip_route_newports(struct rtable **rp, u16 sport, u16 dport, 173static inline int ip_route_newports(struct rtable **rp, u8 protocol,
174 struct sock *sk) 174 u16 sport, u16 dport, struct sock *sk)
175{ 175{
176 if (sport != (*rp)->fl.fl_ip_sport || 176 if (sport != (*rp)->fl.fl_ip_sport ||
177 dport != (*rp)->fl.fl_ip_dport) { 177 dport != (*rp)->fl.fl_ip_dport) {
@@ -180,6 +180,7 @@ static inline int ip_route_newports(struct rtable **rp, u16 sport, u16 dport,
180 memcpy(&fl, &(*rp)->fl, sizeof(fl)); 180 memcpy(&fl, &(*rp)->fl, sizeof(fl));
181 fl.fl_ip_sport = sport; 181 fl.fl_ip_sport = sport;
182 fl.fl_ip_dport = dport; 182 fl.fl_ip_dport = dport;
183 fl.proto = protocol;
183 ip_rt_put(*rp); 184 ip_rt_put(*rp);
184 *rp = NULL; 185 *rp = NULL;
185 return ip_route_output_flow(rp, &fl, sk, 0); 186 return ip_route_output_flow(rp, &fl, sk, 0);
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 00f983226672..dc0487b5bace 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -119,7 +119,8 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
119 if (err != 0) 119 if (err != 0)
120 goto failure; 120 goto failure;
121 121
122 err = ip_route_newports(&rt, inet->sport, inet->dport, sk); 122 err = ip_route_newports(&rt, IPPROTO_DCCP, inet->sport, inet->dport,
123 sk);
123 if (err != 0) 124 if (err != 0)
124 goto failure; 125 goto failure;
125 126
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 6ea353907af5..1ac35a65b2e5 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -236,7 +236,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
236 if (err) 236 if (err)
237 goto failure; 237 goto failure;
238 238
239 err = ip_route_newports(&rt, inet->sport, inet->dport, sk); 239 err = ip_route_newports(&rt, IPPROTO_TCP, inet->sport, inet->dport, sk);
240 if (err) 240 if (err)
241 goto failure; 241 goto failure;
242 242