Nikos,

Thanks for the reply and sorry about the incorrect list.
The variable is called "name" in the function gw_gethostbyname in 
gwlib/protected.c.
Line 186: int gw_gethostbyname(struct hostent *ent, const char *name, char 
**buff)

If I print this variable before it is passed to:

while ((res=gethostbyname_r(name, &hp, *buff, bufflen, &tmphp, &herr)) == 
ERANGE) {

it prints out 2.2.2.2:9001 instead of just 2.2.2.2


Here is my /etc/hosts file:

127.0.0.1       localhost
10.20.10.6      Amstel.telrite.com      Amstel
2.2.2.2        smstest.laborbridge.com

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts



I am able to telnet to port 9001 on 2.2.2.2 but not port 9201? Was that a typo?

Thanks,
Brian



-------- Original Message  --------
Subject: Re:Problem with gw_gethostbyname in Stable version 1.4.3
From: Nikos Balkanas <[email protected]>
To: Brian Rathman <[email protected]>, [email protected]
Date: Monday, August 09, 2010 7:10:37 PM

Hi,

Always use users list for such questions.

Add your server to /etc/hosts.

I don't know to which variable "name" you are referring to.

Try:

telnet 2222 9201

from a shell to see if you have connectivity to HTTP smsc. That address 2.2.2.2 in your send-url looks mighty suspicious.

BR,
Nikos
----- Original Message ----- From: "Brian Rathman" <[email protected]>
To: <[email protected]>
Sent: Tuesday, August 10, 2010 12:49 AM
Subject: Problem with gw_gethostbyname in Stable version 1.4.3


Hi, I am attempting to connect two Kannel servers at two different locations via the smsc group using smsc = http. I have tried this on three different server and I am getting the same bevahior on all three (system 1: debian 5.0.5, system 2: Ubuntu 9.04, system 3: Ubuntu 10.04). In all three cases, when I send a message via the sendsms-user group, I get the following error:

2010-08-09 10:13:47 [9636] [17] ERROR: Error while gw_gethostbyname occurs.
2010-08-09 10:13:47 [9636] [17] ERROR: System error 3: No such process
2010-08-09 10:13:47 [9636] [17] ERROR: gethostbyname failed
2010-08-09 10:13:47 [9636] [17] ERROR: error connecting to server `2.2.2.2:9001' at port `9001'

I googled several things before bothering you guys, and even tried adding some code to the protected.c file in the gw_gethostbyname function to try and figure out what was going on. What I found, was that the "name" variable is showing up as 2.2.2.2:9001 instead of just 2.2.2.2. I'm not sure if this correct or not.

Anyways, here is my config and my logs:


# HTTP administration is disabled by default. Make sure you set the
# password if you enable it.

group = core
admin-port = 13000
admin-password = bar
admin-deny-ip = "*.*.*.*"
admin-allow-ip = ""
smsbox-port = 13001
#wapbox-port = 13002
wdp-interface-name = "*"
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0 # Testing
#log-level = 1 # Production
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"

#group = wapbox
#bearerbox-host = localhost
#log-file = "/var/log/kannel/wapbox.log"

group = smsc
smsc = http
system-type = kannel
smsc-id = LBSMS1
smsc-username = XXXXXXX
smsc-password = XXXXXXX
port = 9001
send-url = "http://2.2.2.2:9001";
#connect-allow-ip = "127.0.0.1"

group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
log-file = "/var/log/kannel/smsbox.log"
log-level = 0

group = sendsms-user
username = kustc
password = XXXXXX
#default-smsc = ATTSTC
concatenation= true
max-messages = 10

group = sms-service
#keyword =
keyword-regex = .*
catch-all = yes
max-messages = 0
get-url = "http://10.20.10.10/test/sms?phone=%p&text=%a";




Logs:

/var/logs/kannel/bearerbox:

2010-08-09 17:42:23 [17821] [0] INFO: Added logfile `/var/log/kannel/bearerbox.log' with level `0'.
2010-08-09 17:42:23 [17821] [0] INFO: HTTP: Opening server at port 13000.
2010-08-09 17:42:23 [17821] [1] DEBUG: Thread 1 (gwlib/fdset.c:poller) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 1 (gwlib/fdset.c:poller) 2010-08-09 17:42:23 [17821] [2] DEBUG: Thread 2 (gwlib/http.c:server_thread) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 2 (gwlib/http.c:server_thread) 2010-08-09 17:42:23 [17821] [3] DEBUG: Thread 3 (gw/bb_http.c:httpadmin_run) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 3 (gw/bb_http.c:httpadmin_run)
2010-08-09 17:42:23 [17821] [0] DEBUG: starting smsbox connection module
2010-08-09 17:42:23 [17821] [0] INFO: BOXC: 'smsbox-max-pending' not set, using default (100). 2010-08-09 17:42:23 [17821] [4] DEBUG: Thread 4 (gw/bb_boxc.c:sms_to_smsboxes) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 4 (gw/bb_boxc.c:sms_to_smsboxes) 2010-08-09 17:42:23 [17821] [5] DEBUG: Thread 5 (gw/bb_boxc.c:smsboxc_run) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 5 (gw/bb_boxc.c:smsboxc_run) 2010-08-09 17:42:23 [17821] [0] INFO: Set SMS resend frequency to 60 seconds.
2010-08-09 17:42:23 [17821] [0] INFO: SMS resend retry set to unlimited.
2010-08-09 17:42:23 [17821] [0] DEBUG: smsbox MO concatenated message handling enabled 2010-08-09 17:42:23 [17821] [0] INFO: DLR rerouting for smsc id <LBSMS1> disabled.
2010-08-09 17:42:23 [17821] [0] INFO: HTTP: Opening server at port 9001.
2010-08-09 17:42:23 [17821] [6] DEBUG: Thread 6 (gw/smsc/smsc_http.c:httpsmsc_receiver) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 6 (gw/smsc/smsc_http.c:httpsmsc_receiver) 2010-08-09 17:42:23 [17821] [7] DEBUG: Thread 7 (gw/smsc/smsc_http.c:httpsmsc_send_cb) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 7 (gw/smsc/smsc_http.c:httpsmsc_send_cb)
2010-08-09 17:42:23 [17821] [0] INFO: HTTP[LBSMS1]: Initiated and ready
2010-08-09 17:42:23 [17821] [8] DEBUG: Thread 8 (gw/bb_smscconn.c:sms_router) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 8 (gw/bb_smscconn.c:sms_router) 2010-08-09 17:42:23 [17821] [0] DEBUG: starting UDP sender/receiver module
2010-08-09 17:42:23 [17821] [0] INFO: Adding interface *
2010-08-09 17:42:23 [17821] [0] DEBUG: udpc_create: Bound to UDP <0.0.0.0:9200> 2010-08-09 17:42:23 [17821] [9] DEBUG: Thread 9 (gw/bb_udp.c:udp_receiver) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 9 (gw/bb_udp.c:udp_receiver) 2010-08-09 17:42:23 [17821] [10] DEBUG: Thread 10 (gw/bb_udp.c:udp_sender) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 10 (gw/bb_udp.c:udp_sender) 2010-08-09 17:42:23 [17821] [0] DEBUG: udpc_create: Bound to UDP <0.0.0.0:9201> 2010-08-09 17:42:23 [17821] [11] DEBUG: Thread 11 (gw/bb_udp.c:udp_receiver) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 11 (gw/bb_udp.c:udp_receiver) 2010-08-09 17:42:23 [17821] [12] DEBUG: Thread 12 (gw/bb_udp.c:udp_sender) maps to pid 17821. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 12 (gw/bb_udp.c:udp_sender)
2010-08-09 17:42:23 [17821] [0] DEBUG: starting wapbox connection module
2010-08-09 17:42:23 [17821] [0] ERROR: Missing wapbox-port variable, cannot start WAP
2010-08-09 17:42:23 [17821] [0] DEBUG: starting WDP router
2010-08-09 17:42:23 [17821] [13] DEBUG: Thread 13 (gw/bearerbox.c:wdp_router) maps to pid 17821. 2010-08-09 17:42:23 [17821] [13] DEBUG: udp_die: removing producers from udp-lists 2010-08-09 17:42:23 [17821] [13] DEBUG: Thread 13 (gw/bearerbox.c:wdp_router) terminates. 2010-08-09 17:42:23 [17821] [0] DEBUG: Started thread 13 (gw/bearerbox.c:wdp_router) 2010-08-09 17:42:23 [17821] [0] INFO: ---------------------------------------- 2010-08-09 17:42:23 [17821] [0] INFO: Kannel bearerbox II version 1.4.3 starting 2010-08-09 17:42:23 [17821] [0] INFO: MAIN: Start-up done, entering mainloop
2010-08-09 17:42:24 [17821] [5] INFO: Client connected from <127.0.0.1>
2010-08-09 17:42:24 [17821] [5] DEBUG: Started thread 14 (gw/bb_boxc.c:function) 2010-08-09 17:42:24 [17821] [14] DEBUG: Thread 14 (gw/bb_boxc.c:function) maps to pid 17821. 2010-08-09 17:42:24 [17821] [15] DEBUG: Thread 15 (gw/bb_boxc.c:boxc_sender) maps to pid 17821. 2010-08-09 17:42:24 [17821] [14] DEBUG: Started thread 15 (gw/bb_boxc.c:boxc_sender)

2010-08-09 17:42:46 [17821] [14] DEBUG: boxc_receiver: sms received
2010-08-09 17:42:46 [17821] [14] DEBUG: HTTP[LBSMS1]: Start request
2010-08-09 17:42:46 [17821] [14] DEBUG: Started thread 16 (gwlib/fdset.c:poller) 2010-08-09 17:42:46 [17821] [14] DEBUG: Started thread 17 (gwlib/http.c:write_request_thread) 2010-08-09 17:42:46 [17821] [14] DEBUG: send_msg: sending msg to box: <127.0.0.1> 2010-08-09 17:42:46 [17821] [17] DEBUG: Thread 17 (gwlib/http.c:write_request_thread) maps to pid 17821. 2010-08-09 17:42:46 [17821] [17] DEBUG: Queue contains 0 pending requests. 2010-08-09 17:42:46 [17821] [17] DEBUG: Parsing URL `http://2.2.2.2:9001?username=XXXXXX&password=XXXXXX&to=7706051489&text=TestMessage1&from=28874544&coding=0&charset=UTF-8&dlr-url=&dlr-mask=31':
2010-08-09 17:42:46 [17821] [17] DEBUG:   Scheme: http://
2010-08-09 17:42:46 [17821] [17] DEBUG:   Host: 2.2.2.2:9001
2010-08-09 17:42:46 [17821] [17] DEBUG:   Port: 9001
2010-08-09 17:42:46 [17821] [17] DEBUG:   Username: (null)
2010-08-09 17:42:46 [17821] [17] DEBUG:   Password: (null)
2010-08-09 17:42:46 [17821] [17] DEBUG:   Path: /
2010-08-09 17:42:46 [17821] [17] DEBUG: Query: username=XXXXXX&password=XXXXXX&to=7706051489&text=TestMessage1&from=28874544&coding=0&charset=UTF-8&dlr-url=&dlr-mask=31
2010-08-09 17:42:46 [17821] [17] DEBUG:   Fragment: (null)
2010-08-09 17:42:46 [17821] [17] ERROR: Error while gw_gethostbyname occurs.
2010-08-09 17:42:46 [17821] [17] ERROR: System error 3: No such process
2010-08-09 17:42:46 [17821] [17] ERROR: gethostbyname failed
2010-08-09 17:42:46 [17821] [17] ERROR: error connecting to server `2.2.2.2:9001' at port `9001' 2010-08-09 17:42:46 [17821] [17] DEBUG: HTTP: Opening connection to `2.2.2.2:9001:9001' (fd=0). 2010-08-09 17:42:46 [17821] [17] ERROR: Couldn't send request to <http://2.2.2.2:9001?username=XXXXXX&password=XXXXXX&to=7706051489&text=TestMessage1&from=28874544&coding=0&charset=UTF-8&dlr-url=&dlr-mask=31> 2010-08-09 17:42:46 [17821] [16] DEBUG: Thread 16 (gwlib/fdset.c:poller) maps to pid 17821. 2010-08-09 17:42:46 [17821] [7] ERROR: HTTP[LBSMS1]: Couldn't connect to SMS center (retrying in 10 seconds).


SMSBox Log:

2010-08-09 17:42:24 [17840] [0] INFO: Added logfile `/var/log/kannel/smsbox.log' with level `0'.
2010-08-09 17:42:24 [17840] [0] INFO: HTTP: Opening server at port 13013.
2010-08-09 17:42:24 [17840] [0] DEBUG: Started thread 1 (gwlib/fdset.c:poller) 2010-08-09 17:42:24 [17840] [0] DEBUG: Started thread 2 (gwlib/http.c:server_thread) 2010-08-09 17:42:24 [17840] [0] INFO: Set up send sms service at port 13013 2010-08-09 17:42:24 [17840] [0] DEBUG: Started thread 3 (gw/smsbox.c:sendsms_thread) 2010-08-09 17:42:24 [17840] [0] DEBUG: ---------------------------------------------- 2010-08-09 17:42:24 [17840] [0] DEBUG: Kannel smsbox version 1.4.3 starting 2010-08-09 17:42:24 [17840] [1] DEBUG: Thread 1 (gwlib/fdset.c:poller) maps to pid 17840. 2010-08-09 17:42:24 [17840] [2] DEBUG: Thread 2 (gwlib/http.c:server_thread) maps to pid 17840. 2010-08-09 17:42:24 [17840] [3] DEBUG: Thread 3 (gw/smsbox.c:sendsms_thread) maps to pid 17840.
2010-08-09 17:42:24 [17840] [0] DEBUG:   dumping group (sendsms-user):
2010-08-09 17:42:24 [17840] [0] DEBUG:     <group> = <sendsms-user>
2010-08-09 17:42:24 [17840] [0] DEBUG:     <max-messages> = <10>
2010-08-09 17:42:24 [17840] [0] DEBUG:     <username> = <xxxxx>
2010-08-09 17:42:24 [17840] [0] DEBUG:     <concatenation> = <true>
2010-08-09 17:42:24 [17840] [0] DEBUG:     <password> = <xxx>
2010-08-09 17:42:24 [17840] [4] DEBUG: Thread 4 (gw/smsbox.c:obey_request_thread) maps to pid 17840. 2010-08-09 17:42:24 [17840] [0] DEBUG: Started thread 4 (gw/smsbox.c:obey_request_thread) 2010-08-09 17:42:24 [17840] [5] DEBUG: Thread 5 (gw/smsbox.c:url_result_thread) maps to pid 17840. 2010-08-09 17:42:24 [17840] [0] DEBUG: Started thread 5 (gw/smsbox.c:url_result_thread) 2010-08-09 17:42:24 [17840] [6] DEBUG: Thread 6 (gw/smsbox.c:http_queue_thread) maps to pid 17840. 2010-08-09 17:42:24 [17840] [0] DEBUG: Started thread 6 (gw/smsbox.c:http_queue_thread) 2010-08-09 17:42:24 [17840] [0] INFO: Connected to bearerbox at 127.0.0.1 port 13001. 2010-08-09 17:42:24 [17840] [7] DEBUG: Thread 7 (gw/heartbeat.c:heartbeat_thread) maps to pid 17840. 2010-08-09 17:42:24 [17840] [0] DEBUG: Started thread 7 (gw/heartbeat.c:heartbeat_thread) 2010-08-09 17:42:46 [17840] [2] DEBUG: HTTP: Creating HTTPClient for `10.20.10.75'. 2010-08-09 17:42:46 [17840] [2] DEBUG: HTTP: Created HTTPClient area 0x8b0c118. 2010-08-09 17:42:46 [17840] [3] INFO: smsbox: Got HTTP request </cgi-bin/sendsms> from <10.20.10.75>
2010-08-09 17:42:46 [17840] [3] INFO: sendsms used by <xxxxx>
2010-08-09 17:42:46 [17840] [3] INFO: sendsms sender:<xxxxx:28874544> (10.20.10.75) to:<7706051489> msg:<TestMessage1> 2010-08-09 17:42:46 [17840] [3] DEBUG: Stored UUID 107619bd-3596-4c70-8053-5fe6ef92f66d 2010-08-09 17:42:46 [17840] [3] DEBUG: message length 12, sending 1 messages
2010-08-09 17:42:46 [17840] [3] DEBUG: Status: 202 Answer: <Sent.>
2010-08-09 17:42:46 [17840] [3] DEBUG: Delayed reply - wait for bearerbox
2010-08-09 17:42:46 [17840] [0] DEBUG: Got ACK (0) of 107619bd-3596-4c70-8053-5fe6ef92f66d 2010-08-09 17:42:46 [17840] [0] DEBUG: HTTP: Resetting HTTPClient for `10.20.10.75'.
2010-08-09 17:43:46 [17840] [1] DEBUG: Timeout for fd:23 appeares.
2010-08-09 17:43:46 [17840] [1] DEBUG: HTTP: Destroying HTTPClient area 0x8b0c118. 2010-08-09 17:43:46 [17840] [1] DEBUG: HTTP: Destroying HTTPClient for `10.20.10.75'.




Reply via email to