bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] pfinet: Add SIOCADDRT and SIOCDELRT equivalent iioctls


From: Samuel Thibault
Subject: Re: [PATCH v2] pfinet: Add SIOCADDRT and SIOCDELRT equivalent iioctls
Date: Sun, 28 Aug 2022 14:23:08 +0200
User-agent: NeoMutt/20170609 (1.8.3)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]