From: Joerg Vehlow <joerg.veh...@aox.de> --- interface-ip.c | 7 +++++++ interface-ip.h | 4 ++++ system-linux.c | 7 +++++-- ubus.c | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/interface-ip.c b/interface-ip.c index ab4a5cf..02314cd 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -44,6 +44,7 @@ enum { ROUTE_TYPE, ROUTE_PROTO, ROUTE_DISABLED, + ROUTE_ADVMSS, __ROUTE_MAX }; @@ -61,6 +62,7 @@ static const struct blobmsg_policy route_attr[__ROUTE_MAX] = { [ROUTE_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING }, [ROUTE_PROTO] = { .name = "proto", .type = BLOBMSG_TYPE_STRING }, [ROUTE_DISABLED] = { .name = "disabled", .type = BLOBMSG_TYPE_BOOL }, + [ROUTE_ADVMSS] = { .name ="advmss", .type = BLOBMSG_TYPE_INT32 }, }; const struct uci_blob_param_list route_attr_list = { @@ -460,6 +462,11 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) route->flags |= DEVROUTE_MTU; } + if ((cur = tb[ROUTE_ADVMSS]) != NULL) { + route->advmss = blobmsg_get_u32(cur); + route->flags |= DEVROUTE_ADVMSS; + } + /* Use source-based routing */ if ((cur = tb[ROUTE_SOURCE]) != NULL) { char *saveptr, *source = alloca(blobmsg_data_len(cur)); diff --git a/interface-ip.h b/interface-ip.h index 8843349..eabdb39 100644 --- a/interface-ip.h +++ b/interface-ip.h @@ -51,6 +51,9 @@ enum device_addr_flags { /* neighbor mac address */ DEVNEIGH_MAC = (1 << 11), + + /* advertised mss */ + DEVROUTE_ADVMSS = (1 << 12), }; union if_addr { @@ -98,6 +101,7 @@ struct device_route { unsigned int type; unsigned int proto; time_t valid_until; + unsigned int advmss; /* must be last */ enum device_addr_flags flags; diff --git a/system-linux.c b/system-linux.c index 462a8cc..060c21d 100644 --- a/system-linux.c +++ b/system-linux.c @@ -2828,13 +2828,16 @@ static int system_rt(struct device *dev, struct device_route *route, int cmd) if (table >= 256) nla_put_u32(msg, RTA_TABLE, table); - if (route->flags & DEVROUTE_MTU) { + if (route->flags & (DEVROUTE_MTU | DEVROUTE_ADVMSS)) { struct nlattr *metrics; if (!(metrics = nla_nest_start(msg, RTA_METRICS))) goto nla_put_failure; - nla_put_u32(msg, RTAX_MTU, route->mtu); + if (route->flags & DEVROUTE_MTU) + nla_put_u32(msg, RTAX_MTU, route->mtu); + if (route->flags & DEVROUTE_ADVMSS) + nla_put_u32(msg, RTAX_ADVMSS, route->advmss); nla_nest_end(msg, metrics); } diff --git a/ubus.c b/ubus.c index 3cb5c1a..8f7082d 100644 --- a/ubus.c +++ b/ubus.c @@ -642,6 +642,9 @@ interface_ip_dump_route_list(struct interface_ip_settings *ip, bool enabled) if (route->flags & DEVROUTE_MTU) blobmsg_add_u32(&b, "mtu", route->mtu); + if (route->flags & DEVROUTE_ADVMSS) + blobmsg_add_u32(&b, "advmss", route->advmss); + if (route->flags & DEVROUTE_METRIC) blobmsg_add_u32(&b, "metric", route->metric); @@ -651,6 +654,7 @@ interface_ip_dump_route_list(struct interface_ip_settings *ip, bool enabled) if (route->valid_until) blobmsg_add_u32(&b, "valid", route->valid_until - now); + buf = blobmsg_alloc_string_buffer(&b, "source", buflen); inet_ntop(af, &route->source, buf, buflen); snprintf(buf + strlen(buf), buflen - strlen(buf), "/%u", route->sourcemask); -- 2.25.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel