On Thu, Jan 19, 2017 at 06:26:25AM +0100, Peter Hessler wrote:
> On 2016 Dec 17 (Sat) at 14:05:40 +0100 (+0100), Peter Hessler wrote:
> :On 2016 Sep 30 (Fri) at 10:16:19 +0200 (+0200), Peter Hessler wrote:
> ::This diff makes route get and route monitor work.  sockaddr_bfd is so we
> ::can play like the other RTAX_* indexes in rti_info of route messages.
> ::
> 
> In route(8), only say "up" or "down" for the state of BFD.  use -v or
> -bfd to get details that only matter to debug BFD.
> 
> $ route -n get 203.0.113.9       
>    route to: 203.0.113.9
> destination: 203.0.113.9
>        mask: 255.255.255.255
>   interface: em1
>  if address: 203.0.113.1
>    priority: 3 ()
>       flags: <UP,HOST,DONE,LLINFO,CLONED,BFD>
>         BFD: up
>      use       mtu    expire
>     1402         0       922 
> sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
> 
> I also fixed a number of things that mpi@ noticed.
> 

You need to restructure sockaddr_bfd to be a) a power of 2 and b) so layed
out that there is no implicit padding on any arch. For example the 64bit
time_t values need to start on a 8byte offset.

Abusing sockaddrs for something that is only used on the routing socket
feels a but wrong but that is a different thing to fix.

> +struct sockaddr_bfd {
> +     uint8_t         bs_len;         /* total length */
> +     sa_family_t     bs_family;      /* address family */
> +     /* above matches sockaddr_storage */
> +
> +     uint16_t        bs_mode;
> +     uint32_t        bs_mintx;
> +     uint32_t        bs_minrx;
> +     uint32_t        bs_minecho;
> +     uint16_t        bs_multiplier;
> +
> +     time_t          bs_uptime;
> +     time_t          bs_lastuptime;
> +     int             bs_state;
> +     int             bs_remotestate;
> +     int             bs_laststate;
> +     int             bs_error;
> +
> +     uint32_t        bs_localdiscr;
> +     uint32_t        bs_localdiag;
> +     uint32_t        bs_remotediscr;
> +     uint32_t        bs_remotediag;
> +};
> +

-- 
:wq Claudio

Reply via email to