IP addresses in "workers" admin protocol output

21 views
Skip to first unread message

James

unread,
Aug 9, 2010, 1:13:47 PM8/9/10
to gearman
Hi All,

I've been using the admin plaintext protocol to query a gearmand
instance for status/workers. I'm getting an odd result in the "IP"
field returned though. It looks a little bit like an IPv6 IP but
doesn't seem to be function of the client IP address. If I connect two
different workers from two different servers (both referencing the
server using IPv4 IP addresses) I get the same value in the "IP"
field.

Here's some example output with a single worker connected:

<snip>
workers
14 ::38b5:e019:0:0%434156840 - : bar
13 ::38b5:e019:0:0%434156840 - :
12 ::38b5:e019:0:0%434156840 - :
11 ::38b5:e019:0:0%434156840 - : foo
.
</snip>

by FD they are:
14 - worker connection via 127.0.0.1
13 - telnet connection from 127.0.0.1
12 - telnet connection from 192.168.254.x address
11 - worker connection via 192.168.240.x address

I had a snoopy in server.c but couldn't see anything obvious there
except that it was returning conn->host

When I run the daemon with -vvvv I can see connections reported as
coming from ::38b5:e019:0:0%434156840 too

Built/run on CentOS 5.x

Any idea what the values and whether this is a bug or not?

Thanks,

James

jay.pa...@escapemg.com

unread,
Aug 12, 2010, 7:59:28 PM8/12/10
to gearman
We're seeing the same thing, also on CentOS 5.

Jay

James

unread,
Aug 18, 2010, 4:12:05 AM8/18/10
to gearman
On of my colleagues created a patch for this problem. Which I can't
seem to attach to the group via the web interface so here it is
inline.

He explained that "A struct sockaddr isn't big enough to hold an ipv6
address. It's just basically the header of the structure."

<snip>
--- gearmand-0.14-orig/libgearman-server/gearmand.c 2010-06-29
23:26:10.000000000 +0100
+++ gearmand-0.14/libgearman-server/gearmand.c 2010-08-17
15:17:45.000000000 +0100
@@ -500,14 +500,14 @@
void *arg)
{
gearmand_port_st *port= (gearmand_port_st *)arg;
- struct sockaddr sa;
+ struct sockaddr_storage sa;
socklen_t sa_len;
char host[NI_MAXHOST];
char port_str[NI_MAXSERV];
int ret;

sa_len= sizeof(sa);
- fd= accept(fd, &sa, &sa_len);
+ fd= accept(fd, (struct sockaddr *)&sa, &sa_len);
if (fd == -1)
{
if (errno == EINTR)
</snip>

On Aug 13, 12:59 am, "jay.parol...@escapemg.com"
Reply all
Reply to author
Forward
0 new messages