Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!ucsd!ucbvax!agate!usenet.ins.cwru.edu!eagle!data.nas.nasa.gov!news From: ktk@nas.nasa.gov (Katy T. Kislitzin) Newsgroups: comp.unix.wizards Subject: Looking for a piece of code which sets IP level options Message-ID: <1991Apr30.010753.28400@nas.nasa.gov> Date: 30 Apr 91 01:07:53 GMT Sender: news@nas.nasa.gov Organization: NAS Program, NASA Ames Research Center, Moffett Field, CA Lines: 59 Hello-- I would like to see an example of a piece of code which constructs the options field in the IP header. I was under the impression that traceroute had a "source route" option, but the version that I have does not have such an option, nor does it seem to contain an example of what I seek. The version I have is from ftp.ee.lbl.gov: #ifndef lint static char *rcsid = "@(#)$Header: traceroute.c,v 1.17 89/02/28 21:01:13 van Exp $ (LBL)"; #endif My understanding is that you do something like the following: char buf[OPTLEN + FUDGE]; int s; if ( (s = socket(AF_INET, SOCK_RAW, proto) ) < 0 ){ perror("socket"); exit(1); } construct_options(buf); setsockopt(s, IPPROTO_IP, IP_OPTIONS, buf, sizeof(buf) ); What I am wondering is: a) is the above the basic idea? b) what do I put in buf? For concreteness, suppose I want to set a two hop loose source route with myself as 1.1.1.1, the next hop as 2.2.2.2 and the destination as 3.3.3.3. I would infer that buf must contain the following: type len pointer route 131 16 4 1.1.1.1 2.2.2.2 3.3.3.3 Is that correct? Finally, does anyone know if IP_OPTIONS is supported under UNICOS 6.0? The man pages have not proven illuminating. Thanks in advance, --kt PS I am not really sure what group this belongs in. It's a unix question, not a tcp/ip question, so not comp.protocols.tcp-ip, but not comp.unix.internals since I don't want to get inside the kernel, but last time I posted this sort of question to comp.unix.programmers it was like spitting in the wind. -- Katy Kislitzin, ktk@nas.nasa.gov, ...!{ames, uunet}!nas.nasa.gov!ktk [Moffett Field is in Mt. View California. I live in the Santa Cruz Mtns, approx 37deg08'N, 121deg59'W, 550m ]