Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: john@iastate.edu (John Hascall)
Subject: Re: Routing sockets on Digital Unix
Date: 1999/02/06	[thread overview]
Message-ID: <79hqqv$5es$1@news.iastate.edu> (raw)
In-Reply-To: 36B97847.2B02@alcatel.fr

Gabriel.OHAYON <gabriel.ohayonNOSPAM@alcatel.fr> 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



  reply	other threads:[~1999-02-06  5:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-01  5:00 How to change the default MTU Esalgon
1999-02-04  5:00 ` Routing sockets on Digital Unix Gabriel.OHAYON
1999-02-06  5:00   ` John Hascall [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-02-04  5:00 Gabriel.OHAYON
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox