+/*
+ * netifd - network interface daemon
+ * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
#define _GNU_SOURCE
#include <sys/socket.h>
nlmsg_append(msg, &ifa, sizeof(ifa), 0);
nla_put(msg, IFA_LOCAL, alen, &addr->addr);
- if (v4)
- nla_put_u32(msg, IFA_BROADCAST, addr->broadcast);
+ if (v4) {
+ if (addr->broadcast)
+ nla_put_u32(msg, IFA_BROADCAST, addr->broadcast);
+ if (addr->point_to_point)
+ nla_put_u32(msg, IFA_ADDRESS, addr->point_to_point);
+ }
return system_rtnl_call(msg);
}
.rtm_family = (alen == 4) ? AF_INET : AF_INET6,
.rtm_dst_len = route->mask,
.rtm_table = RT_TABLE_MAIN,
- .rtm_protocol = RTPROT_BOOT,
+ .rtm_protocol = (route->flags & DEVADDR_KERNEL) ? RTPROT_KERNEL : RTPROT_BOOT,
.rtm_scope = scope,
.rtm_type = (cmd == RTM_DELROUTE) ? 0: RTN_UNICAST,
};