Re: [ntp:questions] nmea patch

2008-12-20 Thread Per Hedeland
In article 6zydnasrfpna1dbunz2dnuvz_qrin...@megapath.net
hal-use...@ip-64-139-1-69.sjc.megapath.net (Hal Murray) writes:
In article ywn94p108yb7@ntp1.isc.org,
 Harlan Stenn st...@ntp.org writes:
I'm glad it is working for you and I'd be even happier if we could figure
out why the NULL string got where it did earlier, as ntpd should never drop
core like that.

It might be just a simple bug.  The code in that area says:

  if ((len = readlink(device,buffer,sizeof(buffer))) == -1)
return(0);
  buffer[len] = 0;

  if ((nmea_host = strtok(buffer,:)) == NULL)
return(0);

  nmea_port = atoi(strtok(NULL,:));

The idea is that if you are using the nmead, then /dev/gps0
will be a synbilic link to someting like server:port so
nmea_host will be the server and nmea_port will be the port number.

And if it isn't, but rather a link to (say) /dev/ttyS0, nmea_host will
get the whole /dev/ttyS0 (the first colon-separated token), the
second strtok() will return NULL since there are no more tokens, and
atoi(NULL) shouldn't be expected to do anything more meaningful than
crash. Better code would be

  char *p;
  ...
  if ((p = strtok(NULL,:)) == NULL)
 return 0;
  nmea_port = atoi(p);

--Per Hedeland
p...@hedeland.org

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
On Dec 17, 11:03 pm, David Woolley
da...@ex.djwhome.demon.co.uk.invalid wrote:
 Hal Murray wrote:
  In article 
  0ea640c4-6e30-457a-8b80-6274ea367...@k36g2000pri.googlegroups.com,
   dhavey dha...@gmail.com writes:
  and it segfaults.  Any clues?

  Does /dev/gps0 exist?  Often, it's a symlink to whatever
  your OS uses for /dev/tty stuff.

 What is that OS and what does the debugger say was the location of the
 crash when you run an unstripped version?  Can you reproduce with an
 unoptimised full debug build?



/dev/gps0 - /dev/pps0
exists.
dmesg says:
ntpd[11347]: segfault at 0 ip 003361a341ca sp 7fff3b8ca680
error 4 in libc-2.5.so[3361a0+14a000]

Where is the ntp log?
What full debug?
Okay chill, I'm going to read the README ;)

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
On Dec 17, 11:03 pm, David Woolley
da...@ex.djwhome.demon.co.uk.invalid wrote:
 Hal Murray wrote:
  In article 
  0ea640c4-6e30-457a-8b80-6274ea367...@k36g2000pri.googlegroups.com,
   dhavey dha...@gmail.com writes:
  and it segfaults.  Any clues?

  Does /dev/gps0 exist?  Often, it's a symlink to whatever
  your OS uses for /dev/tty stuff.

 What is that OS and what does the debugger say was the location of the
 crash when you run an unstripped version?  Can you reproduce with an
 unoptimised full debug build?




I think this is what you meant:

/usr/local/bin/ntpd -d -l /var/log/ntpd.log -c /etc/ntp.gps
ntpd 4.2@1.1541-o Thu Dec 18 21:21:02 UTC 2008 (2)
addto_syslog: logging to file /var/log/ntpd.log
addto_syslog: logging to file /var/log/ntpd.log

addto_syslog: precision = 1.000 usec

addto_syslog: ntp_io: estimated max descriptors: 1024, initial socket
boundary: 16

addto_syslog: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled

addto_syslog: Listening on interface #1 wildcard, ::#123 Disabled

addto_syslog: Listening on interface #2 lo, ::1#123 Enabled

addto_syslog: Listening on interface #3 eth0, fe80::21d:
9ff:fe18:815#123 Enabled

addto_syslog: Listening on interface #4 lo, 127.0.0.1#123 Enabled

addto_syslog: Listening on interface #5 eth0, 192.168.0.29#123 Enabled

local_clock: time 0 offset 0.00 freq 0.000 state 0
addto_syslog: kernel time sync status 0040

addto_syslog: configure: keyword ning unknown, line ignored

peer_crypto_clear: at 0 next 0 assoc ID 5670
key_expire: at 0
peer_clear: at 0 next 1 assoc ID 5670 refid INIT
newpeer: 192.168.0.29-192.168.0.26 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 
peer_crypto_clear: at 0 next 0 assoc ID 5671
key_expire: at 0
peer_clear: at 0 next 2 assoc ID 5671 refid INIT
newpeer: 192.168.0.29-192.168.0.27 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 
peer_crypto_clear: at 0 next 0 assoc ID 5672
key_expire: at 0
peer_clear: at 0 next 3 assoc ID 5672 refid INIT
newpeer: 192.168.0.29-192.168.0.28 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 
peer_crypto_clear: at 0 next 0 assoc ID 5673
key_expire: at 0
peer_clear: at 0 next 4 assoc ID 5673 refid INIT
addto_syslog: refclock_setup fd 6 tcgetattr: Inappropriate ioctl for
device

Segmentation fault

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
On Dec 17, 11:03 pm, David Woolley
da...@ex.djwhome.demon.co.uk.invalid wrote:
 Hal Murray wrote:
  In article 
  0ea640c4-6e30-457a-8b80-6274ea367...@k36g2000pri.googlegroups.com,
   dhavey dha...@gmail.com writes:
  and it segfaults.  Any clues?

  Does /dev/gps0 exist?  Often, it's a symlink to whatever
  your OS uses for /dev/tty stuff.

 What is that OS and what does the debugger say was the location of the
 crash when you run an unstripped version?  Can you reproduce with an
 unoptimised full debug build?




It's centos with kernel version 2.6.27.3

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
On Dec 18, 11:47 am, dhavey dha...@gmail.com wrote:
 On Dec 17, 11:03 pm, David Woolley

 da...@ex.djwhome.demon.co.uk.invalid wrote:
  Hal Murray wrote:
   In article 
   0ea640c4-6e30-457a-8b80-6274ea367...@k36g2000pri.googlegroups.com,
dhavey dha...@gmail.com writes:
   and it segfaults.  Any clues?

   Does /dev/gps0 exist?  Often, it's a symlink to whatever
   your OS uses for /dev/tty stuff.

  What is that OS and what does the debugger say was the location of the
  crash when you run an unstripped version?  Can you reproduce with an
  unoptimised full debug build?

 /dev/gps0 - /dev/pps0
 exists.
 dmesg says:
 ntpd[11347]: segfault at 0 ip 003361a341ca sp 7fff3b8ca680
 error 4 in libc-2.5.so[3361a0+14a000]

 Where is the ntp log?
 What full debug?
 Okay chill, I'm going to read the README ;)

ntp.log
18 Dec 13:11:16 ntpd[11838]: logging to file /var/log/ntpd.log
18 Dec 13:11:16 ntpd[11838]: precision = 1.000 usec
18 Dec 13:11:16 ntpd[11838]: ntp_io: estimated max descriptors: 1024,
initial socket boundary: 16
18 Dec 13:11:16 ntpd[11838]: Listening on interface #0 wildcard,
0.0.0.0#123 Disabled
18 Dec 13:11:16 ntpd[11838]: Listening on interface #1
wildcard, ::#123 Disabled
18 Dec 13:11:16 ntpd[11838]: Listening on interface #2 lo, ::1#123
Enabled
18 Dec 13:11:16 ntpd[11838]: Listening on interface #3 eth0, fe80::21d:
9ff:fe18:815#123 Enabled
18 Dec 13:11:16 ntpd[11838]: Listening on interface #4 lo,
127.0.0.1#123 Enabled
18 Dec 13:11:16 ntpd[11838]: Listening on interface #5 eth0,
192.168.0.29#123 Enabled
18 Dec 13:11:16 ntpd[11838]: kernel time sync status 0040
18 Dec 13:11:16 ntpd[11838]: configure: keyword ning unknown, line
ignored
18 Dec 13:11:16 ntpd[11838]: refclock_setup fd 6 tcgetattr:
Inappropriate ioctl for device

gdb looks like this:
(gdb) run -l /var/log/ntpd.log -c /etc/ntp.gps
Starting program: /usr/local/bin/ntpd -l /var/log/ntpd.log -c /etc/
ntp.gps
[Detaching after fork from child process 11958. (Try `set detach-on-
fork off'.)]

Program exited normally.
(gdb)

I took the -o2 flag out of the Makefile.  I don't know what you mean
by an unstripped version.

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
Okay here it is ;)

What does all of that mean?
I'll try to get it out of daemon mode and then post the output from
gdb ;)

[r...@user4 ntp-4.2.4p5]# /usr/local/bin/ntpd -d -d -d -d -d -d -d -d -
d -d -l /var/log/ntpd.log -c /etc/ntp.gps
ntpd 4.2@1.1541-o Thu Dec 18 21:21:02 UTC 2008 (2)
addto_syslog: logging to file /var/log/ntpd.log
addto_syslog: logging to file /var/log/ntpd.log

adding new filegen
adding new filegen
adding new filegen
adding new filegen
adding new filegen
adding new filegen
addto_syslog: set_process_priority: Leave priority alone:
priority_done is 2

addto_syslog: precision = 1.000 usec

create_sockets(123)
addto_syslog: ntp_io: estimated max descriptors: 1024, initial socket
boundary: 16

setsockopt SO_TIMESTAMP enabled on fd 16 address 0.0.0.0
bind() fd 16, family 2, port 123, addr 0.0.0.0, flags=0x89
flags for fd 16: 0x802
Searching for addr 0.0.0.0 in list of addresses - NOT FOUND
Added addr 0.0.0.0 to list of addresses
addto_syslog: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled

setsockopt SO_TIMESTAMP enabled on fd 17 address ::
bind() fd 17, family 10, port 123, addr ::, flags=0x81
flags for fd 17: 0x802
Searching for addr :: in list of addresses - NOT FOUND
Added addr :: to list of addresses
addto_syslog: Listening on interface #1 wildcard, ::#123 Disabled

update_interfaces(123)
address_okay: listen Virtual: 1, IF name: lo
address_okay: loopback - OK
examining interface #0: fd=-1, bfd=-1, name=lo, flags=0x5, scope=1,
ifindex=0, sin=::1, Enabled:
Dumping interface: 0x7fffe48d6bb0
fd = -1
bfd = -1
sin = ::1,
0a7b     0001 0100

bcast = 0.0.0.0,
      

mask = :::::::,
0a7b      

name = lo
flags = 0x0005
last_ttl = 0
addr_refid = 
num_mcast = 0
received = 0
sent = 0
notsent = 0
ifindex = 0
scopeid = 1
peercnt = 0
phase = 1
Searching for addr ::1 in list of addresses - NOT FOUND
create_interface(::1#123)
set SO_REUSEADDR to ON on ::
set SO_REUSEADDR to OFF on ::
setsockopt SO_TIMESTAMP enabled on fd 18 address ::1
bind() fd 18, family 10, port 123, addr ::1, flags=0x5
flags for fd 18: 0x802
addto_syslog: Listening on interface #2 lo, ::1#123 Enabled

Searching for addr ::1 in list of addresses - NOT FOUND
Added addr ::1 to list of addresses
created interface #2: fd=18, bfd=-1, name=lo, flags=0x5, scope=1,
ifindex=0, sin=::1, Enabled:
Dumping interface: 0x65ac70
fd = 18
bfd = -1
sin = ::1,
0a7b     0001 0100

bcast = 0.0.0.0,
      

mask = :::::::,
0a7b      

name = lo
flags = 0x0005
last_ttl = 0
addr_refid = c84d40cf
num_mcast = 0
received = 0
sent = 0
notsent = 0
ifindex = 0
scopeid = 1
peercnt = 0
phase = 1
updating interface #2: fd=18, bfd=-1, name=lo, flags=0x5, scope=1,
ifindex=0, sin=::1, Enabled: new - created
Dumping interface: 0x65ac70
fd = 18
bfd = -1
sin = ::1,
0a7b     0001 0100

bcast = 0.0.0.0,
      

mask = :::::::,
0a7b      

name = lo
flags = 0x0005
last_ttl = 0
addr_refid = c84d40cf
num_mcast = 0
received = 0
sent = 0
notsent = 0
ifindex = 0
scopeid = 1
peercnt = 0
phase = 1
address_okay: listen Virtual: 1, IF name: eth0
address_okay: OK
examining interface #0: fd=-1, bfd=-1, name=eth0, flags=0x11, scope=2,
ifindex=0, sin=fe80::21d:9ff:fe18:815, Enabled:
Dumping interface: 0x7fffe48d6bb0
fd = -1
bfd = -1
sin = fe80::21d:9ff:fe18:815,
0a7b  fe80  021d09ff fe180815 0200

bcast = 0.0.0.0,
      

mask = :::::,
0a7b      

name = eth0
flags = 0x0011
last_ttl = 0
addr_refid = 
num_mcast = 0
received = 0
sent = 0
notsent = 0
ifindex = 0
scopeid = 2
peercnt = 0
phase = 1
Searching for addr fe80::21d:9ff:fe18:815 in list of addresses - NOT
FOUND
create_interface(fe80::21d:9ff:fe18:815#123)
set SO_REUSEADDR to ON on ::
set SO_REUSEADDR to OFF on ::
setsockopt SO_TIMESTAMP enabled on fd 19 address fe80::21d:
9ff:fe18:815
bind() fd 19, family 10, port 123, addr fe80::21d:9ff:fe18:815,
flags=0x11
flags for fd 19: 0x802
addto_syslog: Listening on interface #3 eth0, fe80::21d:
9ff:fe18:815#123 Enabled

Searching for addr fe80::21d:9ff:fe18:815 in list of addresses - NOT
FOUND
Added addr fe80::21d:9ff:fe18:815 to list of addresses
created interface #3: fd=19, bfd=-1, name=eth0, flags=0x11, scope=2,
ifindex=0, sin=fe80::21d:9ff:fe18:815, 

Re: [ntp:questions] nmea patch

2008-12-18 Thread David Woolley
dhavey wrote:

 What full debug?

Depends on your development toolset, but for gcc, it means including the 
-g flag and not doing anything that would strip the binary.

For gcc, unoptimised means something like -O0

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
On Dec 18, 1:49 pm, David Woolley
da...@ex.djwhome.demon.co.uk.invalid wrote:
 dhavey wrote:
  What full debug?

 Depends on your development toolset, but for gcc, it means including the
 -g flag and not doing anything that would strip the binary.

 For gcc, unoptimised means something like -O0

Like that?

(gdb) run  -l /var/log/ntpd.log -d -c /etc/ntp.gps
Starting program: /usr/local/bin/ntpd -l /var/log/ntpd.log -d -c /etc/
ntp.gps
ntpd 4.2@1.1541-o Thu Dec 18 21:21:02 UTC 2008 (2)
addto_syslog: logging to file /var/log/ntpd.log
addto_syslog: logging to file /var/log/ntpd.log

addto_syslog: precision = 1.000 usec

addto_syslog: ntp_io: estimated max descriptors: 1024, initial socket
boundary: 16

addto_syslog: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled

addto_syslog: Listening on interface #1 wildcard, ::#123 Disabled

addto_syslog: Listening on interface #2 lo, ::1#123 Enabled

addto_syslog: Listening on interface #3 eth0, fe80::21d:
9ff:fe18:815#123 Enabled

addto_syslog: Listening on interface #4 lo, 127.0.0.1#123 Enabled

addto_syslog: Listening on interface #5 eth0, 192.168.0.29#123 Enabled

local_clock: time 0 offset 0.00 freq 0.000 state 0
addto_syslog: kernel time sync status 0040

addto_syslog: configure: keyword ning unknown, line ignored

peer_crypto_clear: at 0 next 0 assoc ID 59506
key_expire: at 0
peer_clear: at 0 next 1 assoc ID 59506 refid INIT
newpeer: 192.168.0.29-192.168.0.26 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 
peer_crypto_clear: at 0 next 0 assoc ID 59507
key_expire: at 0
peer_clear: at 0 next 2 assoc ID 59507 refid INIT
newpeer: 192.168.0.29-192.168.0.27 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 
peer_crypto_clear: at 0 next 0 assoc ID 59508
key_expire: at 0
peer_clear: at 0 next 3 assoc ID 59508 refid INIT
newpeer: 192.168.0.29-192.168.0.28 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 

Breakpoint 1, 0x003361a341ca in strtoll_l_internal () from /
lib64/libc.so.6
(gdb) backtrace
#0  0x003361a341ca in strtoll_l_internal () from /lib64/
libc.so.6
#1  0x00407c79 in getconfig (argc=value optimized out,
argv=0x4) at /usr/include/stdlib.h:336
#2  0x0040c90b in ntpdmain (argc=0, argv=value optimized
out) at ntpd.c:846
#3  0x003361a1d8b4 in __libc_start_main () from /lib64/libc.so.6
#4  0x00404a79 in _start ()
(gdb)

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
On Dec 18, 1:49 pm, David Woolley
da...@ex.djwhome.demon.co.uk.invalid wrote:
 dhavey wrote:
  What full debug?

 Depends on your development toolset, but for gcc, it means including the
 -g flag and not doing anything that would strip the binary.

 For gcc, unoptimised means something like -O0

Like that?

(gdb) run  -l /var/log/ntpd.log -d -c /etc/ntp.gps
Starting program: /usr/local/bin/ntpd -l /var/log/ntpd.log -d -c /etc/
ntp.gps
ntpd 4.2@1.1541-o Thu Dec 18 21:21:02 UTC 2008 (2)
addto_syslog: logging to file /var/log/ntpd.log
addto_syslog: logging to file /var/log/ntpd.log

addto_syslog: precision = 1.000 usec

addto_syslog: ntp_io: estimated max descriptors: 1024, initial socket
boundary: 16

addto_syslog: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled

addto_syslog: Listening on interface #1 wildcard, ::#123 Disabled

addto_syslog: Listening on interface #2 lo, ::1#123 Enabled

addto_syslog: Listening on interface #3 eth0, fe80::21d:
9ff:fe18:815#123 Enabled

addto_syslog: Listening on interface #4 lo, 127.0.0.1#123 Enabled

addto_syslog: Listening on interface #5 eth0, 192.168.0.29#123 Enabled

local_clock: time 0 offset 0.00 freq 0.000 state 0
addto_syslog: kernel time sync status 0040

addto_syslog: configure: keyword ning unknown, line ignored

peer_crypto_clear: at 0 next 0 assoc ID 59506
key_expire: at 0
peer_clear: at 0 next 1 assoc ID 59506 refid INIT
newpeer: 192.168.0.29-192.168.0.26 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 
peer_crypto_clear: at 0 next 0 assoc ID 59507
key_expire: at 0
peer_clear: at 0 next 2 assoc ID 59507 refid INIT
newpeer: 192.168.0.29-192.168.0.27 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 
peer_crypto_clear: at 0 next 0 assoc ID 59508
key_expire: at 0
peer_clear: at 0 next 3 assoc ID 59508 refid INIT
newpeer: 192.168.0.29-192.168.0.28 mode 1 vers 4 poll 6 10 flags 0x1
0x1 ttl 0 key 

Breakpoint 1, 0x003361a341ca in strtoll_l_internal () from /
lib64/libc.so.6
(gdb) backtrace
#0  0x003361a341ca in strtoll_l_internal () from /lib64/
libc.so.6
#1  0x00407c79 in getconfig (argc=value optimized out,
argv=0x4) at /usr/include/stdlib.h:336
#2  0x0040c90b in ntpdmain (argc=0, argv=value optimized
out) at ntpd.c:846
#3  0x003361a1d8b4 in __libc_start_main () from /lib64/libc.so.6
#4  0x00404a79 in _start ()
(gdb)

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread David Woolley
dhavey wrote:

 gdb looks like this:
 (gdb) run -l /var/log/ntpd.log -c /etc/ntp.gps
 Starting program: /usr/local/bin/ntpd -l /var/log/ntpd.log -c /etc/
 ntp.gps
 [Detaching after fork from child process 11958. (Try `set detach-on-
 fork off'.)]
 
 Program exited normally.
 (gdb)

You've run gdb on the daemon starter process.

What I intended was that you ran

gdb ntpd core.

on the crash dump (you may need to use ulimit -c unlimited, to ensure 
you get a dump).

 
 I took the -o2 flag out of the Makefile.  I don't know what you mean
 by an unstripped version.

Do not run strip when installing it.  Do not run install with the -s 
option when installing it, or run the debugger against a version before 
these were run.

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
Okay here it is ;)

What does all of that mean?
I'll try to get it out of daemon mode and then post the output from
gdb ;)

[r...@user4 ntp-4.2.4p5]# /usr/local/bin/ntpd -d -d -d -d -d -d -d -d -
d -d -l /var/log/ntpd.log -c /etc/ntp.gps
ntpd 4.2@1.1541-o Thu Dec 18 21:21:02 UTC 2008 (2)
addto_syslog: logging to file /var/log/ntpd.log
addto_syslog: logging to file /var/log/ntpd.log

adding new filegen
adding new filegen
adding new filegen
adding new filegen
adding new filegen
adding new filegen
addto_syslog: set_process_priority: Leave priority alone:
priority_done is 2

addto_syslog: precision = 1.000 usec

create_sockets(123)
addto_syslog: ntp_io: estimated max descriptors: 1024, initial socket
boundary: 16

setsockopt SO_TIMESTAMP enabled on fd 16 address 0.0.0.0
bind() fd 16, family 2, port 123, addr 0.0.0.0, flags=0x89
flags for fd 16: 0x802
Searching for addr 0.0.0.0 in list of addresses - NOT FOUND
Added addr 0.0.0.0 to list of addresses
addto_syslog: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled

setsockopt SO_TIMESTAMP enabled on fd 17 address ::
bind() fd 17, family 10, port 123, addr ::, flags=0x81
flags for fd 17: 0x802
Searching for addr :: in list of addresses - NOT FOUND
Added addr :: to list of addresses
addto_syslog: Listening on interface #1 wildcard, ::#123 Disabled

update_interfaces(123)
address_okay: listen Virtual: 1, IF name: lo
address_okay: loopback - OK
examining interface #0: fd=-1, bfd=-1, name=lo, flags=0x5, scope=1,
ifindex=0, sin=::1, Enabled:
Dumping interface: 0x7fffe48d6bb0
fd = -1
bfd = -1
sin = ::1,
0a7b     0001 0100

bcast = 0.0.0.0,
      

mask = :::::::,
0a7b      

name = lo
flags = 0x0005
last_ttl = 0
addr_refid = 
num_mcast = 0
received = 0
sent = 0
notsent = 0
ifindex = 0
scopeid = 1
peercnt = 0
phase = 1
Searching for addr ::1 in list of addresses - NOT FOUND
create_interface(::1#123)
set SO_REUSEADDR to ON on ::
set SO_REUSEADDR to OFF on ::
setsockopt SO_TIMESTAMP enabled on fd 18 address ::1
bind() fd 18, family 10, port 123, addr ::1, flags=0x5
flags for fd 18: 0x802
addto_syslog: Listening on interface #2 lo, ::1#123 Enabled

Searching for addr ::1 in list of addresses - NOT FOUND
Added addr ::1 to list of addresses
created interface #2: fd=18, bfd=-1, name=lo, flags=0x5, scope=1,
ifindex=0, sin=::1, Enabled:
Dumping interface: 0x65ac70
fd = 18
bfd = -1
sin = ::1,
0a7b     0001 0100

bcast = 0.0.0.0,
      

mask = :::::::,
0a7b      

name = lo
flags = 0x0005
last_ttl = 0
addr_refid = c84d40cf
num_mcast = 0
received = 0
sent = 0
notsent = 0
ifindex = 0
scopeid = 1
peercnt = 0
phase = 1
updating interface #2: fd=18, bfd=-1, name=lo, flags=0x5, scope=1,
ifindex=0, sin=::1, Enabled: new - created
Dumping interface: 0x65ac70
fd = 18
bfd = -1
sin = ::1,
0a7b     0001 0100

bcast = 0.0.0.0,
      

mask = :::::::,
0a7b      

name = lo
flags = 0x0005
last_ttl = 0
addr_refid = c84d40cf
num_mcast = 0
received = 0
sent = 0
notsent = 0
ifindex = 0
scopeid = 1
peercnt = 0
phase = 1
address_okay: listen Virtual: 1, IF name: eth0
address_okay: OK
examining interface #0: fd=-1, bfd=-1, name=eth0, flags=0x11, scope=2,
ifindex=0, sin=fe80::21d:9ff:fe18:815, Enabled:
Dumping interface: 0x7fffe48d6bb0
fd = -1
bfd = -1
sin = fe80::21d:9ff:fe18:815,
0a7b  fe80  021d09ff fe180815 0200

bcast = 0.0.0.0,
      

mask = :::::,
0a7b      

name = eth0
flags = 0x0011
last_ttl = 0
addr_refid = 
num_mcast = 0
received = 0
sent = 0
notsent = 0
ifindex = 0
scopeid = 2
peercnt = 0
phase = 1
Searching for addr fe80::21d:9ff:fe18:815 in list of addresses - NOT
FOUND
create_interface(fe80::21d:9ff:fe18:815#123)
set SO_REUSEADDR to ON on ::
set SO_REUSEADDR to OFF on ::
setsockopt SO_TIMESTAMP enabled on fd 19 address fe80::21d:
9ff:fe18:815
bind() fd 19, family 10, port 123, addr fe80::21d:9ff:fe18:815,
flags=0x11
flags for fd 19: 0x802
addto_syslog: Listening on interface #3 eth0, fe80::21d:
9ff:fe18:815#123 Enabled

Searching for addr fe80::21d:9ff:fe18:815 in list of addresses - NOT
FOUND
Added addr fe80::21d:9ff:fe18:815 to list of addresses
created interface #3: fd=19, bfd=-1, name=eth0, flags=0x11, scope=2,
ifindex=0, sin=fe80::21d:9ff:fe18:815, 

Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
I ran the code in gdb and this is the stack trace.  At refclock_nmea.c:
178 this code causes the crash
nmea_port = atoi(strtok(NULL,:));

I am not really sure of why strtok is used on a NULL string.  I assume
strtok return a NULL based on the trace, and then atoi calls strtool
which leads to a crash.  Possibly, this is a libc64 bug, as I would
expect atoi to detect a null string and not to crash.

#0  0x003361a341ca in strtoll_l_internal () from /lib64/
libc.so.6
#1  0x003361a31ab2 in atoi () from /lib64/libc.so.6
#2  0x00443515 in nmea_start (unit=0, peer=0x69cb58) at
refclock_nmea.c:178
#3  0x0042bb9c in refclock_newpeer (peer=0x69cb58) at
ntp_refclock.c:276
#4  0x00422fab in newpeer (srcadr=0x7fff552f88a0,
dstadr=0x6ef0b0, hmode=3, version=4, minpoll=4, maxpoll=10, flags=129,
cast_flags=1 '\001', ttl=0, key=0) at ntp_peer.c:837
#5  0x004222ea in peer_config (srcadr=0x7fff552f88a0,
dstadr=0x6ef0b0, hmode=3, version=4, minpoll=4, maxpoll=10, flags=128,
ttl=0, key=0,
keystr=0x4776c1 *) at ntp_peer.c:525
#6  0x0040619a in getconfig (argc=0, argv=0x7fff552f8bd8) at
ntp_config.c:864
#7  0x0040f5a6 in ntpdmain (argc=0, argv=0x7fff552f8bd8) at
ntpd.c:846
#8  0x0040f0ec in main (argc=4, argv=0x7fff552f8bb8) at ntpd.c:
317
(gdb) up
#1  0x003361a31ab2 in atoi () from /lib64/libc.so.6
(gdb) up
#2  0x00443515 in nmea_start (unit=0, peer=0x69cb58) at
refclock_nmea.c:178
178   nmea_port = atoi(strtok(NULL,:));

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread Hal Murray
In article 0273857b-9ab1-4aaf-9529-c9b7eb932...@w39g2000prb.googlegroups.com,
 dhavey dha...@gmail.com writes:
I ran the code in gdb and this is the stack trace.  At refclock_nmea.c:
178 this code causes the crash
nmea_port = atoi(strtok(NULL,:));

I am not really sure of why strtok is used on a NULL string.  I assume
strtok return a NULL based on the trace, and then atoi calls strtool
which leads to a crash.  Possibly, this is a libc64 bug, as I would
expect atoi to detect a null string and not to crash.

You are off in the pile of code that's trying to get NMEA info
over the net from a deamon.  That happend when it can't open
/dev/gps0.


-- 
These are my opinions, not necessarily my employer's.  I hate spam.

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread dhavey
On Dec 18, 3:27 pm, hal-use...@ip-64-139-1-69.sjc.megapath.net (Hal
Murray) wrote:
 /dev/gps0 - /dev/pps0
 exists.

 That looks fishy.

 I'd expect something like:
   /dev/gps0 - /dev/ttyS0
 and
   /dev/pps0 - /dev/ttyS0

 --
 These are my opinions, not necessarily my employer's.  I hate spam.


That was it!  Your a freakin genuis!  Tell your boss I said that you
deserve a raise!
ntpq -p
 remote   refid  st t when poll reach   delay
offset  jitter
==
 192.168.0.26.INIT.  16 u   13   6400.000
0.000   0.000
 192.168.0.27.INIT.  16 u-   6400.000
0.000   0.000
 192.168.0.28192.168.0.2  3 u   11   6411.185
-1490.8   0.001
 GPS_NMEA(0) .GPS.0 l-   1600.000
0.000   0.001

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread Hal Murray

18 Dec 13:11:16 ntpd[11838]: configure: keyword ning unknown, line
ignored

That looks fishy, but I don't know if it has anything
to do with the segfault.

-- 
These are my opinions, not necessarily my employer's.  I hate spam.

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread Harlan Stenn
I'm glad it is working for you and I'd be even happier if we could figure
out why the NULL string got where it did earlier, as ntpd should never drop
core like that.
-- 
Harlan Stenn st...@ntp.org
http://ntpforum.isc.org  - be a member!

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-18 Thread Hal Murray
In article ywn94p108yb7@ntp1.isc.org,
 Harlan Stenn st...@ntp.org writes:
I'm glad it is working for you and I'd be even happier if we could figure
out why the NULL string got where it did earlier, as ntpd should never drop
core like that.

It might be just a simple bug.  The code in that area says:

  if ((len = readlink(device,buffer,sizeof(buffer))) == -1)
return(0);
  buffer[len] = 0;

  if ((nmea_host = strtok(buffer,:)) == NULL)
return(0);

  nmea_port = atoi(strtok(NULL,:));

The idea is that if you are using the nmead, then /dev/gps0
will be a synbilic link to someting like server:port so
nmea_host will be the server and nmea_port will be the port number.

My (very old) man page for strtok says:
   The  strtok()  function  can  be  used to parse the string s into
   tokens. The first call to strtok() should have  s  as  its  first
   argument.  Subsequent calls should have the first argument set to
   NULL. Each call returns a pointer to the next token, or NULL when
   no more tokens are found.
A less old (but still far from new) system says:
   The  strtok() function parses a string into a sequence of tokens.
   On the first call to strtok() the string to be parsed  should  be
   specified  in str.  In each subsequent call that should parse the
   same string, str should be NULL.
Both say
   Avoid using these functions.  If you do use them, note that:
 (blah blah...)

So my guess is that either the rules have changed or there is a bug
in the library code.  (More likely, I don't understand something.)

-- 
These are my opinions, not necessarily my employer's.  I hate spam.

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


[ntp:questions] nmea patch

2008-12-17 Thread dhavey
I just installed ntp-4.2.4p5 with the nmea patch and this configure:
./configure --disable-all-clocks --disable-parse-clocks \
  --enable-NMEA --enable-LOCAL-CLOCK

and it segfaults.  Any clues?

the relevant portion of my ntp.conf looks like this:
server 127.127.20.0 prefer minpoll 4
fudge 127.127.20.0 refid GPS flag3 1 flag2 0 time1 0.0

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions


Re: [ntp:questions] nmea patch

2008-12-17 Thread Hal Murray
In article 0ea640c4-6e30-457a-8b80-6274ea367...@k36g2000pri.googlegroups.com,
 dhavey dha...@gmail.com writes:
I just installed ntp-4.2.4p5 with the nmea patch and this configure:
./configure --disable-all-clocks --disable-parse-clocks \
  --enable-NMEA --enable-LOCAL-CLOCK

and it segfaults.  Any clues?

the relevant portion of my ntp.conf looks like this:
server 127.127.20.0 prefer minpoll 4
fudge 127.127.20.0 refid GPS flag3 1 flag2 0 time1 0.0

Is there anything is syslog?  or the ntp log file?

Does /dev/gps0 exist?  Often, it's a symlink to whatever
your OS uses for /dev/tty stuff.

-- 
These are my opinions, not necessarily my employer's.  I hate spam.

___
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions