Commit f4bfd99f authored by David S. Miller's avatar David S. Miller

libcxgbi: Use flowi4's saddr in cxgbi_check_route().

Instead of rt->rt_src
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 28c90da0
...@@ -450,13 +450,13 @@ static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev) ...@@ -450,13 +450,13 @@ static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev)
return csk; return csk;
} }
static struct rtable *find_route_ipv4(__be32 saddr, __be32 daddr, static struct rtable *find_route_ipv4(struct flowi4 *fl4,
__be32 saddr, __be32 daddr,
__be16 sport, __be16 dport, u8 tos) __be16 sport, __be16 dport, u8 tos)
{ {
struct rtable *rt; struct rtable *rt;
struct flowi4 fl4;
rt = ip_route_output_ports(&init_net, &fl4, NULL, daddr, saddr, rt = ip_route_output_ports(&init_net, fl4, NULL, daddr, saddr,
dport, sport, IPPROTO_TCP, tos, 0); dport, sport, IPPROTO_TCP, tos, 0);
if (IS_ERR(rt)) if (IS_ERR(rt))
return NULL; return NULL;
...@@ -471,6 +471,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr) ...@@ -471,6 +471,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
struct net_device *ndev; struct net_device *ndev;
struct cxgbi_device *cdev; struct cxgbi_device *cdev;
struct rtable *rt = NULL; struct rtable *rt = NULL;
struct flowi4 fl4;
struct cxgbi_sock *csk = NULL; struct cxgbi_sock *csk = NULL;
unsigned int mtu = 0; unsigned int mtu = 0;
int port = 0xFFFF; int port = 0xFFFF;
...@@ -483,7 +484,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr) ...@@ -483,7 +484,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
goto err_out; goto err_out;
} }
rt = find_route_ipv4(0, daddr->sin_addr.s_addr, 0, daddr->sin_port, 0); rt = find_route_ipv4(&fl4, 0, daddr->sin_addr.s_addr, 0, daddr->sin_port, 0);
if (!rt) { if (!rt) {
pr_info("no route to ipv4 0x%x, port %u.\n", pr_info("no route to ipv4 0x%x, port %u.\n",
daddr->sin_addr.s_addr, daddr->sin_port); daddr->sin_addr.s_addr, daddr->sin_port);
...@@ -532,7 +533,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr) ...@@ -532,7 +533,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr; csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr;
csk->daddr.sin_port = daddr->sin_port; csk->daddr.sin_port = daddr->sin_port;
csk->daddr.sin_family = daddr->sin_family; csk->daddr.sin_family = daddr->sin_family;
csk->saddr.sin_addr.s_addr = rt->rt_src; csk->saddr.sin_addr.s_addr = fl4.saddr;
return csk; return csk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment