Hello, Damien Zammit, le dim. 28 août 2022 06:41:21 +0000, a ecrit: > #define _IOT_srtentry _IOT (_IOTS(int), 3, _IOTS(short int), 2, 0, 0) > > /* move to bits/ioctl.h */ > #define SIOCADDRT _IOW('i', 10, struct srtentry) > #define SIOCDELRT _IOW('i', 11, struct srtentry) > > struct srtentry { > in_addr_t rt_dest; > in_addr_t rt_mask; > in_addr_t rt_gateway; > unsigned short int rt_flags; > unsigned short int rt_mtu; > };
This is missing the ifname field, which is there: > +/* 10 SIOCADDRT */ > +routine iioctl_siocaddrt ( > + reqport: io_t; > + ifnam: ifname_t; > + route: srtentry_t); See for instance SIOCSIFADDR: the ioctl takes a struct ifreq, whose first field is passed as ifnam. Also, better forecast other missing fields in srtentry, compared to contemporary rtentry: rt_tos, rt_class, rt_metric, rt_mtu, rt_window, rt_irtt. Make them ints (it's useless to make them longs), as well as rt_flags and rt_mtu, so it can all fit in the ioctl constraint. > + struct srtentry route = {0}; > + route.rt_flags = 0; > + route.rt_dest = INADDR_BROADCAST; > + route.rt_mask = INADDR_ANY; > + route.rt_gateway = INADDR_ANY; It's useless to add a broadcast route. Just add the route corresponding to the configured IP address and netmask. The broadcast will then just work from that. Samuel