]> git.proxmox.com Git - mirror_frr.git/commitdiff
eigrpd: Correctly set the mtu for eigrp packets sent
authorDonald Sharp <sharpd@nvidia.com>
Sun, 31 Jan 2021 13:32:15 +0000 (08:32 -0500)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 16 Feb 2021 17:57:53 +0000 (20:57 +0300)
This version of eigrp pre-calculated the eigrp metric
to be a default of 1500 bytes, but unfortunately it
had entered the byte order wrong.

Modify the code to properly set the byte order
according to the eigrp rfc as well as actually
read in and transmit the mtu of the interface
instead of hard coding it to 1500 bytes.

Fixes: #7986
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
eigrpd/eigrp_interface.c
eigrpd/eigrp_structs.h

index 9ef4e8623702ca3e46d92e5862711d51c9aeecef..3a45771eaab52f5b0d031a2ea123a52734225772 100644 (file)
@@ -227,6 +227,20 @@ void eigrp_del_if_params(struct eigrp_if_params *eip)
                free(eip->auth_keychain);
 }
 
+/*
+ * Set the network byte order of the 3 bytes we send
+ * of the mtu of the link.
+ */
+static void eigrp_mtu_convert(struct eigrp_metrics *metric, uint32_t host_mtu)
+{
+       uint32_t network_mtu = htonl(host_mtu);
+       uint8_t *nm = (uint8_t *)&network_mtu;
+
+       metric->mtu[0] = nm[1];
+       metric->mtu[1] = nm[2];
+       metric->mtu[2] = nm[3];
+}
+
 int eigrp_if_up(struct eigrp_interface *ei)
 {
        struct eigrp_prefix_entry *pe;
@@ -254,9 +268,7 @@ int eigrp_if_up(struct eigrp_interface *ei)
        metric.delay = eigrp_delay_to_scaled(ei->params.delay);
        metric.load = ei->params.load;
        metric.reliability = ei->params.reliability;
-       metric.mtu[0] = 0xDC;
-       metric.mtu[1] = 0x05;
-       metric.mtu[2] = 0x00;
+       eigrp_mtu_convert(&metric, ei->ifp->mtu);
        metric.hop_count = 0;
        metric.flags = 0;
        metric.tag = 0;
index 82bddaaae3bbd5dbe51ecb6f857776278b5e48a3..1337ec966fdc26e3b752320d2a8b4da3473d12f9 100644 (file)
@@ -60,7 +60,7 @@ struct eigrp_master {
 struct eigrp_metrics {
        uint32_t delay;
        uint32_t bandwidth;
-       unsigned char mtu[3];
+       uint8_t mtu[3];
        uint8_t hop_count;
        uint8_t reliability;
        uint8_t load;