summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/common-utils.c10
-rw-r--r--tests/bugs/glusterd/bug-1454418-seg-fault.t25
2 files changed, 30 insertions, 5 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 635d092bc7d..65557fefba2 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -3181,14 +3181,14 @@ gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling)
{
gf_boolean_t result = _gf_false;
char *range_port = NULL;
- int16_t tmp_port1 = -1;
- int16_t tmp_port2 = -1;
+ int32_t tmp_port1 = -1;
+ int32_t tmp_port2 = -1;
if (strstr (blocked_port, "-") == NULL) {
/* get rid of the new line character*/
if (blocked_port[strlen(blocked_port) -1] == '\n')
blocked_port[strlen(blocked_port) -1] = '\0';
- if (gf_string2int16 (blocked_port, &tmp_port1) == 0) {
+ if (gf_string2int32 (blocked_port, &tmp_port1) == 0) {
if (tmp_port1 > ceiling
|| tmp_port1 < 0) {
gf_msg ("glusterfs-socket", GF_LOG_WARNING, 0,
@@ -3214,7 +3214,7 @@ gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling)
result = _gf_true;
goto out;
}
- if (gf_string2int16 (range_port, &tmp_port1) == 0) {
+ if (gf_string2int32 (range_port, &tmp_port1) == 0) {
if (tmp_port1 > ceiling)
tmp_port1 = ceiling;
if (tmp_port1 < 0)
@@ -3228,7 +3228,7 @@ gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling)
/* get rid of the new line character*/
if (range_port[strlen(range_port) -1] == '\n')
range_port[strlen(range_port) - 1] = '\0';
- if (gf_string2int16 (range_port, &tmp_port2) == 0) {
+ if (gf_string2int32 (range_port, &tmp_port2) == 0) {
if (tmp_port2 > ceiling)
tmp_port2 = ceiling;
if (tmp_port2 < 0)
diff --git a/tests/bugs/glusterd/bug-1454418-seg-fault.t b/tests/bugs/glusterd/bug-1454418-seg-fault.t
new file mode 100644
index 00000000000..eafaa55ede8
--- /dev/null
+++ b/tests/bugs/glusterd/bug-1454418-seg-fault.t
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../cluster.rc
+
+
+cleanup;
+
+## Setting Port number in specific range
+sysctl net.ipv4.ip_local_reserved_ports="24007-24008,32765-32768,49152-49156"
+
+## Start a 2 node virtual cluster
+TEST launch_cluster 2;
+
+
+## Peer probe server 2 from server 1 cli
+TEST $CLI_1 peer probe $H2;
+
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count
+
+sysctl net.ipv4.ip_local_reserved_ports="
+"
+
+cleanup;
+