forked from akaher/photon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux-rt: Fix patch to apply on linux-rt
Change-Id: Ia6caa67160b2014eef43ea471d0aeabc39b51709 Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/8736 Tested-by: gerrit-photon <photon-checkins@vmware.com> Reviewed-by: Anish Swaminathan <anishs@vmware.com>
- Loading branch information
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
SUNRPC-xs_bind-uses-ip_local_reserved_ports_linux_rt.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
From 5ff0b9e728e23e54001c2bb6df29d85ac2c5e08f Mon Sep 17 00:00:00 2001 | ||
From: Alexey Makhalov <amakhalov@vmware.com> | ||
Date: Fri, 25 Mar 2016 21:51:12 +0000 | ||
Subject: [PATCH] sunrpc: xs_bind uses ip_local_reserved_ports | ||
|
||
--- | ||
net/sunrpc/xprtsock.c | 7 ++++++- | ||
1 file changed, 6 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c | ||
index 2ffaf6a..90543d6 100644 | ||
--- a/net/sunrpc/xprtsock.c | ||
+++ b/net/sunrpc/xprtsock.c | ||
@@ -1798,9 +1798,11 @@ static unsigned short xs_next_srcport(struct sock_xprt *transport, unsigned shor | ||
static int xs_bind(struct sock_xprt *transport, struct socket *sock) | ||
{ | ||
struct sockaddr_storage myaddr; | ||
- int err, nloop = 0; | ||
+ int err = -EADDRINUSE; | ||
+ int nloop = 0; | ||
unsigned short port = xs_get_srcport(transport); | ||
unsigned short last; | ||
+ struct net *net = transport->xprt.xprt_net; | ||
|
||
/* | ||
* If we are asking for any ephemeral port (i.e. port == 0 && | ||
@@ -1822,6 +1824,8 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock) | ||
|
||
memcpy(&myaddr, &transport->srcaddr, transport->xprt.addrlen); | ||
do { | ||
+ if (inet_is_local_reserved_port(net, port)) | ||
+ goto next_port; | ||
rpc_set_port((struct sockaddr *)&myaddr, port); | ||
err = kernel_bind(sock, (struct sockaddr *)&myaddr, | ||
transport->xprt.addrlen); | ||
@@ -1829,6 +1833,7 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock) | ||
transport->srcport = port; | ||
break; | ||
} | ||
+next_port: | ||
last = port; | ||
port = xs_next_srcport(transport, port); | ||
if (port > last) | ||
-- | ||
1.9.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters