diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/vrrp/vrrp_packet.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/vrrp/vrrp_packet.c b/src/plugins/vrrp/vrrp_packet.c index b470ddeba08..84bd3701edb 100644 --- a/src/plugins/vrrp/vrrp_packet.c +++ b/src/plugins/vrrp/vrrp_packet.c @@ -102,13 +102,20 @@ vrrp_adv_l3_build (vrrp_vr_t * vr, vlib_buffer_t * b, if (!vrrp_vr_is_ipv6 (vr)) /* IPv4 */ { ip4_header_t *ip4 = vlib_buffer_get_current (b); + ip4_address_t *src4; clib_memset (ip4, 0, sizeof (*ip4)); ip4->ip_version_and_header_length = 0x45; ip4->ttl = 255; ip4->protocol = IP_PROTOCOL_VRRP; clib_memcpy (&ip4->dst_address, &dst->ip4, sizeof (dst->ip4)); - fib_sas4_get (vr->config.sw_if_index, NULL, &ip4->src_address); + + /* RFC 5798 Section 5.1.1.1 - Source Address "is the primary IPv4 + * address of the interface the packet is being sent from". Assume + * this is the first address on the interface. + */ + src4 = ip_interface_get_first_ip (vr->config.sw_if_index, 1); + ip4->src_address.as_u32 = src4->as_u32; ip4->length = clib_host_to_net_u16 (sizeof (*ip4) + vrrp_adv_payload_len (vr)); ip4->checksum = ip4_header_checksum (ip4); @@ -536,10 +543,14 @@ vrrp_igmp_pkt_build (vrrp_vr_t * vr, vlib_buffer_t * b) u8 *ip4_options; igmp_membership_report_v3_t *report; igmp_membership_group_v3_t *group; + ip4_address_t *src4; ip4 = vlib_buffer_get_current (b); clib_memcpy (ip4, &igmp_ip4_mcast, sizeof (*ip4)); - fib_sas4_get (vr->config.sw_if_index, NULL, &ip4->src_address); + + /* Use the source address advertisements will use to join mcast group */ + src4 = ip_interface_get_first_ip (vr->config.sw_if_index, 1); + ip4->src_address.as_u32 = src4->as_u32; vlib_buffer_chain_increase_length (b, b, sizeof (*ip4)); vlib_buffer_advance (b, sizeof (*ip4)); |