From 02b459988199f05c81d4353d6fd6812c196c7a5d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 23 Aug 2017 14:19:45 -0400 Subject: eigrpd: Convert pe->destination_ipv4 to pe->destination Convert the destination_ipv4 to a struct prefix and just call it destination. Signed-off-by: Donald Sharp --- eigrpd/eigrp_packet.c | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) (limited to 'eigrpd/eigrp_packet.c') diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index d4e8264f2..68e7cdcbb 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -1167,21 +1167,21 @@ u_int16_t eigrp_add_internalTLV_to_stream(struct stream *s, u_int16_t length; stream_putw(s, EIGRP_TLV_IPv4_INT); - if (pe->destination_ipv4->prefixlen <= 8) { + if (pe->destination->prefixlen <= 8) { stream_putw(s, 0x001A); length = 0x001A; } - if ((pe->destination_ipv4->prefixlen > 8) - && (pe->destination_ipv4->prefixlen <= 16)) { + if ((pe->destination->prefixlen > 8) + && (pe->destination->prefixlen <= 16)) { stream_putw(s, 0x001B); length = 0x001B; } - if ((pe->destination_ipv4->prefixlen > 16) - && (pe->destination_ipv4->prefixlen <= 24)) { + if ((pe->destination->prefixlen > 16) + && (pe->destination->prefixlen <= 24)) { stream_putw(s, 0x001C); length = 0x001C; } - if (pe->destination_ipv4->prefixlen > 24) { + if (pe->destination->prefixlen > 24) { stream_putw(s, 0x001D); length = 0x001D; } @@ -1200,34 +1200,18 @@ u_int16_t eigrp_add_internalTLV_to_stream(struct stream *s, stream_putc(s, pe->reported_metric.tag); stream_putc(s, pe->reported_metric.flags); - stream_putc(s, pe->destination_ipv4->prefixlen); + stream_putc(s, pe->destination->prefixlen); - if (pe->destination_ipv4->prefixlen <= 8) { - stream_putc(s, pe->destination_ipv4->prefix.s_addr & 0xFF); - } - if ((pe->destination_ipv4->prefixlen > 8) - && (pe->destination_ipv4->prefixlen <= 16)) { - stream_putc(s, pe->destination_ipv4->prefix.s_addr & 0xFF); - stream_putc(s, - (pe->destination_ipv4->prefix.s_addr >> 8) & 0xFF); - } - if ((pe->destination_ipv4->prefixlen > 16) - && (pe->destination_ipv4->prefixlen <= 24)) { - stream_putc(s, pe->destination_ipv4->prefix.s_addr & 0xFF); + stream_putc(s, pe->destination->u.prefix4.s_addr & 0xFF); + if (pe->destination->prefixlen > 8) stream_putc(s, - (pe->destination_ipv4->prefix.s_addr >> 8) & 0xFF); + (pe->destination->u.prefix4.s_addr >> 8) & 0xFF); + if (pe->destination->prefixlen > 16) stream_putc(s, - (pe->destination_ipv4->prefix.s_addr >> 16) & 0xFF); - } - if (pe->destination_ipv4->prefixlen > 24) { - stream_putc(s, pe->destination_ipv4->prefix.s_addr & 0xFF); + (pe->destination->u.prefix4.s_addr >> 16) & 0xFF); + if (pe->destination->prefixlen > 24) stream_putc(s, - (pe->destination_ipv4->prefix.s_addr >> 8) & 0xFF); - stream_putc(s, - (pe->destination_ipv4->prefix.s_addr >> 16) & 0xFF); - stream_putc(s, - (pe->destination_ipv4->prefix.s_addr >> 24) & 0xFF); - } + (pe->destination->u.prefix4.s_addr >> 24) & 0xFF); return length; } -- cgit v1.2.3