home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.protocols.tcp-ip
- Path: sparky!uunet!think.com!spdcc!dirtydog.ima.isc.com!newsserver.pixel.kodak.com!laidbak!stevea
- From: stevea@i88.isc.com (Steve Alexander)
- Subject: Re: ioctl request SIOCGARP fail in SCO (ARP protocol)
- Message-ID: <1992Aug31.135159.20436@i88.isc.com>
- Sender: usenet@i88.isc.com (Usenet News)
- Nntp-Posting-Host: ozzy.i88.isc.com
- Organization: INTERACTIVE Systems Corporation, Naperville, IL
- References: <1992Aug28.174957.2213@litwin.com>
- Date: Mon, 31 Aug 1992 13:51:59 GMT
- Lines: 45
-
- In article <1992Aug28.174957.2213@litwin.com> hoang1@litwin.com (Dave Jackson) writes:
- >Hi,
- >I'm writing a program to read the ARP cache.
- >But I have the problem when using SIOCGARP in SCO/ODT ver 2.0:
-
- In SCO UNIX, you cannot issue arp ioctls on a socket, due to underlying
- architectural issues in the STREAMS implementation. The way to do this
- is to open the ARP driver, and issue the ioctl as part of an I_STR
- (see streamio(M)).
-
- Here's a code fragment that might help.
-
- #include <sys/stropts.h>
- #include <sys/stream.h>
- #ifndef _PATH_ARP
- #define _PATH_ARP "/dev/inet/arp"
- #endif
-
- .
- .
- .
-
- struct strioctl strioc;
- int s;
- int r;
- struct arpreq ar;
- if ((s = open(_PATH_ARP, O_RDWR)) < 0) {
- perror(_PATH_ARP);
- exit(1);
- }
- strioc.ic_cmd = SIOCSARP;
- strioc.ic_timout = 15; /* seconds */
- strioc.ic_len = sizeof(ar);
- strioc.ic_dp = (caddr_t) &ar;
- r = ioctl(s, I_STR, (caddr_t) &strioc);
- if (r < 0) {
- perror("SIOCSARP");
- exit(1);
- }
- close(s);
-
-
- --
- Steve Alexander, Software Technologies Group | stevea@i88.isc.com
- INTERACTIVE Systems Corporation, Naperville, IL | ...!{sun,ico}!laidbak!stevea
-