Patchwork [BRANCH:master,BUG:140,TAKE-2] client-protocol: log messages at DEBUG loglevel when client_bind on privileged port fails.

login
register
Submitter Raghavendra G
Date 2009-07-30 13:35:26
Message ID <20090730133526.GA19505@dev.gluster.com>
Download mbox | patch
Permalink /patch/837/
State Superseded
Headers show

Comments

Raghavendra G - 2009-07-30 13:35:26
---
 transport/ib-verbs/src/name.c |    2 +-
 transport/socket/src/name.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Anand Avati - 2009-07-30 19:14:19
> diff --git a/transport/ib-verbs/src/name.c b/transport/ib-verbs/src/name.c
> index 31ce529..10af5fd 100644
> --- a/transport/ib-verbs/src/name.c
> +++ b/transport/ib-verbs/src/name.c
> @@ -418,7 +418,7 @@ client_bind (transport_t *this,
>                                                         *sockaddr_len, 
>                                                         CLIENT_PORT_CEILING);
>                  if (ret == -1) {
> -                        gf_log (this->xl->name, GF_LOG_ERROR,
> +                        gf_log (this->xl->name, GF_LOG_DEBUG,
>                                  "cannot bind inet socket (%d) to port "
>                                  "less than %d (%s)", 
>                                  sock, CLIENT_PORT_CEILING, strerror (errno));

This log should definitely be a warning, and we should provide an option for the user to specify a range
of source ports. This actually came up in a sales call where the admins want to bind the source port of
glusterfs to a specific range to permit filesystem traffic across their firewall. Assume that by default
the range is 0-1024, and the admin can override this range with 'option bind-port-range NUM1-NUM2'. When
binding fails in this range, it should definitely be a warning and fallback to a non bind()ed connect().
Anand Avati - 2009-07-30 19:15:18
> >                                                         *sockaddr_len, 
> >                                                         CLIENT_PORT_CEILING);
> >                  if (ret == -1) {
> > -                        gf_log (this->xl->name, GF_LOG_ERROR,
> > +                        gf_log (this->xl->name, GF_LOG_DEBUG,
> >                                  "cannot bind inet socket (%d) to port "
> >                                  "less than %d (%s)", 
> >                                  sock, CLIENT_PORT_CEILING, strerror (errno));
> 
> This log should definitely be a warning, and we should provide an option for the user to specify a range
> of source ports. This actually came up in a sales call where the admins want to bind the source port of
> glusterfs to a specific range to permit filesystem traffic across their firewall. Assume that by default
> the range is 0-1024, and the admin can override this range with 'option bind-port-range NUM1-NUM2'. When
> binding fails in this range, it should definitely be a warning and fallback to a non bind()ed connect().

Also, when you submit another take for the same patch, please mark the previous submission as 'Superseded'

Avati

Patch

diff --git a/transport/ib-verbs/src/name.c b/transport/ib-verbs/src/name.c
index 31ce529..10af5fd 100644
--- a/transport/ib-verbs/src/name.c
+++ b/transport/ib-verbs/src/name.c
@@ -418,7 +418,7 @@  client_bind (transport_t *this,
                                                        *sockaddr_len, 
                                                        CLIENT_PORT_CEILING);
                 if (ret == -1) {
-                        gf_log (this->xl->name, GF_LOG_ERROR,
+                        gf_log (this->xl->name, GF_LOG_DEBUG,
                                 "cannot bind inet socket (%d) to port "
                                 "less than %d (%s)", 
                                 sock, CLIENT_PORT_CEILING, strerror (errno));
diff --git a/transport/socket/src/name.c b/transport/socket/src/name.c
index bb41c1c..5f187d6 100644
--- a/transport/socket/src/name.c
+++ b/transport/socket/src/name.c
@@ -415,7 +415,7 @@  client_bind (transport_t *this,
                 ret = af_inet_bind_to_port_lt_ceiling (sock, sockaddr, 
                                                        *sockaddr_len, CLIENT_PORT_CEILING);
                 if (ret == -1) {
-                        gf_log (this->xl->name, GF_LOG_ERROR,
+                        gf_log (this->xl->name, GF_LOG_DEBUG,
                                 "cannot bind inet socket (%d) to port less than %d (%s)", 
                                 sock, CLIENT_PORT_CEILING, strerror (errno));
                         ret = 0;