On Thu, Dec 04, 2025 at 07:49:51PM +0300, Alexander Mukhin wrote:
> >Synopsis:    eigrpd: multiple issues
> >Category:    user
> >Environment:
>       System      : OpenBSD 7.8
>       Details     : OpenBSD 7.8 (GENERIC) #54: Sun Oct 12 12:45:58 MDT 2025
>                        
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
> 
>       Architecture: OpenBSD.amd64
>       Machine     : amd64
> >Description:
>       eigrpd: multiple issues
> >How-To-Repeat:
>       At first, eigrp daemon exited with error just after start:
> 
>       # cat eigrpd.conf
>       address-family ipv4 {
>               autonomous-system 1 {
>                       interface vio1
>                       interface vio2
>               }
>       }
>       # eigrpd -d -v -f eigrpd.conf
>       startup
>       ...
>       fatal in eigrpe: in_cksum: packet too big
>       ...
>       waiting for children to terminate
>       terminating
> 
>       I found that in_cksum() is called with uninitialized data
>       because of swapped source and destination in ibuf_from_ibuf().
>       I fixed that. Then the daemon started but was unable to make
>       an adjacency with a Cisco router. Cisco complained on wrong
>       checksum in incoming EIGRP packets. In fact, the checksums were
>       in wrong byte order. I added a call to htons(). Then eigrpd and
>       Cisco made an adjacency and exchanged routes.
> 
>       Unfortunately, redistribution of static routes didn't work.
>       It looks like children processes get configuration with
>       empty redist_list despite of that list being correctly filled
>       in the master process. I was unable to fix this issue.
> >Fix:
>       (partial fix) 
> --- packet.c
> +++ packet.c
> @@ -175,7 +175,7 @@ send_packet(struct eigrp_iface *ei, struct nbr *nbr, 
> uint32_t flags,
>               rtp_ack_stop_timer(nbr);
>       }
>  
> -     ibuf_from_ibuf(buf, &ebuf);
> +     ibuf_from_ibuf(&ebuf, buf);

Doh! I think that's the 2nd ibuf_from_ibuf I messed up.

>       if (ibuf_get(&ebuf, &eigrp_hdr, sizeof(eigrp_hdr)) == -1)
>               fatalx("send_packet: get hdr failed");
>  
> @@ -189,7 +189,7 @@ send_packet(struct eigrp_iface *ei, struct nbr *nbr, 
> uint32_t flags,
>       if (ibuf_set_n16(buf, offsetof(struct eigrp_hdr, chksum), 0) == -1)
>               fatalx("send_packet: set of chksum failed");
>       if (ibuf_set_n16(buf, offsetof(struct eigrp_hdr, chksum),
> -         in_cksum(ibuf_data(buf), ibuf_size(buf))) == -1)
> +         htons(in_cksum(ibuf_data(buf), ibuf_size(buf)))) == -1)

Here you could just use ibuf_set_h16() instead of ibuf_set_n16() to
prevent the value to be double converted.

>               fatalx("send_packet: set of chksum failed");
>  
>       /* log packet being sent */
> 

Thanks for finding these issues. It is tricky for me to test eigrpd since
I have no cisco gear to test against.

-- 
:wq Claudio

Reply via email to