Commit 4232e863 authored by Chuck Lever's avatar Chuck Lever Committed by J. Bruce Fields

SUNRPC: Use conventional switch statement when reclassifying sockets

Clean up.

Defensive coding: If "family" is ever something that is neither
AF_INET nor AF_INET6, xs_reclassify_socket6() is not the appropriate
default action.  Choose to do nothing in that case.

Introduced by commit 6bc9638a.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent a25e758c
...@@ -1558,7 +1558,7 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock) ...@@ -1558,7 +1558,7 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock)
nloop++; nloop++;
} while (err == -EADDRINUSE && nloop != 2); } while (err == -EADDRINUSE && nloop != 2);
if (myaddr.ss_family == PF_INET) if (myaddr.ss_family == AF_INET)
dprintk("RPC: %s %pI4:%u: %s (%d)\n", __func__, dprintk("RPC: %s %pI4:%u: %s (%d)\n", __func__,
&((struct sockaddr_in *)&myaddr)->sin_addr, &((struct sockaddr_in *)&myaddr)->sin_addr,
port, err ? "failed" : "ok", err); port, err ? "failed" : "ok", err);
...@@ -1594,10 +1594,14 @@ static inline void xs_reclassify_socket6(struct socket *sock) ...@@ -1594,10 +1594,14 @@ static inline void xs_reclassify_socket6(struct socket *sock)
static inline void xs_reclassify_socket(int family, struct socket *sock) static inline void xs_reclassify_socket(int family, struct socket *sock)
{ {
if (family == PF_INET) switch (family) {
case AF_INET:
xs_reclassify_socket4(sock); xs_reclassify_socket4(sock);
else break;
case AF_INET6:
xs_reclassify_socket6(sock); xs_reclassify_socket6(sock);
break;
}
} }
#else #else
static inline void xs_reclassify_socket4(struct socket *sock) static inline void xs_reclassify_socket4(struct socket *sock)
......
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