git.samba.org
/
sahlberg
/
ctdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
be50059
)
we need to set the port properly in the parse_ip helper
author
Ronnie Sahlberg
<ronniesahlberg@gmail.com>
Tue, 24 Mar 2009 02:45:11 +0000
(13:45 +1100)
committer
Ronnie Sahlberg
<ronniesahlberg@gmail.com>
Tue, 24 Mar 2009 02:45:11 +0000
(13:45 +1100)
common/ctdb_util.c
patch
|
blob
|
history
include/ctdb_private.h
patch
|
blob
|
history
server/ctdb_recover.c
patch
|
blob
|
history
server/ctdbd.c
patch
|
blob
|
history
tcp/tcp_connect.c
patch
|
blob
|
history
tcp/tcp_init.c
patch
|
blob
|
history
tools/ctdb.c
patch
|
blob
|
history
diff --git
a/common/ctdb_util.c
b/common/ctdb_util.c
index 33d30e2108447535d062154cd5661e308e8d52fb..a3f1731fa1370d188758a63ace1f2bcdb796ac67 100644
(file)
--- a/
common/ctdb_util.c
+++ b/
common/ctdb_util.c
@@
-435,7
+435,7
@@
bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr)
/* now is this a ipv4 or ipv6 address ?*/
/* now is this a ipv4 or ipv6 address ?*/
- ret = parse_ip(s, NULL, addr);
+ ret = parse_ip(s, NULL,
port, s
addr);
talloc_free(tmp_ctx);
return ret;
talloc_free(tmp_ctx);
return ret;
@@
-444,7
+444,7
@@
bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr)
/*
parse an ip
*/
/*
parse an ip
*/
-bool parse_ip(const char *addr, const char *iface, ctdb_sock_addr *saddr)
+bool parse_ip(const char *addr, const char *iface,
unsigned port,
ctdb_sock_addr *saddr)
{
char *p;
bool ret;
{
char *p;
bool ret;
@@
-452,9
+452,9
@@
bool parse_ip(const char *addr, const char *iface, ctdb_sock_addr *saddr)
/* now is this a ipv4 or ipv6 address ?*/
p = index(addr, ':');
if (p == NULL) {
/* now is this a ipv4 or ipv6 address ?*/
p = index(addr, ':');
if (p == NULL) {
- ret = parse_ipv4(addr,
0
, &saddr->ip);
+ ret = parse_ipv4(addr,
port
, &saddr->ip);
} else {
} else {
- ret = parse_ipv6(addr, iface,
0
, saddr);
+ ret = parse_ipv6(addr, iface,
port
, saddr);
}
return ret;
}
return ret;
@@
-496,7
+496,7
@@
bool parse_ip_mask(const char *str, const char *iface, ctdb_sock_addr *addr, uns
/* now is this a ipv4 or ipv6 address ?*/
/* now is this a ipv4 or ipv6 address ?*/
- ret = parse_ip(s, iface, addr);
+ ret = parse_ip(s, iface,
0,
addr);
talloc_free(tmp_ctx);
return ret;
talloc_free(tmp_ctx);
return ret;
@@
-575,6
+575,21
@@
char *ctdb_addr_to_str(ctdb_sock_addr *addr)
return cip;
}
return cip;
}
+unsigned ctdb_addr_to_port(ctdb_sock_addr *addr)
+{
+ switch (addr->sa.sa_family) {
+ case AF_INET:
+ return ntohs(addr->ip.sin_port);
+ break;
+ case AF_INET6:
+ return ntohs(addr->ip6.sin6_port);
+ break;
+ default:
+ DEBUG(DEBUG_ERR, (__location__ " ERROR, unknown family %u\n", addr->sa.sa_family));
+ }
+
+ return 0;
+}
void ctdb_block_signal(int signum)
{
void ctdb_block_signal(int signum)
{
diff --git
a/include/ctdb_private.h
b/include/ctdb_private.h
index 988b6d94bb2bbc4c8e73e11aa8e2b6b14aea55b4..b6f44dedeb1a9b589097f83654c6b7e0e642d69a 100644
(file)
--- a/
include/ctdb_private.h
+++ b/
include/ctdb_private.h
@@
-1290,7
+1290,7
@@
void ctdb_start_freeze(struct ctdb_context *ctdb);
bool parse_ip_mask(const char *s, const char *iface, ctdb_sock_addr *addr, unsigned *mask);
bool parse_ip_port(const char *s, ctdb_sock_addr *addr);
bool parse_ip_mask(const char *s, const char *iface, ctdb_sock_addr *addr, unsigned *mask);
bool parse_ip_port(const char *s, ctdb_sock_addr *addr);
-bool parse_ip(const char *s, const char *iface, ctdb_sock_addr *addr);
+bool parse_ip(const char *s, const char *iface,
unsigned port,
ctdb_sock_addr *addr);
bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin);
bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin);
@@
-1401,6
+1401,7
@@
int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb,
struct ctdb_req_control *c);
char *ctdb_addr_to_str(ctdb_sock_addr *addr);
struct ctdb_req_control *c);
char *ctdb_addr_to_str(ctdb_sock_addr *addr);
+unsigned ctdb_addr_to_port(ctdb_sock_addr *addr);
void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip);
int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb);
void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip);
int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb);
diff --git
a/server/ctdb_recover.c
b/server/ctdb_recover.c
index 2d95b184666262cdae85c43b1fc9cf7f241f1539..12b95deb7bf5f48076ba621cad64609a917888c2 100644
(file)
--- a/
server/ctdb_recover.c
+++ b/
server/ctdb_recover.c
@@
-165,6
+165,7
@@
ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA ind
for (i=0; i<num_nodes; i++) {
if (parse_ip(ctdb->nodes[i]->address.address,
NULL, /* TODO: pass in the correct interface here*/
for (i=0; i<num_nodes; i++) {
if (parse_ip(ctdb->nodes[i]->address.address,
NULL, /* TODO: pass in the correct interface here*/
+ 0,
&node_map->nodes[i].addr) == 0)
{
DEBUG(DEBUG_ERR, (__location__ " Failed to parse %s into a sockaddr\n", ctdb->nodes[i]->address.address));
&node_map->nodes[i].addr) == 0)
{
DEBUG(DEBUG_ERR, (__location__ " Failed to parse %s into a sockaddr\n", ctdb->nodes[i]->address.address));
diff --git
a/server/ctdbd.c
b/server/ctdbd.c
index 1d3b22aff78f9a71ffab583061213e56a93a3b16..5670b9387d63779c46a027c8eaead0cec7fca3eb 100644
(file)
--- a/
server/ctdbd.c
+++ b/
server/ctdbd.c
@@
-281,6
+281,7
@@
int main(int argc, const char *argv[])
if (parse_ip(options.single_public_ip,
svnn->iface,
if (parse_ip(options.single_public_ip,
svnn->iface,
+ 0,
&svnn->public_address) == 0) {
DEBUG(DEBUG_ALERT,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
exit(10);
&svnn->public_address) == 0) {
DEBUG(DEBUG_ALERT,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
exit(10);
diff --git
a/tcp/tcp_connect.c
b/tcp/tcp_connect.c
index ac443d1f8e58d18e333e2fe20396ceb752c86b12..9d28d48a1f0d5a2c155bfd9b964b2d94965746c2 100644
(file)
--- a/
tcp/tcp_connect.c
+++ b/
tcp/tcp_connect.c
@@
-109,7
+109,7
@@
static void ctdb_node_connect_write(struct event_context *ev, struct fd_event *f
static int ctdb_tcp_get_address(struct ctdb_context *ctdb,
const char *address, ctdb_sock_addr *addr)
{
static int ctdb_tcp_get_address(struct ctdb_context *ctdb,
const char *address, ctdb_sock_addr *addr)
{
- if (parse_ip(address, NULL, addr) == 0) {
+ if (parse_ip(address, NULL,
0,
addr) == 0) {
DEBUG(DEBUG_CRIT, (__location__ " Unparsable address : %s.\n", address));
return -1;
}
DEBUG(DEBUG_CRIT, (__location__ " Unparsable address : %s.\n", address));
return -1;
}
diff --git
a/tcp/tcp_init.c
b/tcp/tcp_init.c
index 737bd8e4a54c37e9555483c9767d5a737c30c626..c0606f0ec5464f388de9b3f8b57d3da8cdbfc7cd 100644
(file)
--- a/
tcp/tcp_init.c
+++ b/
tcp/tcp_init.c
@@
-27,7
+27,7
@@
static int tnode_destructor(struct ctdb_tcp_node *tnode)
{
static int tnode_destructor(struct ctdb_tcp_node *tnode)
{
-
struct ctdb_node *node = talloc_find_parent_bytype(tnode, struct ctdb_node);
+
//
struct ctdb_node *node = talloc_find_parent_bytype(tnode, struct ctdb_node);
if (tnode->fd != -1) {
close(tnode->fd);
if (tnode->fd != -1) {
close(tnode->fd);
diff --git
a/tools/ctdb.c
b/tools/ctdb.c
index c48d5870954280ba624255ac9b01000655f85cda..8fcf95bdac29920569f85a9297a023ba992c7f4b 100644
(file)
--- a/
tools/ctdb.c
+++ b/
tools/ctdb.c
@@
-540,7
+540,7
@@
static int control_get_tickles(struct ctdb_context *ctdb, int argc, const char *
usage();
}
usage();
}
- if (parse_ip(argv[0], NULL, &addr) == 0) {
+ if (parse_ip(argv[0], NULL,
0,
&addr) == 0) {
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
return -1;
}
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
return -1;
}
@@
-612,7
+612,7
@@
static int control_moveip(struct ctdb_context *ctdb, int argc, const char **argv
usage();
}
usage();
}
- if (parse_ip(argv[0], NULL, &addr) == 0) {
+ if (parse_ip(argv[0], NULL,
0,
&addr) == 0) {
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
return -1;
}
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
return -1;
}
@@
-988,7
+988,7
@@
static int control_delip(struct ctdb_context *ctdb, int argc, const char **argv)
usage();
}
usage();
}
- if (parse_ip(argv[0], NULL, &addr) == 0) {
+ if (parse_ip(argv[0], NULL,
0,
&addr) == 0) {
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
return -1;
}
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
return -1;
}
@@
-1086,7
+1086,7
@@
static int control_gratious_arp(struct ctdb_context *ctdb, int argc, const char
usage();
}
usage();
}
- if (!parse_ip(argv[0], NULL, &addr)) {
+ if (!parse_ip(argv[0], NULL,
0,
&addr)) {
DEBUG(DEBUG_ERR, ("Bad IP '%s'\n", argv[0]));
return -1;
}
DEBUG(DEBUG_ERR, ("Bad IP '%s'\n", argv[0]));
return -1;
}