Haomin Zhu writes:
> well, i meet a problem when i'm trying to make a program which do the things 
> like cmd "route add net dest_net_addr gw_addr -interface". i use the "struct 
> rt_msghdr" to save the routing information, and pass them to kernel routing 
> table by socket. 

Are you _sure_ you want "-interface" and not "-ifp"?  The former
creates an interface route, which will result in your system sending
ARP requests for non-local destinations, as though you'd plumbed a new
interface and configured the subnet locally.  It's at best a hack.

To do the same thing as "route add ... -interface," simply turn off
RTF_GATEWAY in your rtm_flags.

> i am sure that i assigned right ifindex value to the rt_msghdr. 
> what's wrong with my program? or are there some other method to implement 
> this cmd? 
> please help me.

Assuming you're interested in the output interface and not ARP
behavior, I think what you want here is RTA_IFP.  This 'address' entry
uses AF_LINK (struct sockaddr_dl), and you set sdl_index to the
ifIndex of interest.

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 1 Network Drive         71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to