I am very new to static routing, our client asked me to implement static routing for sockets. When I googled, I ran into rtentry to set up routing information. When I opened this structure, I saw fields for static routing
struct sockaddr rt_dst; struct sockaddr rt_gateway; struct sockaddr rt_genmask;
But how can I set up multiple entries here? creating multiple rtentry and calling ioctl(FileDes, SIOCADDRT, &rtentry) fix my problem?
int32_t FileDes = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); for(auto RtEntry : RtEntriesList) { ioctl(FileDes, SIOCADDRT, RtEntry)` }
If I tune, how can I check this? It will be useful if you can provide a link to learn more about these things.
c ++ linux sockets routing
Gilson pj
source share