Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!bloom-beacon!think!husc6!rice!sun-spots-request From: ronen%math.tau.ac.il@cunyvm.cuny.edu Newsgroups: comp.sys.sun Subject: Sending raw ethernet packets Keywords: Networks Message-ID: <4198@kalliope.rice.edu> Date: 29 Jun 89 08:13:24 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 68 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 56, message 2 of 4 The following program was supposed to send a hand-made packet over the ethernet. It completes with no errors, but does not seem to really send anything. Am I misunderstanding something ? I'm using Sun 3/160, SunOS 4.0.1. Thank you for any help. Ronen Friedman ronen@math.tau.ac.il ronen@taurus.bitnet ---------------------------------------------------- #include #include #include #include #include #include #include #include #include #include #include extern int errno; char mess[] = /* to: | from: */ "\011\000\053\000\000\017\252\000\004\000\376\005..............."; /* 191 more bytes of data ^^^^ */ main() { struct strioctl si; struct ifreq ifr; struct strbuf datam; long if_fd; if ((if_fd = open("/dev/nit",O_WRONLY)) < 0) { perror("open: "); exit(1); } /* * configure the nit device, binding it */ strncpy(ifr.ifr_name, "ie0", sizeof ifr.ifr_name); ifr.ifr_name[sizeof ifr.ifr_name - 1] = ' '; si.ic_cmd = NIOCBIND; si.ic_len = sizeof ifr; si.ic_dp = (char *)𝔦 if (ioctl(if_fd, I_STR, (char *)&si) < 0) { perror("bind: "); exit(1); } /* * sending the packet on the wire */ datam.maxlen = 203; datam.len = 203; datam.buf = mess; if (putmsg(if_fd, NULL, &datam, 0) != 0) { perror("putmsg :"); exit(1); } }