From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,54e7ee740bc910df,start X-Google-Attributes: gidfa528,public X-Google-Thread: fc89c,54e7ee740bc910df,start X-Google-Attributes: gidfc89c,public X-Google-ArrivalTime: 2002-02-11 06:08:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!opentransit.net!wanadoo.fr!not-for-mail From: "adsl1 devil" Newsgroups: comp.unix.programmer,comp.unix.tru64 Subject: How to send an ARP packet using the Netrain interface ? Date: Mon, 11 Feb 2002 15:09:49 +0100 Organization: Wanadoo, l'internet avec France Telecom Message-ID: NNTP-Posting-Host: abrest-101-1-3-226.abo.wanadoo.fr X-Trace: wanadoo.fr 1013436485 14005 217.128.96.226 (11 Feb 2002 14:08:05 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 11 Feb 2002 14:08:05 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Xref: archiver1.google.com comp.unix.programmer:24394 comp.unix.tru64:6771 Hi, I'm trying to send an ARP packet to a specific target. But, my program (which includes the piece of the following code) gives a "Bind error : permission denied" message. This program is executed with the root account. So, my question is : Is it possible to use DLI with a netrain interface in order to program arp packet ? And if the answer is yes, how do I use this API for netrain ? Thanks, Stephane. /* * Build an Ethernet frame */ int open_ethernet(char *device, struct sockaddr_dl *sdl, u_char *src, u_char *target, u_short dli_proto) { int fd; int ch; bzero(sdl, sizeof(*sdl)); if (sscanf(device, "%[a-z]%hd%c", sdl->dli_device.dli_devname, &(sdl->dli_device.dli_devnumber), &ch) != 2) { fprintf(stderr, "%s : invalid device name\n", device); exit(EXIT_FAILURE); } sdl->dli_family = AF_DLI; sdl->dli_substructype = DLI_ETHERNET; sdl->choose_addr.dli_eaddr.dli_ioctlflg = DLI_NORMAL; sdl->choose_addr.dli_eaddr.dli_protype = dli_proto; if (sdl->choose_addr.dli_eaddr.dli_target) bcopy(target, sdl->choose_addr.dli_eaddr.dli_target, DLI_EADDRSIZE); /* if (sdl.choose_addr.dli_eaddr.dli_dest) bcopy(src, sdl->choose_addr.dli_eaddr.dli_dest, DLI_EADDRSIZE); */ if ((fd = socket(AF_DLI, SOCK_DGRAM, DLPROTO_DLI)) < 0) { fprintf(stderr, "DLI open failed: %s\n", strerror(errno)); exit(EXIT_FAILURE); } if (bind(fd, (struct sockaddr*) sdl, sizeof(*sdl)) < 0) { fprintf(stderr, "DLI bind failed : %s\n", strerror(errno)); exit(EXIT_FAILURE); } return fd; }