]> git.puffer.fish Git - mirror/frr.git/commitdiff
eigrpd: fix crash when external route is received 1014/head
authorDonnie Savage (dsavage) <dsavage@cisco.com>
Sun, 20 Aug 2017 01:32:26 +0000 (21:32 -0400)
committerDonnie Savage (dsavage) <dsavage@cisco.com>
Sun, 20 Aug 2017 01:45:49 +0000 (21:45 -0400)
    When an external route is received, eigrpd will crash. For now,
    quietly discard the TLV. Work must be done to handle tlv
    processing and changes needed to FSM so it understands an
    external should not be chooses if an internal exist.

Signed-off-by: Donnie Savage <diivious@hotmail.com>
eigrpd/eigrp_query.c
eigrpd/eigrp_update.c

index 3bca444ab751b40536d46d4cbbab945c89c2ffee..00f9ee1267dcd5e9f790c85daf046d1b647d00f1 100644 (file)
@@ -91,8 +91,10 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
 {
        struct eigrp_neighbor *nbr;
        struct TLV_IPv4_Internal_type *tlv;
+       struct prefix_ipv4 dest_addr;
 
        u_int16_t type;
+       u_int16_t length;
 
        /* increment statistics. */
        ei->query_in++;
@@ -107,9 +109,8 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
 
        while (s->endp > s->getp) {
                type = stream_getw(s);
-               if (type == EIGRP_TLV_IPv4_INT) {
-                       struct prefix_ipv4 dest_addr;
-
+               switch (type) {
+               case EIGRP_TLV_IPv4_INT:
                        stream_set_getp(s, s->getp - sizeof(u_int16_t));
 
                        tlv = eigrp_read_ipv4_tlv(s);
@@ -142,6 +143,18 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
                                eigrp_fsm_event(msg, event);
                        }
                        eigrp_IPv4_InternalTLV_free(tlv);
+                       break;
+
+               case EIGRP_TLV_IPv4_EXT:
+                       /* DVS: processing of external routes needs packet and fsm work.
+                        *      for now, lets just not creash the box
+                        */
+               default:
+                       length = stream_getw(s);
+                       // -2 for type, -2 for len
+                       for (length-=4; length ; length--) {
+                               (void)stream_getc(s);
+                       }
                }
        }
        eigrp_hello_send_ack(nbr);
index 7a7b1dd5d67137a4d3f4d12f1ddb17847fd59e80..d0c6520c4e675e293a8d0b451794c1544d22c97a 100644 (file)
@@ -169,9 +169,11 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
        struct eigrp_neighbor_entry *ne;
        u_int32_t flags;
        u_int16_t type;
+       u_int16_t length;
        u_char same;
        struct access_list *alist;
        struct prefix_list *plist;
+       struct prefix_ipv4 dest_addr;
        struct eigrp *e;
        u_char graceful_restart;
        u_char graceful_restart_final;
@@ -287,9 +289,8 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
        /*If there is topology information*/
        while (s->endp > s->getp) {
                type = stream_getw(s);
-               if (type == EIGRP_TLV_IPv4_INT) {
-                       struct prefix_ipv4 dest_addr;
-
+               switch (type) {
+               case EIGRP_TLV_IPv4_INT:
                        stream_set_getp(s, s->getp - sizeof(u_int16_t));
 
                        tlv = eigrp_read_ipv4_tlv(s);
@@ -436,6 +437,18 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
                                        pe);
                        }
                        eigrp_IPv4_InternalTLV_free(tlv);
+                       break;
+
+               case EIGRP_TLV_IPv4_EXT:
+                       /* DVS: processing of external routes needs packet and fsm work.
+                        *      for now, lets just not creash the box
+                        */
+               default:
+                       length = stream_getw(s);
+                       // -2 for type, -2 for len
+                       for (length-=4; length ; length--) {
+                               (void)stream_getc(s);
+                       }
                }
        }