projects
/
project
/
netifd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
netifd : Disable netlink auto ack
[project/netifd.git]
/
system-linux.c
diff --git
a/system-linux.c
b/system-linux.c
index
d01d7e3
..
e1b9924
100644
(file)
--- a/
system-linux.c
+++ b/
system-linux.c
@@
-456,8
+456,9
@@
static int cb_clear_event(struct nl_msg *msg, void *arg)
hdr->nlmsg_type = type;
hdr->nlmsg_flags = NLM_F_REQUEST;
hdr->nlmsg_type = type;
hdr->nlmsg_flags = NLM_F_REQUEST;
- if (!nl_send_auto_complete(sock_rtnl, clr->msg))
- nl_wait_for_ack(sock_rtnl);
+ nl_socket_disable_auto_ack(sock_rtnl);
+ nl_send_auto_complete(sock_rtnl, clr->msg);
+ nl_socket_enable_auto_ack(sock_rtnl);
return NL_SKIP;
}
return NL_SKIP;
}
@@
-1067,6
+1068,7
@@
static int system_rt(struct device *dev, struct device_route *route, int cmd)
struct rtmsg rtm = {
.rtm_family = (alen == 4) ? AF_INET : AF_INET6,
.rtm_dst_len = route->mask,
struct rtmsg rtm = {
.rtm_family = (alen == 4) ? AF_INET : AF_INET6,
.rtm_dst_len = route->mask,
+ .rtm_src_len = route->sourcemask,
.rtm_table = (table < 256) ? table : RT_TABLE_UNSPEC,
.rtm_protocol = (route->flags & DEVADDR_KERNEL) ? RTPROT_KERNEL : RTPROT_STATIC,
.rtm_scope = scope,
.rtm_table = (table < 256) ? table : RT_TABLE_UNSPEC,
.rtm_protocol = (route->flags & DEVADDR_KERNEL) ? RTPROT_KERNEL : RTPROT_STATIC,
.rtm_scope = scope,
@@
-1092,6
+1094,9
@@
static int system_rt(struct device *dev, struct device_route *route, int cmd)
if (route->mask)
nla_put(msg, RTA_DST, alen, &route->addr);
if (route->mask)
nla_put(msg, RTA_DST, alen, &route->addr);
+ if (route->sourcemask)
+ nla_put(msg, RTA_SRC, alen, &route->source);
+
if (route->metric > 0)
nla_put_u32(msg, RTA_PRIORITY, route->metric);
if (route->metric > 0)
nla_put_u32(msg, RTA_PRIORITY, route->metric);
@@
-1418,11
+1423,11
@@
out:
return ret;
}
return ret;
}
-
int system_add_ip_tunnel(const char *name, struct blob_attr *attr)
{
struct blob_attr *tb[__TUNNEL_ATTR_MAX];
struct blob_attr *cur;
int system_add_ip_tunnel(const char *name, struct blob_attr *attr)
{
struct blob_attr *tb[__TUNNEL_ATTR_MAX];
struct blob_attr *cur;
+ bool set_df = true;
const char *str;
system_del_ip_tunnel(name);
const char *str;
system_del_ip_tunnel(name);
@@
-1434,9
+1439,15
@@
int system_add_ip_tunnel(const char *name, struct blob_attr *attr)
return -EINVAL;
str = blobmsg_data(cur);
return -EINVAL;
str = blobmsg_data(cur);
+ if ((cur = tb[TUNNEL_ATTR_DF]))
+ set_df = blobmsg_get_bool(cur);
+
unsigned int ttl = 0;
unsigned int ttl = 0;
- if ((cur = tb[TUNNEL_ATTR_TTL]) && (ttl = blobmsg_get_u32(cur)) > 255)
- return -EINVAL;
+ if ((cur = tb[TUNNEL_ATTR_TTL])) {
+ ttl = blobmsg_get_u32(cur);
+ if (ttl > 255 || (!set_df && ttl))
+ return -EINVAL;
+ }
unsigned int link = 0;
if ((cur = tb[TUNNEL_ATTR_LINK])) {
unsigned int link = 0;
if ((cur = tb[TUNNEL_ATTR_LINK])) {
@@
-1448,14
+1459,13
@@
int system_add_ip_tunnel(const char *name, struct blob_attr *attr)
link = iface->l3_dev.dev->ifindex;
}
link = iface->l3_dev.dev->ifindex;
}
-
if (!strcmp(str, "sit")) {
struct ip_tunnel_parm p = {
.link = link,
.iph = {
.version = 4,
.ihl = 5,
if (!strcmp(str, "sit")) {
struct ip_tunnel_parm p = {
.link = link,
.iph = {
.version = 4,
.ihl = 5,
- .frag_off =
htons(IP_DF)
,
+ .frag_off =
set_df ? htons(IP_DF) : 0
,
.protocol = IPPROTO_IPV6,
.ttl = ttl
}
.protocol = IPPROTO_IPV6,
.ttl = ttl
}