9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] ping suicide: sys: trap: divide error  pc=0x00003953c
@ 2009-03-09  9:38 ROuNIN
  2009-03-09 11:11 ` Kenji Arisawa
  0 siblings, 1 reply; 3+ messages in thread
From: ROuNIN @ 2009-03-09  9:38 UTC (permalink / raw)
  To: 9fans

Hello all,
I would like to learn how to fix this in the ping C code, I am new to
plan9 and C

ip/ping -r -f www.google.com
sending 32 64 bytes messages 0 ms apart  to icmp!www.google.com!1
ping 238: suicide: sys: trap: divide error  pc=0x00003953
term% 0: rrt 38841 us, avg rtt 38841 us, ttl = 128

ROuNIN



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] ping suicide: sys: trap: divide error  pc=0x00003953c
  2009-03-09  9:38 [9fans] ping suicide: sys: trap: divide error pc=0x00003953c ROuNIN
@ 2009-03-09 11:11 ` Kenji Arisawa
  2009-03-09 13:24   ` erik quanstrom
  0 siblings, 1 reply; 3+ messages in thread
From: Kenji Arisawa @ 2009-03-09 11:11 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

ip/ping -r -f www.google.com
io% ip/ping -r -f www.google.com
sending 32 64 byte messages 0 ms apart to icmp!www.google.com!1
ping 34691: suicide: sys: trap: divide error pc=0x00003953
0: rtt 9797 µs, avg rtt 9797 µs, ttl = 245
io% ps
...
arisawa       34679    0:00   0:00      128K Pread    tcp17010
arisawa       34691    0:00   0:00      140K Broken   ping
arisawa       34695    0:00   0:00      140K Pread    ping
arisawa       34696    0:00   0:00      192K Pread    ps
io% acid 34691
/proc/34691/text:386 plan 9 executable

/sys/lib/acid/port
/sys/lib/acid/386
acid: lstk()
nrand(n=0x0)+0x18 /sys/src/libc/port/nrand.c:13
	slop=0xa39fb2cf
sender(msglen=0x40,n=0x20,interval=0x0,fd=0x6)+0x151 /sys/src/cmd/ip/ 
ping.c:268
	seq=0xef0c4ef8
	buf=0x0
	icmp=0xdffeed0e
	me=0x0
	mev4=0x501a8c0
	i=0x1
	r=0x22b78
main(argv=0xdfffefa0,argc=0x1)+0x212 /sys/src/cmd/ip/ping.c:571
	interval=0x0
	msglen=0x40
	nmsg=0x20
	_argc=0x66
	_args=0xdfffefb8
	ds=0x11534
	fd=0x6
_main+0x31 /sys/src/libc/386/main9.s:16
acid: \x04
echo kill > /proc/34691/ctl
io% cat /sys/src/libc/port/nrand.c
#include	<u.h>
#include	<libc.h>

#define	MASK	0x7fffffffL

int
nrand(int n)
{
	long slop, v;

	if(n < 0)
		return n;
	slop = MASK % n;
	do
		v = lrand();
	while(v <= slop);
	return v % n;
}


Think that where and why nrand(0) is executed and fix the problem.

Kenji Arisawa


On 2009/03/09, at 18:38, ROuNIN wrote:

> Hello all,
> I would like to learn how to fix this in the ping C code, I am new to
> plan9 and C
>
> ip/ping -r -f www.google.com
> sending 32 64 bytes messages 0 ms apart  to icmp!www.google.com!1
> ping 238: suicide: sys: trap: divide error  pc=0x00003953
> term% 0: rrt 38841 us, avg rtt 38841 us, ttl = 128
>
> ROuNIN
>




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] ping suicide: sys: trap: divide error  pc=0x00003953c
  2009-03-09 11:11 ` Kenji Arisawa
@ 2009-03-09 13:24   ` erik quanstrom
  0 siblings, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2009-03-09 13:24 UTC (permalink / raw)
  To: 9fans

since it doesn't make sense to both send packets
as fast as possible and to delay randomly between
packets,  i think this case is just disallowed.

/n/sources/plan9//sys/src/cmd/ip/ping.c:532,537 - ping.c:532,541
  		break;
  	} ARGEND;

+ 	if(flood && rint){
+ 		fprint(2, "-f and -r are not compatable\n");
+ 		usage();
+ 	}
  	if(msglen < proto->iphdrsz + ICMP_HDRSIZE)
  		msglen = proto->iphdrsz + ICMP_HDRSIZE;
  	if(msglen < 64)

and

/n/sources/plan9//sys/man/8/ping:83,89 - ping:83,91
  adds the IP source and destination addresses to each report.
  .TP
  .B f
- send messages as fast as possible (flood).
+ send messages as fast as possible (flood). This flag
+ is not compatable with
+ .BR -r .
  .TP
  .B i
  sets the time between messages
/n/sources/plan9//sys/man/8/ping:104,110 - ping:106,114
  .TP
  .B r
  randomizes the delay with a minimum extra delay of 0 ms and a
- maximum extra delay of the selected interval.
+ maximum extra delay of the selected interval. This flag
+ is not compatable with
+ .BR -f .
  .TP
  .B s
  sets the length of the message to be



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-09 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-09  9:38 [9fans] ping suicide: sys: trap: divide error pc=0x00003953c ROuNIN
2009-03-09 11:11 ` Kenji Arisawa
2009-03-09 13:24   ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).