[SunHELP] Retrieving routing table entries

Amudhavalli Narayanan sunhelp at sunhelp.org
Thu Nov 22 21:54:54 CST 2001


hi,
Thanks for the help. I think I will have to parse the netstat output only.

Regards,
Amudha

-----Original Message-----
From: sunhelp-admin at sunhelp.org [mailto:sunhelp-admin at sunhelp.org]On
Behalf Of DAUBIGNE Sebastien - BOR
Sent: Thursday, November 22, 2001 4:18 PM
To: sunhelp at sunhelp.org
Subject: RE: [SunHELP] Retrieving routing table entries


Sorry, I didn't understand you were looking for an API.

Well, I doubt you can get the route table from any socket syscall, as the
routing
table are kernel global datas.

I launched "netstat -r" with "truss" to know how netstat got theses values.
It seems "netstat" uses some ioctl calls to "/dev/kstat" (the kernel stats
facility)
to get this :

10752/1:        open("/dev/kstat", O_RDONLY)                    = 3
10752/1:        ioctl(3, KSTAT_IOC_CHAIN_ID, 0x00000000)        = 3802
10752/1:        ioctl(3, KSTAT_IOC_READ, "kstat_headers")       = 3802

Reading kstat(3K) man page will give you more informations, but it seems
this is a painfull job.
The libkstat library offers some facilities to handle the job (see the
manpages
for kstat_open(3K), kstat_lookup(3K), etc.).

I guess it should be easier to call popen("netstat -r", ...), and then parse
the output.

Good luck indeed...
---
Sebastien DAUBIGNE
sebastien.daubigne at sema.fr <mailto:sebastien.daubigne at sema.fr>  - (+33)
(0)5.57.26.56.36
Sema Global Services - AFM/DW/Pessac

	-----Message d'origine-----
	De:	Amudhavalli  Narayanan [SMTP:amudha at future.futsoft.com]
	Date:	jeudi 22 novembre 2001 04:50
	:	sunhelp at sunhelp.org
	Objet:	RE: [SunHELP] Retrieving routing table entries

	But I want it from my user program using sockets .... Can this be
done?

	Thanks,
	Amudha

	-----Original Message-----
	From: sunhelp-admin at sunhelp.org [mailto:sunhelp-admin at sunhelp.org]On
	Behalf Of DAUBIGNE Sebastien - BOR
	Sent: Wednesday, November 21, 2001 11:03 PM
	To: sunhelp at sunhelp.org
	Subject: RE: [SunHELP] Retrieving routing table entries


	"netstat -r" is the usual way to get this, whatever Unix you have.
	Note that it works under MSWindows too.

	---
	Sebastien DAUBIGNE
	sebastien.daubigne at sema.fr <mailto:sebastien.daubigne at sema.fr>  -
(+33)
	(0)5.57.26.56.36
	Sema Global Services - AFM/DW/Pessac

		-----Message d'origine-----
		De:	Amudhavalli  Narayanan
[SMTP:amudha at future.futsoft.com]
		Date:	mercredi 21 novembre 2001 16:37
		:	sunhelp at sunhelp.org
		Objet:	[SunHELP] Retrieving routing table entries

		Hi,
		I want my application to retrieve all routes from the
routing table.
	Are
		there any standard system calls (something like sysctl in
unix as )
	that I
		can use in Solaris 8?(as sysctl is not supported in Solaris
upto my
		knowledge)

		Regards,
		Amudha

		_______________________________________________
		SunHELP maillist  -  SunHELP at sunhelp.org
		http://www.sunhelp.org/mailman/listinfo/sunhelp
	_______________________________________________
	SunHELP maillist  -  SunHELP at sunhelp.org
	http://www.sunhelp.org/mailman/listinfo/sunhelp

	_______________________________________________
	SunHELP maillist  -  SunHELP at sunhelp.org
	http://www.sunhelp.org/mailman/listinfo/sunhelp
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp




More information about the SunHELP mailing list