home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / protocol / tcpip / 4242 < prev    next >
Encoding:
Text File  |  1992-08-31  |  1.7 KB  |  58 lines

  1. Newsgroups: comp.protocols.tcp-ip
  2. Path: sparky!uunet!think.com!spdcc!dirtydog.ima.isc.com!newsserver.pixel.kodak.com!laidbak!stevea
  3. From: stevea@i88.isc.com (Steve Alexander)
  4. Subject: Re: ioctl request SIOCGARP fail in SCO (ARP protocol)
  5. Message-ID: <1992Aug31.135159.20436@i88.isc.com>
  6. Sender: usenet@i88.isc.com (Usenet News)
  7. Nntp-Posting-Host: ozzy.i88.isc.com
  8. Organization: INTERACTIVE Systems Corporation, Naperville, IL
  9. References: <1992Aug28.174957.2213@litwin.com>
  10. Date: Mon, 31 Aug 1992 13:51:59 GMT
  11. Lines: 45
  12.  
  13. In article <1992Aug28.174957.2213@litwin.com> hoang1@litwin.com (Dave Jackson) writes:
  14. >Hi,
  15. >I'm writing a program to read the ARP cache.
  16. >But I have the problem when using SIOCGARP in SCO/ODT ver 2.0:
  17.  
  18. In SCO UNIX, you cannot issue arp ioctls on a socket, due to underlying
  19. architectural issues in the STREAMS implementation.  The way to do this
  20. is to open the ARP driver, and issue the ioctl as part of an I_STR 
  21. (see streamio(M)).
  22.  
  23. Here's a code fragment that might help.
  24.  
  25. #include <sys/stropts.h>
  26. #include <sys/stream.h>
  27. #ifndef _PATH_ARP
  28. #define _PATH_ARP "/dev/inet/arp"
  29. #endif
  30.  
  31.     .
  32.     .
  33.     .
  34.  
  35.         struct strioctl strioc;
  36.         int s;
  37.         int r;
  38.     struct arpreq ar;
  39.         if ((s = open(_PATH_ARP, O_RDWR)) < 0) {
  40.                 perror(_PATH_ARP);
  41.                 exit(1);
  42.         }
  43.         strioc.ic_cmd = SIOCSARP;
  44.         strioc.ic_timout = 15;        /* seconds */
  45.         strioc.ic_len = sizeof(ar);
  46.         strioc.ic_dp =  (caddr_t) &ar;
  47.         r = ioctl(s, I_STR, (caddr_t) &strioc);
  48.     if (r < 0) {
  49.         perror("SIOCSARP");
  50.         exit(1);
  51.     }
  52.         close(s);
  53.  
  54.  
  55. -- 
  56. Steve Alexander, Software Technologies Group    | stevea@i88.isc.com
  57. INTERACTIVE Systems Corporation, Naperville, IL | ...!{sun,ico}!laidbak!stevea
  58.