Skip to content

Commit

Permalink
zebra: fix rtnh_len in the rt_netlink messages for multipath case
Browse files Browse the repository at this point in the history
In _netlink_route_build_multipath():
- Each time when appending a IPv4 gateway in the message, rtnh_len
  is increased by sizeof (struct rtattr) + 4, where we should use
  "bytelen" instead of the hard coding "4".
- As what done for IPv4, we should increase rtnh_len accordingly
  along with adding a IPv6 gateway, or else the IPv6 gateways will
  be lost.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
  • Loading branch information
feng-lu authored and eqvinox committed Sep 15, 2014
1 parent 0b74a0a commit 621e2aa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zebra/rt_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ _netlink_route_build_multipath(
{
rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
&nexthop->gate.ipv4, bytelen);
rtnh->rtnh_len += sizeof (struct rtattr) + 4;
rtnh->rtnh_len += sizeof (struct rtattr) + bytelen;

if (nexthop->src.ipv4.s_addr)
*src = &nexthop->src;
Expand All @@ -1580,6 +1580,7 @@ _netlink_route_build_multipath(
{
rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
&nexthop->gate.ipv6, bytelen);
rtnh->rtnh_len += sizeof (struct rtattr) + bytelen;

if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("netlink_route_multipath() (%s): "
Expand Down

0 comments on commit 621e2aa

Please sign in to comment.