From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,3fb39efc72bd3f2d X-Google-Attributes: gidfee84,public From: john@iastate.edu (John Hascall) Subject: Re: Routing sockets on Digital Unix Date: 1999/02/06 Message-ID: <79hqqv$5es$1@news.iastate.edu>#1/1 X-Deja-AN: 441393187 References: <19990201144435.09406.00002779@ng43.aol.com> <36B97847.2B02@alcatel.fr> Organization: Iowa State University, Ames, Iowa USA Newsgroups: comp.unix.osf.osf1 Gabriel.OHAYON wrote: }Where is it possible to find a routing socket programming example }for Digital Unix 4.0D ?? }My aim is to get/add/delete a route from the host's routing table and }I have not found an explicit man page explaining how to use }RTM_GET, RTM_ADD, RTM_DELETE.. Hope this excerpt is some help, _GET and _DELETE are similar. if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) < 0) { /* bitch */ } shutdown(sockfd, 0); /* write only... */ memset(&rtmsg, 0, sizeof(rtmsg)); rtmsg.rthdr.rtm_msglen = sizeof(rtmsg); rtmsg.rthdr.rtm_version = RTM_VERSION; rtmsg.rthdr.rtm_type = RTM_ADD; rtmsg.rthdr.rtm_addrs = (RTA_DST|RTA_GATEWAY|RTA_NETMASK); rtmsg.rthdr.rtm_flags = RTF_GATEWAY; rtmsg.dsin.sin_family = (AF_INET <<8) + sizeof(rtmsg.dsin); rtmsg.dsin.sin_port = 0x0000; rtmsg.dsin.sin_address = destination; rtmsg.gsin.sin_family = (AF_INET <<8) + sizeof(rtmsg.gsin); rtmsg.gsin.sin_port = 0x0000; rtmsg.gsin.sin_address = gateway; rtmsg.msin.sin_family = (AF_INET <<8) + sizeof(rtmsg.msin); rtmsg.msin.sin_port = 0x0000; rtmsg.msin.sin_address = INADDR_ANY; if (write(sockfd, &rtmsg, sizeof(rtmsg)) < 0) { /* bitch ... */ } John -- John Hascall, Software Engr. Shut up, be happy. The conveniences you ISU Computation Center demanded are now mandatory. -Jello Biafra mailto:john@iastate.edu http://www.cc.iastate.edu/staff/systems/john/index.html <=- the usual crud