aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2007-01-29 17:57:14 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-02-07 15:07:49 -0500
commitab81afd30bc154bb1e8749e5aeeffe9b93c90834 (patch)
tree715a7d94833a1c54cf206cfd1beab76dedabba74 /fs
parent3b8118cffad224415c6f6f35abe7ca2a1d79c05a (diff)
ocfs2: Binds listener to the configured ip address
This patch binds the o2net listener to the configured ip address instead of INADDR_ANY for security. Fixes oss.oracle.com bugzilla#814. Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/cluster/tcp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 7700418d25ec..2021aec7cbbd 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -1805,13 +1805,13 @@ out:
1805 ready(sk, bytes); 1805 ready(sk, bytes);
1806} 1806}
1807 1807
1808static int o2net_open_listening_sock(__be16 port) 1808static int o2net_open_listening_sock(__be32 addr, __be16 port)
1809{ 1809{
1810 struct socket *sock = NULL; 1810 struct socket *sock = NULL;
1811 int ret; 1811 int ret;
1812 struct sockaddr_in sin = { 1812 struct sockaddr_in sin = {
1813 .sin_family = PF_INET, 1813 .sin_family = PF_INET,
1814 .sin_addr = { .s_addr = (__force u32)htonl(INADDR_ANY) }, 1814 .sin_addr = { .s_addr = (__force u32)addr },
1815 .sin_port = (__force u16)port, 1815 .sin_port = (__force u16)port,
1816 }; 1816 };
1817 1817
@@ -1834,15 +1834,15 @@ static int o2net_open_listening_sock(__be16 port)
1834 sock->sk->sk_reuse = 1; 1834 sock->sk->sk_reuse = 1;
1835 ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); 1835 ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
1836 if (ret < 0) { 1836 if (ret < 0) {
1837 mlog(ML_ERROR, "unable to bind socket to port %d, ret=%d\n", 1837 mlog(ML_ERROR, "unable to bind socket at %u.%u.%u.%u:%u, "
1838 ntohs(port), ret); 1838 "ret=%d\n", NIPQUAD(addr), ntohs(port), ret);
1839 goto out; 1839 goto out;
1840 } 1840 }
1841 1841
1842 ret = sock->ops->listen(sock, 64); 1842 ret = sock->ops->listen(sock, 64);
1843 if (ret < 0) { 1843 if (ret < 0) {
1844 mlog(ML_ERROR, "unable to listen on port %d, ret=%d\n", 1844 mlog(ML_ERROR, "unable to listen on %u.%u.%u.%u:%u, ret=%d\n",
1845 ntohs(port), ret); 1845 NIPQUAD(addr), ntohs(port), ret);
1846 } 1846 }
1847 1847
1848out: 1848out:
@@ -1875,7 +1875,8 @@ int o2net_start_listening(struct o2nm_node *node)
1875 return -ENOMEM; /* ? */ 1875 return -ENOMEM; /* ? */
1876 } 1876 }
1877 1877
1878 ret = o2net_open_listening_sock(node->nd_ipv4_port); 1878 ret = o2net_open_listening_sock(node->nd_ipv4_address,
1879 node->nd_ipv4_port);
1879 if (ret) { 1880 if (ret) {
1880 destroy_workqueue(o2net_wq); 1881 destroy_workqueue(o2net_wq);
1881 o2net_wq = NULL; 1882 o2net_wq = NULL;