#include <linux/netlink.h>
#include <linux/rtnetlink.h>
+#include <net/route.h>
+
/* Support older kernels */
#ifndef IFLA_WIRELESS
# define IFLA_WIRELESS (IFLA_MASTER + 1)
add_attr_l(&nlm.hdr, sizeof(nlm), RTA_DST,
&rt->dest.s6_addr, sizeof(rt->dest.s6_addr));
- /* If destination == gateway then don't add the gateway */
- if (!IN6_IS_ADDR_UNSPECIFIED(&rt->gate) &&
- !IN6_ARE_ADDR_EQUAL(&rt->dest, &rt->gate))
+ if (action >= 0 && !IN6_IS_ADDR_UNSPECIFIED(&rt->gate))
add_attr_l(&nlm.hdr, sizeof(nlm), RTA_GATEWAY,
&rt->gate.s6_addr, sizeof(rt->gate.s6_addr));
gate = inet_ntop(AF_INET6, &rt->gate.s6_addr,
gatebuf, INET6_ADDRSTRLEN);
if (IN6_ARE_ADDR_EQUAL(&rt->gate, &in6addr_any))
- syslog(LOG_INFO, "%s: %s %sroute to %s/%d", ifname, cmd,
- rt->flags & RTF_REJECT ? "reject " : "",
+ syslog(LOG_INFO, "%s: %s route to %s/%d", ifname, cmd,
dest, ipv6_prefixlen(&rt->net));
else if (IN6_ARE_ADDR_EQUAL(&rt->dest, &in6addr_any) &&
IN6_ARE_ADDR_EQUAL(&rt->net, &in6addr_any))