Re: [VOTE] New member proposal: Robimarko (Robert Marko)

2024-02-08 Thread Hans Dedecker
On Tue, Jan 30, 2024 at 7:16 PM Christian Marangi (Ansuel)
 wrote:
>
> Robert is active in OpenWrt since 2017 and with some recent stats, he
> has more than 310 commits merged in OpenWrt.
> He also have uncounted Reviewed-by tag on various PR and merged commits
> and generally helps in everything related to IPQ (ipq806x, ipq40xx and
> ipq807x) and some mvebu targets.
>
> He did the conversion of ipq40xx target to DSA and made possible the
> introduction of the ipq807x target by sorting all the QSDK downstream
> patch and pushing them upstream.
>
> With his help, also the ipq60xx is very close on getting merged and
> actually used permitting support of even more device for OpenWrt.
>
> Also he is almost always reachable on IRC openwrt-devel and never had
> a problem in coordinating and collaborating with him.
>
> I think Robert is a good addition to our team and would massively help
> me (Ansuel) in maintaining each IPQ target and review all the related
> PR on github and patchwork.
> I would like to add Robert to the OpenWrt committers team.
+1

Hans
>
> The vote shall be concluded within 14 days. (13/02/2024)
>
> ___
> openwrt-adm mailing list
> openwrt-...@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-adm

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH netifd v2] interface-ip: fix ipv6 routing loop

2023-03-29 Thread Hans Dedecker
Hi,

On Wed, Mar 29, 2023 at 4:44 PM Maxim Mikityanskiy  wrote:
>
> Hello Hans!
>
> On Sun, 03 Jan 2021 12:14:18 -0800, Hans Dedecker wrote:
> > In case of prefix delegation an upstream ISP will route the complete
> > delegated prefix (e.g 2001:DB8:BEEF::/56) to an OpenWrt device, OpenWrt
> > will route back the complete /56 not matching a local or subdelegated
> > prefix and with as source an address from the delegated prefix
> > causing a routing loop.
> > Fix this by using an ip rule which directs traffic matching the
> > subdelegated prefix and coming from the wan interface to the main or
> > user configured routing table.
> > An ip rule with lower priority will make sure the traffic not matching
> > the subdelegated prefix(es) will be dropped with an ICMPv6 unreachable
> > fixing the potential routing loop.
> >
> >
> > This will result into the following typical IPv6 rules :
> >
> > 0:  from all lookup local
> > 3:  from all to 2001:DB8:BEEF::/64 iif eth4 lookup main
> > 30001:  from all to 2001:DB8:BEEF::/56 iif eth4 unreachable
> > 32766:  from all lookup main
> > 42: from 2001:DB8:BEEF::1/64 iif br-lan unreachable
>
> Could you please hint me why the rule with ID 42 is useful? I
> understand the purpose of rule 30001 explained in this commit message,
> but I can't imagine the situation in which rule 42 would be
> triggered, because the main routing table has the default route that
> would be the final match.
If IPv6 source based routing is used the default route will only be
hit when the source IP matches the source attached to the default
route.
If this is not the case the unreachable ip rule will be hit if the
source IP matches the source attached to the rule

Hans
>
> Thanks,
> Max
>
> > 420001: from all iif lo failed_policy
> > 420011: from all iif eth0 failed_policy
> > 4200000015: from all iif eth4 failed_policy
> > 420015: from all iif eth4 failed_policy
> > 420019: from all iif br-lan failed_policy
> >
> > Signed-off-by: Hans Dedecker 
> > ---
> > v2: Keep unreachable route in the routing table dropping traffic from the 
> > lan
> > not matching any routing rules with an ICMPv6 unreachable

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [odhcpd PATCH v2 2/2] router: skip RA and wait for LINK-LOCAL to be assigned

2023-03-22 Thread Hans Dedecker
On Sun, Mar 19, 2023 at 7:39 PM Christian Marangi  wrote:
>
> This fix a specific and corner case when the following error and similar
> is printed in the log:
>
> Failed to send to ff02::1%br-lan (Address not available)
>
> The cause for this was tracked down to the lack of the interface of a
> configured LINK-LOCAL IPV6 address resulting in odhcpd_send() always
> failing.
>
> A LINK-LOCAL IPV6 address is assigned only after the interface has
> carrier and is set to IFF_RUNNING and require some time for the address
> to be assigned due to DAD logic.
>
> In the case where an interface was just UP, odhcpd RA may fail since the
> LINK-LOCAL IPV6 address still needs to be assigned as it still need to
> be "trained". From the kernel view this is flagged in the IPV6 interface
> address with the flag IFA_F_TENTATIVE, that means the address still
> needs to be checked and follow DAD process.
>
> This is only a transient problem and the DAD process is required only
> once till the interface is not set DOWN.
>
> To handle this, add some check to verify if the address has to be
> checked and add an additional bool to flag if the interface have a
> LINK-LOCAL assigned.
>
> Skip sending RA if the interface still doesn't have finished the DAD
> process and retry at the next RA.
> A notice log is added to track this special case to track problematic
> case and even more corner case.
>
> Logic to check if interface have LINK-LOCAL are:
> - When interface is setup, on scanning for the interface ipv6 address
>   check if at least one address is NOT in IFA_F_TENTATIVE state.
> - With interface already up but with still no LINK-LOCAL react on the
>   RTM_NEWADDR event and set LINK-LOCAL if the addrs added by the event
>   is a LINK-LOCAL reflecting that the interface finally ended the DAD
>   process and have a correct address.
>
> Signed-off-by: Christian Marangi 
Acked-by: Hans Dedecker 
> ---
>  src/config.c  |  9 +
>  src/netlink.c | 11 ++-
>  src/odhcpd.h  |  2 ++
>  src/router.c  |  6 ++
>  4 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/src/config.c b/src/config.c
> index 30da879..ee7219f 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -594,6 +594,15 @@ int config_parse_interface(void *data, size_t len, const 
> char *name, bool overwr
> if (len > 0)
> iface->addr6_len = len;
>
> +   for (size_t i = 0; i < iface->addr6_len; i++) {
> +   struct odhcpd_ipaddr *addr = &iface->addr6[i];
> +
> +   if (!addr->tentative) {
> +   iface->have_link_local = true;
> +   break;
> +   }
> +   }
> +
> len = netlink_get_interface_addrs(iface->ifindex,
> false, &iface->addr4);
> if (len > 0)
> diff --git a/src/netlink.c b/src/netlink.c
> index 4a352a6..0a2da03 100644
> --- a/src/netlink.c
> +++ b/src/netlink.c
> @@ -386,7 +386,7 @@ static int handle_rtm_addr(struct nlmsghdr *hdr, bool add)
>
> nla_memcpy(&event_info.addr, nla[IFA_ADDRESS], 
> sizeof(event_info.addr));
>
> -   if (IN6_IS_ADDR_LINKLOCAL(&event_info.addr) || 
> IN6_IS_ADDR_MULTICAST(&event_info.addr))
> +   if (IN6_IS_ADDR_MULTICAST(&event_info.addr))
> return NL_SKIP;
>
> inet_ntop(AF_INET6, &event_info.addr, buf, sizeof(buf));
> @@ -395,6 +395,11 @@ static int handle_rtm_addr(struct nlmsghdr *hdr, bool 
> add)
> if (iface->ifindex != (int)ifa->ifa_index)
> continue;
>
> +   if (add && IN6_IS_ADDR_LINKLOCAL(&event_info.addr)) {
> +   iface->have_link_local = true;
> +   return NL_SKIP;
> +   }
> +
> syslog(LOG_DEBUG, "Netlink %s %s on %s", add ? 
> "newaddr" : "deladdr",
> buf, iface->name);
>
> @@ -625,6 +630,10 @@ static int cb_addr_valid(struct nl_msg *msg, void *arg)
> if (ifa->ifa_flags & IFA_F_DEPRECATED)
> addrs[ctxt->ret].preferred = 0;
>
> +   if (ifa->ifa_family == AF_INET6 &&
> +   ifa->ifa_flags & IFA_F_TENTATIVE)
> +   addrs[ctxt->ret].tentative = true;
> +
> ctxt->ret++;
> *(ctxt->addrs) = addrs;
>
> diff --git a/src/od

Re: [odhcpd PATCH 2/2] router: skip RA and wait for LINK-LOCAL to be assigned

2023-03-18 Thread Hans Dedecker
On Fri, Mar 17, 2023 at 1:54 AM Christian Marangi  wrote:
>
> This fix a specific and corner case when the following error and similar
> is printed in the log:
>
> Failed to send to ff02::1%br-lan (Address not available)
>
> The cause for this was tracked down to the lack of the interface of a
> configured LINK-LOCAL IPV6 address resulting in odhcpd_send() always
> failing.
>
> A LINK-LOCAL IPV6 address is assigned only after the interface has
> carrier and is set to IFF_RUNNING and require some time for the address
> to be assigned due to DAD logic.
>
> In the case where an interface was just UP, odhcpd RA may fail since the
> LINK-LOCAL IPV6 address still needs to be assigned as it still need to
> be "trained". From the kernel view this is flagged in the IPV6 interface
> address with the flag IFA_F_TENTATIVE, that means the address still
> needs to be checked and follow DAD process.
>
> This is only a transient problem and the DAD process is required only
> once till the interface is not set DOWN.
>
> To handle this, add some check to verify if the address has to be
> checked and add an additional bool to flag if the interface have a
> LINK-LOCAL assigned.
>
> Skip sending RA if the interface still doesn't have finished the DAD
> process and retry at the next RA.
> A notice log is added to track this special case to track problematic
> case and even more corner case.
>
> Logic to check if interface have LINK-LOCAL are:
> - When interface is setup, on scanning for the interface ipv6 address
>   check if at least one address is NOT in IFA_F_TENTATIVE state.
> - With interface already up but with still no LINK-LOCAL react on the
>   RTM_NEWADDR event and set LINK-LOCAL if the addrs added by the event
>   is a LINK-LOCAL reflecting that the interface finally ended the DAD
>   process and have a correct address.
>
> Signed-off-by: Christian Marangi 
> ---
>  src/config.c  |  9 +
>  src/netlink.c | 11 ++-
>  src/odhcpd.h  |  2 ++
>  src/router.c  |  6 ++
>  4 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/src/config.c b/src/config.c
> index 30da879..ee7219f 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -594,6 +594,15 @@ int config_parse_interface(void *data, size_t len, const 
> char *name, bool overwr
> if (len > 0)
> iface->addr6_len = len;
>
> +   for (size_t i = 0; i < iface->addr6_len; i++) {
> +   struct odhcpd_ipaddr *addr = &iface->addr6[i];
> +
> +   if (!addr->tentative) {
> +   iface->have_link_local = true;
> +   break;
> +   }
> +   }
> +
> len = netlink_get_interface_addrs(iface->ifindex,
> false, &iface->addr4);
> if (len > 0)
> diff --git a/src/netlink.c b/src/netlink.c
> index 4a352a6..0a2da03 100644
> --- a/src/netlink.c
> +++ b/src/netlink.c
> @@ -386,7 +386,7 @@ static int handle_rtm_addr(struct nlmsghdr *hdr, bool add)
>
> nla_memcpy(&event_info.addr, nla[IFA_ADDRESS], 
> sizeof(event_info.addr));
>
> -   if (IN6_IS_ADDR_LINKLOCAL(&event_info.addr) || 
> IN6_IS_ADDR_MULTICAST(&event_info.addr))
> +   if (IN6_IS_ADDR_MULTICAST(&event_info.addr))
> return NL_SKIP;
>
> inet_ntop(AF_INET6, &event_info.addr, buf, sizeof(buf));
> @@ -395,6 +395,11 @@ static int handle_rtm_addr(struct nlmsghdr *hdr, bool 
> add)
> if (iface->ifindex != (int)ifa->ifa_index)
> continue;
>
> +   if (add && IN6_IS_ADDR_LINKLOCAL(&event_info.addr)) {
> +   iface->have_link_local = true;
> +   return NL_SKIP;
> +   }
> +
> syslog(LOG_DEBUG, "Netlink %s %s on %s", add ? 
> "newaddr" : "deladdr",
> buf, iface->name);
>
> @@ -625,6 +630,10 @@ static int cb_addr_valid(struct nl_msg *msg, void *arg)
> if (ifa->ifa_flags & IFA_F_DEPRECATED)
> addrs[ctxt->ret].preferred = 0;
>
> +   if (ifa->ifa_family == AF_INET6 &&
> +   ifa->ifa_flags & IFA_F_TENTATIVE)
> +   addrs[ctxt->ret].tentative = true;
> +
> ctxt->ret++;
> *(ctxt->addrs) = addrs;
>
> diff --git a/src/odhcpd.h b/src/odhcpd.h
> index d829033..0550bc2 100644
> --- a/src/odhcpd.h
> +++ b/src/odhcpd.h
> @@ -131,6 +131,7 @@ struct odhcpd_ipaddr {
> struct {
> uint8_t dprefix;
> uint8_t invalid_advertisements;
> +   bool tentative;
> };
>
> /* ipv4 only */
> @@ -300,6 +301,7 @@ struct interface {
> bool ra_useleasetime;
> bool ra_dns;
> bool no_dynamic_dhcp;
> +   bool have_link

Re: [odhcpd PATCH 1/2] config: skip interface setup if interface not IFF_RUNNING

2023-03-18 Thread Hans Dedecker
On Fri, Mar 17, 2023 at 1:54 AM Christian Marangi  wrote:
>
> We currently setup odhcp service even if the interface is not running.
> This is the case for bridge or specific interface that are flagged as UP
> but have no carrier as nothing is connected to it.
> This cause a similar error like:
>
> Failed to send to ff02::1%br-lan (Address not available)
>
> This is caused by the kernel assigning IPV6 address only when the
> interface is set to IFF_RUNNING.
> A LINK-LOCAL IPV6 address is required for odhcpd_send() to work or every
> request will be rejected.
>
> To fix this setup services only when interface is in IFF_RUNNING state.
> When an interface change state, odhcpd is reloaded and the services are
> correctly setup again.
>
> Signed-off-by: Christian Marangi 
Acked-by: Hans Dedecker 
> ---
>  src/config.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/config.c b/src/config.c
> index 9b1f659..30da879 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -1303,7 +1303,7 @@ void odhcpd_reload(void)
>
>
> avl_for_each_element_safe(&interfaces, i, avl, tmp) {
> -   if (i->inuse) {
> +   if (i->inuse && i->ifflags & IFF_RUNNING) {
> /* Resolve hybrid mode */
> if (i->dhcpv6 == MODE_HYBRID)
> i->dhcpv6 = (master && master->dhcpv6 == 
> MODE_RELAY) ?
> --
> 2.39.2
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH odhcpd v2 2/2] router: always check ra_default

2023-02-17 Thread Hans Dedecker
On Thu, Feb 16, 2023 at 9:30 PM  wrote:
>
> We currently only check ra_default when an interface has valid
> addresses. This results in ra_default being ignored in case we have an
> interface with only link-local addresses. This effectively breaks the
> use of value 2 for the ra_default parameter.
>
> Fix this by always checking ra_lifetime, regardless of the interface
> having public addresses or not.
>
> Fixes: #11930
> Fixes: 83e14f455817 ("router: advertise removed addresses as invalid in 3 
> consecutive RAs")
> Signed-off-by: Stijn Tintel 
Acked-by:Hans Dedecker 
> ---
>  src/router.c | 15 +--
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/src/router.c b/src/router.c
> index 1c11849..7e66e3c 100644
> --- a/src/router.c
> +++ b/src/router.c
> @@ -488,6 +488,14 @@ static int send_router_advert(struct interface *iface, 
> const struct in6_addr *fr
> valid_addr_cnt = (iface->timer_rs.cb /* if not shutdown */ ? 
> iface->addr6_len : 0);
> invalid_addr_cnt = iface->invalid_addr6_len;
>
> +   // check ra_default
> +   if (iface->default_router) {
> +   default_route = true;
> +
> +   if (iface->default_router > 1)
> +   valid_prefix = true;
> +   }
> +
> if (valid_addr_cnt + invalid_addr_cnt) {
> addrs = alloca(sizeof(*addrs) * (valid_addr_cnt + 
> invalid_addr_cnt));
>
> @@ -495,12 +503,7 @@ static int send_router_advert(struct interface *iface, 
> const struct in6_addr *fr
> memcpy(addrs, iface->addr6, sizeof(*addrs) * 
> valid_addr_cnt);
>
> /* Check default route */
> -   if (iface->default_router) {
> -   default_route = true;
> -
> -   if (iface->default_router > 1)
> -   valid_prefix = true;
> -   } else if (parse_routes(addrs, valid_addr_cnt))
> +   if (!default_route && parse_routes(addrs, 
> valid_addr_cnt))
> default_route = true;
> }
>
> --
> 2.39.1
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH odhcpd v2 1/2] router: improve RA logging

2023-02-17 Thread Hans Dedecker
On Thu, Feb 16, 2023 at 9:30 PM  wrote:
>
> We only set the RA lifetime to what is configured in UCI when there is a
> default route and valid prefix. In any other case, we set it to 0. This
> leads to confusion where people believe ra_lifetime is completely
> ignored. In case there is a default route, but no valid prefix, a debug
> message explains this, but if there is no default route, we silently
> override ra_lifetime.
>
> Add a debug message for the latter case, and explicitly mention
> overriding ra_lifetime in both cases.
>
> Signed-off-by: Stijn Tintel 
Acked-by: Hans Dedecker 
> ---
>  src/router.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/src/router.c b/src/router.c
> index 949cbe7..1c11849 100644
> --- a/src/router.c
> +++ b/src/router.c
> @@ -618,17 +618,19 @@ static int send_router_advert(struct interface *iface, 
> const struct in6_addr *fr
> msecs = calc_adv_interval(iface, minvalid, &maxival);
> lifetime = calc_ra_lifetime(iface, maxival);
>
> -   if (default_route) {
> -   if (!valid_prefix) {
> -   syslog(LOG_WARNING, "A default route is present but 
> there is no public prefix "
> -   "on %s thus we don't announce a 
> default route!", iface->name);
> -   adv.h.nd_ra_router_lifetime = 0;
> -   } else
> -   adv.h.nd_ra_router_lifetime = htons(lifetime < 
> UINT16_MAX ? lifetime : UINT16_MAX);
> -
> -   } else
> +   if (default_route && valid_prefix) {
> +   adv.h.nd_ra_router_lifetime = htons(lifetime < UINT16_MAX ? 
> lifetime : UINT16_MAX);
> +   } else {
> adv.h.nd_ra_router_lifetime = 0;
>
> +   if (default_route) {
> +   syslog(LOG_WARNING, "A default route is present but 
> there is no public prefix "
> +   "on %s thus we don't announce a 
> default route by overriding ra_lifetime!", iface->name);
> +   } else {
> +   syslog(LOG_WARNING, "No default route present, 
> overriding ra_lifetime!");
> +   }
> +   }
> +
> syslog(LOG_DEBUG, "Using a RA lifetime of %d seconds on %s", 
> ntohs(adv.h.nd_ra_router_lifetime), iface->name);
>
> /* DNS options */
> --
> 2.39.1
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH odhcpd 2/2] router: always check ra_lifetime

2023-02-16 Thread Hans Dedecker
On Mon, Feb 13, 2023 at 9:18 PM  wrote:
>
> We currently only check ra_default when an interface has valid
> addresses. This results in ra_default being ignored in case we have an
> interface with only link-local addresses. This effectively breaks the
> use of value 2 for the ra_default parameter.
>
> Fix this by always checking ra_lifetime, regardless of the interface
> having public addresses or not.
>
> Fixes: #11930
> Fixes: 83e14f455817 ("router: advertise removed addresses as invalid in 3 
> consecutive RAs")
> Signed-off-by: Stijn Tintel 
Acked-by: Hans Dedecker 
> ---
>  src/router.c | 19 ---
>  1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/src/router.c b/src/router.c
> index 1c11849..21674f6 100644
> --- a/src/router.c
> +++ b/src/router.c
> @@ -488,6 +488,14 @@ static int send_router_advert(struct interface *iface, 
> const struct in6_addr *fr
> valid_addr_cnt = (iface->timer_rs.cb /* if not shutdown */ ? 
> iface->addr6_len : 0);
> invalid_addr_cnt = iface->invalid_addr6_len;
>
> +   // check ra_default
> +   if (iface->default_router) {
> +   default_route = true;
> +
> +   if (iface->default_router > 1)
> +   valid_prefix = true;
> +   }
> +
> if (valid_addr_cnt + invalid_addr_cnt) {
> addrs = alloca(sizeof(*addrs) * (valid_addr_cnt + 
> invalid_addr_cnt));
>
> @@ -495,13 +503,10 @@ static int send_router_advert(struct interface *iface, 
> const struct in6_addr *fr
> memcpy(addrs, iface->addr6, sizeof(*addrs) * 
> valid_addr_cnt);
>
> /* Check default route */
> -   if (iface->default_router) {
> -   default_route = true;
> -
> -   if (iface->default_router > 1)
> -   valid_prefix = true;
> -   } else if (parse_routes(addrs, valid_addr_cnt))
> -   default_route = true;
> +   if (!default_route) {
> +   if (parse_routes(addrs, valid_addr_cnt))
> +   default_route = true;
Small remark merge both if statements into one if statement
> +   }
> }
>
> if (invalid_addr_cnt) {
> --
> 2.39.1
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH odhcpd 1/2] router: improve RA logging

2023-02-16 Thread Hans Dedecker
On Mon, Feb 13, 2023 at 9:18 PM  wrote:
>
> We only set the RA lifetime to what is configured in UCI when there is a
> default route and valid prefix. In any other case, we set it to 0. This
> leads to confusion where people believe ra_lifetime is completely
> ignored. In case there is a default route, but no valid prefix, a debug
> message explains this, but if there is no default route, we silently
> override ra_lifetime.
>
> Add a debug message for the latter case, and explicitly mention
> overriding ra_lifetime in both cases.
>
> Signed-off-by: Stijn Tintel 

Acked-by: Hans Dedecker 
>
> ---
>  src/router.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/src/router.c b/src/router.c
> index 949cbe7..1c11849 100644
> --- a/src/router.c
> +++ b/src/router.c
> @@ -618,17 +618,19 @@ static int send_router_advert(struct interface *iface, 
> const struct in6_addr *fr
> msecs = calc_adv_interval(iface, minvalid, &maxival);
> lifetime = calc_ra_lifetime(iface, maxival);
>
> -   if (default_route) {
> -   if (!valid_prefix) {
> -   syslog(LOG_WARNING, "A default route is present but 
> there is no public prefix "
> -   "on %s thus we don't announce a 
> default route!", iface->name);
> -   adv.h.nd_ra_router_lifetime = 0;
> -   } else
> -   adv.h.nd_ra_router_lifetime = htons(lifetime < 
> UINT16_MAX ? lifetime : UINT16_MAX);
> -
> -   } else
> +   if (default_route && valid_prefix) {
> +   adv.h.nd_ra_router_lifetime = htons(lifetime < UINT16_MAX ? 
> lifetime : UINT16_MAX);
> +   } else {
> adv.h.nd_ra_router_lifetime = 0;
>
> +   if (default_route) {
> +   syslog(LOG_WARNING, "A default route is present but 
> there is no public prefix "
> +   "on %s thus we don't announce a 
> default route by overriding ra_lifetime!", iface->name);
> +   } else {
> +   syslog(LOG_WARNING, "No default route present, 
> overriding ra_lifetime!");
> +   }
> +   }
> +
> syslog(LOG_DEBUG, "Using a RA lifetime of %d seconds on %s", 
> ntohs(adv.h.nd_ra_router_lifetime), iface->name);
>
> /* DNS options */
> --
> 2.39.1
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v3] netifd: add devtype to ubus call

2022-01-10 Thread Hans Dedecker
On Mon, Jan 10, 2022 at 4:55 PM Florian Eckert  wrote:
>
> Hello Hans,
>
> thanks for you review.
>
> >> +--- a/system.h
> >>  b/system.h
> >> +@@ -23,6 +23,42 @@
> >> + #include "iprule.h"
> >> + #include "utils.h"
> >> +
> >> ++static const unsigned short netdev_type_number[] = {
> >> ++  ARPHRD_NETROM, ARPHRD_ETHER, ARPHRD_EETHER, ARPHRD_AX25,
> >> ++  ARPHRD_PRONET, ARPHRD_CHAOS, ARPHRD_IEEE802, ARPHRD_ARCNET,
> >> ++  ARPHRD_APPLETLK, ARPHRD_DLCI, ARPHRD_ATM, ARPHRD_METRICOM,
> >> ++  ARPHRD_IEEE1394, ARPHRD_EUI64, ARPHRD_INFINIBAND, ARPHRD_SLIP,
> >> ++  ARPHRD_CSLIP, ARPHRD_SLIP6, ARPHRD_CSLIP6, ARPHRD_RSRVD,
> >> ++  ARPHRD_ADAPT, ARPHRD_ROSE, ARPHRD_X25, ARPHRD_HWX25,
> >> ++  ARPHRD_PPP, ARPHRD_CISCO, ARPHRD_LAPB, ARPHRD_DDCMP,
> >> ++  ARPHRD_RAWHDLC, ARPHRD_TUNNEL, ARPHRD_TUNNEL6, ARPHRD_FRAD,
> >> ++  ARPHRD_SKIP, ARPHRD_LOOPBACK, ARPHRD_LOCALTLK, ARPHRD_FDDI,
> >> ++  ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE,
> >> ++  ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET,
> >> ++  ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL,
> >> ++  ARPHRD_FCFABRIC, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM,
> >> ++  ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, ARPHRD_PHONET_PIPE,
> >> ++  ARPHRD_IEEE802154, ARPHRD_VOID, ARPHRD_NONE
> >> ++};
> >> ++
> >> ++static const char *const netdev_type_name[] = {
> >> ++  "netrom", "ethernet", "eethernet", "ax25",
> >> ++  "pronet", "chaos", "ieee802", "arcnet",
> >> ++  "appletlk", "dlci", "atm", "metricom",
> >> ++  "ieee1394", "eui64", "infiniband", "slip",
> >> ++  "cslip", "slip6", "cslip6", "rsrvd",
> >> ++  "adapt", "rose", "x25", "hwx25",
> >> ++  "ppp", "cisco", "lapb", "ddcmp",
> >> ++  "rawhdlc", "tunnel", "tunnel6", "frad",
> >> ++  "skip", "loopback", "localtlk", "fddi",
> >> ++  "bif", "sit", "ipddp", "ipgre",
> >> ++  "pimreg", "hippi", "ash", "econet",
> >> ++  "irda", "fcpp", "fcal", "fcpl",
> >> ++  "fcfabric", "ieee80211", "ie80211-prism",
> >> ++  "ieee80211-radiotap", "phonet", "phonet-pipe",
> >> ++  "ieee802154", "void", "none"
> >> ++};
> > Merge these two arrays into one array, each entry having the netdev
> > type number and the corresponding string.
> > Implement a function which uses the array and takes as argument the
> > netdev type number and returns the corresponding string
>
> I am not quite sure if I have understood this correctly.
> If you take a look at the include where the ARPHRD are defined.
> https://elixir.bootlin.com/linux/v5.16-rc1/source/include/uapi/linux/if_arp.h
> Then the array must have 65535 entries ARPHRD_VOID is at position
> 0x.
> That's quite a lot for the fact that there are 58 ids.
>
> This is the code I would use?
>
> static const char * const netdev_type[] = {
>   [ARPHRD_NETROM] = "netrom",
>   [ARPHRD_ETHER] = "ethernet",
> ...
> ...
> };
>
> Or should I define an array of netdev_type structs?
This is indeed what I had in mind

Hans
>
> struct netdev_type {
>const char *name;
>unsigned short number;
> };
>
> #define DEV_TYPE(_name, _number) \
> {\
>.name = _name, \
>.number = _number  \
> }\
>
>
> static const struct netdev_type netdev_types[] = {
> {
>DEV_TYPE("netrom", ARPHRD_NETROM),
>DEV_TYPE("ethernet", ARPHRD_ETHER),
> ...
> ...
> };
>
> Best Regards
> Florian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v3] netifd: add devtype to ubus call

2021-12-25 Thread Hans Dedecker
Hi Florian,

Can you create the patch against the netifd repo ?
Further comments inline

Hans

On Thu, Dec 9, 2021 at 4:18 PM Florian Eckert  wrote:
>
> Every network device has a type. There is no standard interface here.
> The type can be determined either from the file
> '/sys/class/net//uevent' or, if no information is found
> there, from the file '/sys/class/net//type'.
>
> This new function first checks whether there is a DEVTYPE= sring in
> the 'uevent' file and uses it. If it does not find this information,
> the 'type' is used as a fallback and mapped the number to a character
> sequence.
>
> This new 'devtype' information can be found in the network.device ubus
> call.
>
> Command:
> ubus call network.device status
>
> Output:
> {
> "eth0": {
> "devtype": "ethernet",
>
> Signed-off-by: Florian Eckert 
> ---
> v2:
>   - Remove debug log output
> v3:
>   - Use the information mainly from file 'uevnet'.
>   - If 'uevent' does not provide the information use file 'type'
>  ...-system-linux-add-interface-protocol.patch | 107 ++
>  1 file changed, 107 insertions(+)
>  create mode 100644 
> package/network/config/netifd/patches/001-system-linux-add-interface-protocol.patch
>
> diff --git 
> a/package/network/config/netifd/patches/001-system-linux-add-interface-protocol.patch
>  
> b/package/network/config/netifd/patches/001-system-linux-add-interface-protocol.patch
> new file mode 100644
> index 00..62662b3df3
> --- /dev/null
> +++ 
> b/package/network/config/netifd/patches/001-system-linux-add-interface-protocol.patch
> @@ -0,0 +1,107 @@
> +--- a/system-linux.c
>  b/system-linux.c
> +@@ -2395,6 +2395,50 @@ system_if_force_external(const char *ifn
> +   return stat(dev_sysfs_path(ifname, "phy80211"), &s) == 0;
> + }
> +
> ++static inline unsigned short
> ++system_netdevtype_to_pos(unsigned short dev_type)
> ++{
> ++  int i;
> ++
> ++  for (i = 0; i < ARRAY_SIZE(netdev_type_number); i++)
> ++  if (netdev_type_number[i] == dev_type)
> ++  return i;
> ++  /* the last key is used by default */
> ++  return ARRAY_SIZE(netdev_type_number) - 1;
> ++}
> ++
> ++static void
> ++system_add_devtype(struct blob_buf *b, const char *ifname)
> ++{
> ++  char buf[100];
> ++  bool found = false;
> ++
> ++  if (!system_get_dev_sysfs("uevent", ifname, buf, sizeof(buf))) {
> ++  const char *info = "DEVTYPE=";
> ++  char* context = NULL;
> ++  const char *line = strtok_r(buf, "\r\n", &context);
> ++  while( line != NULL ) {
nitpick: keep coding style consistent by using a white space after
while and before the bracket
> ++  char *index = strstr(line, info);
> ++  if(index != NULL) {
nitpick: use a white space after if
> ++  blobmsg_add_string(b, "devtype", index + 
> strlen(info));
> ++  found = true;
> ++  break;
> ++  }
> ++  line = strtok_r(NULL, "\r\n", &context);
> ++  }
> ++  }
> ++
> ++  if (!found) {
> ++  int i;
> ++  unsigned short number = 0;
> ++  if (!system_get_dev_sysfs("type", ifname, buf, sizeof(buf))) {
> ++  number = strtoul(buf, NULL, 0);
> ++  i = system_netdevtype_to_pos(number);
> ++  blobmsg_add_string(b, "devtype", netdev_type_name[i]);
> ++  }
> ++  }
> ++}
> ++
> + int
> + system_if_dump_info(struct device *dev, struct blob_buf *b)
> + {
> +@@ -2430,6 +2474,8 @@ system_if_dump_info(struct device *dev,
> +   blobmsg_add_u8(b, "autoneg", !!ecmd.autoneg);
> +   }
> +
> ++  system_add_devtype(b, dev->ifname);
> ++
> +   return 0;
> + }
> +
> +--- a/system.h
>  b/system.h
> +@@ -23,6 +23,42 @@
> + #include "iprule.h"
> + #include "utils.h"
> +
> ++static const unsigned short netdev_type_number[] = {
> ++  ARPHRD_NETROM, ARPHRD_ETHER, ARPHRD_EETHER, ARPHRD_AX25,
> ++  ARPHRD_PRONET, ARPHRD_CHAOS, ARPHRD_IEEE802, ARPHRD_ARCNET,
> ++  ARPHRD_APPLETLK, ARPHRD_DLCI, ARPHRD_ATM, ARPHRD_METRICOM,
> ++  ARPHRD_IEEE1394, ARPHRD_EUI64, ARPHRD_INFINIBAND, ARPHRD_SLIP,
> ++  ARPHRD_CSLIP, ARPHRD_SLIP6, ARPHRD_CSLIP6, ARPHRD_RSRVD,
> ++  ARPHRD_ADAPT, ARPHRD_ROSE, ARPHRD_X25, ARPHRD_HWX25,
> ++  ARPHRD_PPP, ARPHRD_CISCO, ARPHRD_LAPB, ARPHRD_DDCMP,
> ++  ARPHRD_RAWHDLC, ARPHRD_TUNNEL, ARPHRD_TUNNEL6, ARPHRD_FRAD,
> ++  ARPHRD_SKIP, ARPHRD_LOOPBACK, ARPHRD_LOCALTLK, ARPHRD_FDDI,
> ++  ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE,
> ++  ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET,
> ++  ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL,
> ++  ARPHRD_FCFABRIC, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM,
> ++  ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, ARPHRD_PHONET_PIPE,

Re: [PATCH 2/2] interface-ip: copy more info for target host route

2021-11-28 Thread Hans Dedecker
On Tue, Nov 23, 2021 at 3:06 AM  wrote:
>
> From: Luiz Angelo Daros de Luca 
>
> interface_ip_add_target_route was adding a host route without
> copying other confs like type, source, online). The result was that this:
>
>   unreachable 192.168.0.9  metric 123
>
> was being converted to:
>
>   192.168.0.9 dev lo scope link  metric 123
>
> valid_until is still not copied but I'm not sure if it is needed as this
> route might get updated when the source route is refreshed/expired.
>
> Signed-off-by: Luiz Angelo Daros de Luca 
> ---
>  interface-ip.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/interface-ip.c b/interface-ip.c
> index 7b63ef9..6fdbf18 100644
> --- a/interface-ip.c
> +++ b/interface-ip.c
> @@ -300,12 +300,17 @@ interface_ip_add_target_route(union if_addr *addr, bool 
> v6, struct interface *if
> return NULL;
>
> route->flags = v6 ? DEVADDR_INET6 : DEVADDR_INET4;
> +   route->flags |= r->next & (DEVROUTE_MTU | DEVROUTE_METRIC |
> +   DEVROUTE_TYPE | DEVROUTE_ONLINK | DEVROUTE_TABLE);
The patch fails to compile :
route->flags |= r->next & (DEVROUTE_MTU | DEVROUTE_METRIC |
 | ^
interface-ip.c:303:25: note: each undeclared identifier is reported
only once for each function it appears in
interface-ip.c: At top level:

Hans
> route->mask = v6 ? 128 : 32;
> memcpy(&route->addr, addr, addrsize);
> memcpy(&route->nexthop, &r_next->nexthop, sizeof(route->nexthop));
> route->mtu = r_next->mtu;
> route->metric = r_next->metric;
> route->table = r_next->table;
> +   route->type = r_next->type;
> +   memcpy(&route->source, &r_next->source, addrsize);
> +   route->sourcemask = r_next->sourcemask;
> route->iface = iface;
> vlist_add(&iface->host_routes, &route->node, route);
>
> --
> 2.33.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: OpenWrt 21.02 status

2021-07-19 Thread Hans Dedecker
Hi Hauke,

On Mon, Jul 19, 2021 at 8:05 PM Hauke Mehrtens  wrote:
>
> Hi Hans,
>
> On 7/17/21 5:45 PM, Hauke Mehrtens wrote:
> > Hi,
> >
> > In general the 21.02-rc3 looks good, but we still have some problems.
> >
> > Currently we still have these problem:
>
> 
>
> > - DHCPv6 broken if lease times < 12h chosen
> >- 
> > https://forum.openwrt.org/t/openwrt-21-02-0-third-release-candidate/99363/137
> >- 
> > https://forum.openwrt.org/t/openwrt-21-02-0-third-release-candidate/99363/162
> 
>
> Should this commit fix the "DHCPv6 broken if lease times < 12h chosen"
> problem?
> https://git.openwrt.org/4633471d74589c761a3849bd63935b42ac3cea73
Correct this fixes the issue if the leasetime is smaller than the
preferred lifetime of an address

Hans
>
> Hauke

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH netifd] config: support bridge designed UCI section

2021-05-12 Thread Hans Dedecker
On Tue, May 11, 2021 at 7:14 PM Rafał Miłecki  wrote:
>
> From: Rafał Miłecki 
>
> Network layer 2 devices should have their own UCI section types. They
> differ so much that each device type requires a custom handling anyway.
> Currently there is "type" option used to distinguish them while UCI
> supports different section types right for that purpose. This change
> will result in cleaner UCI and UI code.
>
> Example UCI section:
>
> config bridge
> option name 'foo'
> list ports 'lan1'
> list ports 'lan2'
>
> While introducing this new bridge section a new option was added for
> storing bridge port names: "ports". It's clearer than previously used
> "ifname". A simple validation code is present to make sure "ports" is
> used and contains a list of ports.
>
> Signed-off-by: Rafał Miłecki 
Acked-by: Hans Dedecker 
> ---
>  bridge.c | 14 +-
>  config.c | 52 
>  2 files changed, 61 insertions(+), 5 deletions(-)
>
> diff --git a/bridge.c b/bridge.c
> index 099dfe4..ce49a74 100644
> --- a/bridge.c
> +++ b/bridge.c
> @@ -23,7 +23,8 @@
>  #include "system.h"
>
>  enum {
> -   BRIDGE_ATTR_IFNAME,
> +   BRIDGE_ATTR_PORTS,
> +   BRIDGE_ATTR_IFNAME, /* Deprecated */
> BRIDGE_ATTR_STP,
> BRIDGE_ATTR_FORWARD_DELAY,
> BRIDGE_ATTR_PRIORITY,
> @@ -44,6 +45,7 @@ enum {
>  };
>
>  static const struct blobmsg_policy bridge_attrs[__BRIDGE_ATTR_MAX] = {
> +   [BRIDGE_ATTR_PORTS] = { "ports", BLOBMSG_TYPE_ARRAY },
> [BRIDGE_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_ARRAY },
> [BRIDGE_ATTR_STP] = { "stp", BLOBMSG_TYPE_BOOL },
> [BRIDGE_ATTR_FORWARD_DELAY] = { "forward_delay", BLOBMSG_TYPE_INT32 },
> @@ -104,7 +106,7 @@ struct bridge_state {
>
> struct blob_attr *config_data;
> struct bridge_config config;
> -   struct blob_attr *ifnames;
> +   struct blob_attr *ports;
> bool active;
> bool force_active;
> bool has_vlans;
> @@ -853,8 +855,8 @@ bridge_config_init(struct device *dev)
>
> bst->n_failed = 0;
> vlist_update(&bst->members);
> -   if (bst->ifnames) {
> -   blobmsg_for_each_attr(cur, bst->ifnames, rem) {
> +   if (bst->ports) {
> +   blobmsg_for_each_attr(cur, bst->ports, rem) {
> bridge_add_member(bst, blobmsg_data(cur));
> }
> }
> @@ -970,7 +972,9 @@ bridge_reload(struct device *dev, struct blob_attr *attr)
> if (tb_dev[DEV_ATTR_MACADDR])
> bst->primary_port = NULL;
>
> -   bst->ifnames = tb_br[BRIDGE_ATTR_IFNAME];
> +   bst->ports = tb_br[BRIDGE_ATTR_PORTS];
> +   if (!bst->ports)
> +   bst->ports = tb_br[BRIDGE_ATTR_IFNAME];
> device_init_settings(dev, tb_dev);
> bridge_apply_settings(bst, tb_br);
>
> diff --git a/config.c b/config.c
> index fa7cbe4..4cc5a61 100644
> --- a/config.c
> +++ b/config.c
> @@ -223,6 +223,57 @@ config_parse_rule(struct uci_section *s, bool v6)
> iprule_add(blob_data(b.head), v6);
>  }
>
> +/**
> + * config_init_bridges - create bridges for new syntax UCI sections
> + *
> + * The new syntax uses dedicated UCI "bridge" sections for describing 
> bridges.
> + * They use "ports" list instead of "ifname" for specifying bridge ports.
> + */
> +static void config_init_bridges()
> +{
> +   struct uci_element *e;
> +
> +   uci_foreach_element(&uci_network->sections, e) {
> +   struct uci_section *s = uci_to_section(e);
> +   struct device_type *devtype;
> +   struct uci_option *o;
> +   struct device *dev;
> +   const char *name;
> +
> +   if (strcmp(s->type, "bridge"))
> +   continue;
> +
> +   name = uci_lookup_option_string(uci_ctx, s, "name");
> +   if (!name)
> +   continue;
> +
> +   devtype = device_type_get("bridge");
> +   if (!devtype)
> +   continue;
> +
> +   config_fixup_bridge_vlan_filtering(s, name);
> +   o = uci_lookup_option(uci_ctx, s, "ifname");
> +   if (o) {
> +   netifd_log_message(L_WARNING, "Unsupported \"ifname\" 
> bridge option\n");
> +  

Re: [PATCH] odhcpd: add option to use absolute timestamps

2021-02-06 Thread Hans Dedecker
On Sat, Jan 30, 2021 at 5:33 PM Nick Hainke  wrote:
>
> Until now it is not possible to give absolute timestamps in odhcpd.
> This means that on every new RA or request, the timestamp is renewed.
> Further, the valid and preferred lifetimes are not synced between all
> devices.
>
> There are several usecases when it is needed to have absolute timestamp
> that needed to be synced across all devices, e.g. your ISP delegates
> you a prefix for some certain time, or you want to change to another
> prefix.
>
> The purpose of having this as a absolute timestamp is to make it easier
> to track. An example configuration is
>
>   option absolute_lifetime '1'
>   option valid_lifetime '05 Jan 2021 23:00:00'
>   option preferred_lifetime '05 Jan 2021 23:00:00'
>
> If the valid_lifetime is in the past, the preferred lifetime and valid
> lifetime are set to 1 minute.
I have my reservations about the patch as it requires knowledge of
absolute time on devices.
This is a problem as not all devices have a RTC; or the time needs to
be synchronized with a wan NTP server.
This is also the reason why netifd does not to support absolute
lifetimes for configured prefixes

Hans
>
> Signed-off-by: Nick Hainke 
> ---
>  README  |  8 --
>  src/config.c| 69 ++---
>  src/dhcpv6-ia.c | 10 +++
>  src/odhcpd.h|  1 +
>  4 files changed, 65 insertions(+), 23 deletions(-)
>
> diff --git a/README b/README
> index f9cbb11..0af5c75 100644
> --- a/README
> +++ b/README
> @@ -107,11 +107,13 @@ dns_service   bool1 
>   Announce the address of interface as DNS service
> if the list of dns is 
> empty
>  domain list   Search domains to 
> announce
>
> -leasetime  string  12h DHCPv4 address 
> leasetime
> +leasetime  string  12h DHCPv4 address 
> leasetime. If absolute_lifetime is
> +   set the value can be 
> given as a date, e.g. "10 Jan 2020 00:00:00".
>  start  integer 100 DHCPv4 pool start
>  limit  integer 150 DHCPv4 pool size
>  preferred_lifetime string  12h Value for the 
> preferred lifetime
> -   for a prefix
> +   for a prefix. If 
> absolute_lifetime is set the value can
> +   be given as a date, 
> e.g. "10 Jan 2020 00:00:00".
>  ra_default integer 0   Override default route
> 0: default, 1: ignore no public address, 2: ignore all
>  ra_flags   listother-configList of RA flags to be
> @@ -145,6 +147,8 @@ ndproxy_slave   bool0 
>   NDProxy external slave
>  prefix_filter  string  ::/0Only advertise 
> on-link prefixes within
> [IPv6 prefix]   the provided IPv6 
> prefix; others are
> filtered out.
> +absolute_lifetime  bool0   Interpret 
> configured lifetime as
> +   absolute timestamps. 
> The format has to be "10 Jan 2020 00:00:00".
>
>
>  Sections of type host (static leases)
> diff --git a/src/config.c b/src/config.c
> index 78b5855..42f73a1 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -8,6 +8,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>  #include 
> @@ -83,6 +84,7 @@ enum {
> IFACE_ATTR_NDPROXY_SLAVE,
> IFACE_ATTR_PREFIX_FILTER,
> IFACE_ATTR_PREFERRED_LIFETIME,
> +   IFACE_ATTR_ABSOLUTE_LIFETIME,
> IFACE_ATTR_MAX
>  };
>
> @@ -132,6 +134,7 @@ static const struct blobmsg_policy 
> iface_attrs[IFACE_ATTR_MAX] = {
> [IFACE_ATTR_NDPROXY_SLAVE] = { .name = "ndproxy_slave", .type = 
> BLOBMSG_TYPE_BOOL },
> [IFACE_ATTR_PREFIX_FILTER] = { .name = "prefix_filter", .type = 
> BLOBMSG_TYPE_STRING },
> [IFACE_ATTR_PREFERRED_LIFETIME] = { .name = "preferred_lifetime", 
> .type = BLOBMSG_TYPE_STRING },
> +   [IFACE_ATTR_ABSOLUTE_LIFETIME] = { .name = "absolute_lifetime", .type 
> = BLOBMSG_TYPE_BOOL },
>  };
>
>  static const struct uci_blob_param_info iface_attr_info[IFACE_ATTR_MAX] = {
> @@ -212,6 +215,7 @@ static void set_interface_defaults(struct interface 
> *iface)
> iface->ra_mininterval = iface->ra_maxinterval/3;
> iface->ra_lifetime = -1;
> iface->ra_dns = true;
> +   iface->absolute_lifetime = false;
>  }
>
>  static void clean_interface(struct interface *iface)
> @@ -321,29 +325,48 @@ static void set_config(struct uci_section *s)
> }

[PATCH netifd v2] interface-ip: fix ipv6 routing loop

2021-01-03 Thread Hans Dedecker
In case of prefix delegation an upstream ISP will route the complete
delegated prefix (e.g 2001:DB8:BEEF::/56) to an OpenWrt device, OpenWrt
will route back the complete /56 not matching a local or subdelegated
prefix and with as source an address from the delegated prefix
causing a routing loop.
Fix this by using an ip rule which directs traffic matching the
subdelegated prefix and coming from the wan interface to the main or
user configured routing table.
An ip rule with lower priority will make sure the traffic not matching
the subdelegated prefix(es) will be dropped with an ICMPv6 unreachable
fixing the potential routing loop.

This will result into the following typical IPv6 rules :

0:  from all lookup local
3:  from all to 2001:DB8:BEEF::/64 iif eth4 lookup main
30001:  from all to 2001:DB8:BEEF::/56 iif eth4 unreachable
32766:  from all lookup main
42: from 2001:DB8:BEEF::1/64 iif br-lan unreachable
420001: from all iif lo failed_policy
420011: from all iif eth0 failed_policy
420015: from all iif eth4 failed_policy
420015: from all iif eth4 failed_policy
420019: from all iif br-lan failed_policy

Signed-off-by: Hans Dedecker 
---
v2: Keep unreachable route in the routing table dropping traffic from the lan 
not matching any routing rules with an ICMPv6 unreachable

 interface-ip.c | 77 ++
 iprule.h   | 10 ---
 2 files changed, 71 insertions(+), 16 deletions(-)

diff --git a/interface-ip.c b/interface-ip.c
index 024c5b8..8a68340 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -903,6 +903,8 @@ interface_set_prefix_address(struct 
device_prefix_assignment *assignment,
const struct device_prefix *prefix, struct interface *iface, 
bool add)
 {
const struct interface *uplink = prefix->iface;
+   unsigned int rt_table_id;
+
if (!iface->l3_dev.dev)
return;
 
@@ -935,9 +937,21 @@ interface_set_prefix_address(struct 
device_prefix_assignment *assignment,
addr.mask < 64 ? 64 : addr.mask, 
iface->ip6table, NULL, NULL, false);
 
if (prefix->iface) {
-   if (prefix->iface->ip6table)
+   rt_table_id = prefix->iface->ip6table;
+
+   if (rt_table_id)
set_ip_source_policy(false, true, 
IPRULE_PRIORITY_NW, &addr.addr,
-   addr.mask, 
prefix->iface->ip6table, iface, NULL, true);
+   addr.mask, rt_table_id, iface, 
NULL, true);
+
+   if (!rt_table_id)
+   system_resolve_rt_table("main", &rt_table_id);
+
+   /*
+* Remove ip rule allowing traffic coming from the 
prefix
+* interface and directed to the sub delegated prefix
+*/
+   set_ip_source_policy(false, true, 
IPRULE_PRIORITY_SUB_PREFIX, &addr.addr,
+   addr.mask, rt_table_id, 
prefix->iface, NULL, false);
 
set_ip_source_policy(false, true, 
IPRULE_PRIORITY_REJECT, &addr.addr,
addr.mask, 0, iface, 
"unreachable", true);
@@ -972,12 +986,25 @@ interface_set_prefix_address(struct 
device_prefix_assignment *assignment,
addr.mask < 64 ? 64 : 
addr.mask, iface->ip6table, NULL, NULL, false);
 
if (prefix->iface) {
+   rt_table_id = prefix->iface->ip6table;
+
set_ip_source_policy(true, true, 
IPRULE_PRIORITY_REJECT, &addr.addr,
addr.mask, 0, iface, 
"unreachable", true);
 
-   if (prefix->iface->ip6table)
+   if (rt_table_id)
set_ip_source_policy(true, true, 
IPRULE_PRIORITY_NW, &addr.addr,
-   addr.mask, 
prefix->iface->ip6table, iface, NULL, true);
+   addr.mask, rt_table_id, 
iface, NULL, true);
+
+   if (!rt_table_id)
+   system_resolve_rt_table("main", 
&rt_table_id);
+
+   /*
+* Add ip rule allowing traffic coming from the 
prefix
+* interface and directed to the sub delegated 
prefix
+*/
+   set_ip_source_policy(true, true, 
IPRULE_P

Re: [PATCH] odhcpd: add option for setting preferred lifetime

2021-01-02 Thread Hans Dedecker
On Fri, Jan 1, 2021 at 9:15 PM  wrote:
>
> From: Nick Hainke 
>
> "valid_lft" and "preferred_lft" are different. If the "preferred_lft"
> is expired the prefix should be avoided in source prefix selection.
> However, the interface is allowed to still receive downstream traffic.
>
> ra_use_preferred_lft:
>   Value for the preferred lifetime for a prefix
Do we really need an extra config option to indicate a configured
preferred lifetime needs to be used ?
Can't we just initialize preferred_lifetime to 43200 and just check
for ra_useleasetime in router.c when setting the preferred lifetime ?
>
> ra_preferred_lft:
>   Use the limit for preferred lifetime of a prefix
This is confusing to prefix the config option with ra as it's used
both for RA and DHCPv6; I would just call it preferred_lifetime
>
> If only "useleasetime" is set odhcpd will still set the "preferred_lft"
> to the leasetime. If "ra_use_preferred_lft" is also set the
> "preferred_lft" will be set to "ra_preferred_lft".
>
> Signed-off-by: Nick Hainke 
> ---
>  README  |  4 
>  src/config.c| 15 +++
>  src/dhcpv6-ia.c | 20 
>  src/odhcpd.h|  3 +++
>  src/router.c|  4 
>  5 files changed, 42 insertions(+), 4 deletions(-)
>
> diff --git a/README b/README
> index a34a93c..6a5c6cf 100644
> --- a/README
> +++ b/README
> @@ -129,6 +129,10 @@ ra_lifetimeinteger 1800  
>   Value to be placed in Router
>  ra_useleasetimebool0   Use 
> configured leasetime as
> limit for the 
> preferred and
> valid lifetime of a 
> prefix
> +ra_preferred_lft   string  12h Value for the preferred 
> lifetime
> +   for a prefix
> +ra_use_preferred_lft   bool0   Use the limit for preferred
> +   lifetime of a prefix
>  ra_reachabletime   integer 0   Reachable Time in 
> milliseconds to be
> advertised in RA 
> messages
>  ra_retranstime integer 0   Retransmit Time in 
> milliseconds to be
> diff --git a/src/config.c b/src/config.c
> index 015a716..cb06dfe 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -82,6 +82,8 @@ enum {
> IFACE_ATTR_NDPROXY_ROUTING,
> IFACE_ATTR_NDPROXY_SLAVE,
> IFACE_ATTR_PREFIX_FILTER,
> +   IFACE_ATTR_RA_USE_PREFERRED_LFT,
> +   IFACE_ATTR_RA_PREFERRED_LFT,
> IFACE_ATTR_MAX
>  };
>
> @@ -130,6 +132,8 @@ static const struct blobmsg_policy 
> iface_attrs[IFACE_ATTR_MAX] = {
> [IFACE_ATTR_NDPROXY_ROUTING] = { .name = "ndproxy_routing", .type = 
> BLOBMSG_TYPE_BOOL },
> [IFACE_ATTR_NDPROXY_SLAVE] = { .name = "ndproxy_slave", .type = 
> BLOBMSG_TYPE_BOOL },
> [IFACE_ATTR_PREFIX_FILTER] = { .name = "prefix_filter", .type = 
> BLOBMSG_TYPE_STRING },
> +   [IFACE_ATTR_RA_USE_PREFERRED_LFT] = { .name = "ra_use_preferred_lft", 
> .type = BLOBMSG_TYPE_BOOL },
> +   [IFACE_ATTR_RA_PREFERRED_LFT] = { .name = "ra_preferred_lft", .type = 
> BLOBMSG_TYPE_STRING },
>  };
>
>  static const struct uci_blob_param_info iface_attr_info[IFACE_ATTR_MAX] = {
> @@ -525,6 +529,14 @@ int config_parse_interface(void *data, size_t len, const 
> char *name, bool overwr
> iface->dhcp_leasetime = time;
> }
>
> +   if ((c = tb[IFACE_ATTR_RA_PREFERRED_LFT])) {
> +   double time = parse_leasetime(c);
> +   if (time < 0)
> +   goto err;
> +
> +   iface->ra_preferred_lft = time;
> +   }
> +
> if ((c = tb[IFACE_ATTR_START])) {
> iface->dhcpv4_start.s_addr = htonl(blobmsg_get_u32(c));
> iface->dhcpv4_end.s_addr = 
> htonl(ntohl(iface->dhcpv4_start.s_addr) +
> @@ -795,6 +807,9 @@ int config_parse_interface(void *data, size_t len, const 
> char *name, bool overwr
> if ((c = tb[IFACE_ATTR_RA_USELEASETIME]))
> iface->ra_useleasetime = blobmsg_get_bool(c);
>
> +   if ((c = tb[IFACE_ATTR_RA_USE_PREFERRED_LFT]))
> +   iface->ra_use_preferred_lft = blobmsg_get_bool(c);
> +
> if ((c = tb[IFACE_ATTR_RA_DNS]))
> iface->ra_dns = blobmsg_get_bool(c);
>
> diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
> index d7848de..8fffeb7 100644
> --- a/src/dhcpv6-ia.c
> +++ b/src/dhcpv6-ia.c
> @@ -247,6 +247,9 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct 
> dhcp_assignment *c,
> addr.s6_addr32[2] = addr.s6_addr32[3] = 0;
> }
>
> +   if (pref > (uint32_t)c->preferred_until)
> +   pref = c->preferred_until;
> +
> if (pref > (uint32_t)c->valid_until)
> 

[PATCH] [netifd] interface-ip: fix ipv6 routing loop

2021-01-01 Thread Hans Dedecker
In case of prefix delegation an upstream ISP will route the complete
delegated prefix (e.g 2001:DB8:BEEF::/56) to an OpenWrt device, OpenWrt
will route back the complete /56 not matching a local or subdelegated
prefix casusing a routing loop.
Fix this by using an ip rule which directs traffic matching the
subdelegated prefix and coming from the wan interface to the main or
user configured routing table.
An ip rule with lower priority will make sure the traffic not matching
the subdelegated prefix(es) will be dropped with an ICMPv6 unreachable
fixing the potential routing loop.
This also makes the unreachable route for the delegated prefix in the
routing table superfluous; before this change the unreachable route was
inefficient as it was overshadowed by the default route installed by
the protocol handler scripts.

This will result into the following typical IPv6 rules :

0:  from all lookup local
3:  from all to 2001:DB8:BEEF::/64 iif eth4 lookup main
30001:  from all to 2001:DB8:BEEF::/56 iif eth4 unreachable
32766:  from all lookup main
42: from 2001:DB8:BEEF::1/64 iif br-lan unreachable
420001: from all iif lo failed_policy
420011: from all iif eth0 failed_policy
420015: from all iif eth4 failed_policy
420015: from all iif eth4 failed_policy
420019: from all iif br-lan failed_policy

Signed-off-by: Hans Dedecker 
---
 interface-ip.c | 70 --
 iprule.h   | 10 +---
 2 files changed, 57 insertions(+), 23 deletions(-)

diff --git a/interface-ip.c b/interface-ip.c
index 024c5b8..91f7e8e 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -903,6 +903,8 @@ interface_set_prefix_address(struct 
device_prefix_assignment *assignment,
const struct device_prefix *prefix, struct interface *iface, 
bool add)
 {
const struct interface *uplink = prefix->iface;
+   unsigned int rt_table_id;
+
if (!iface->l3_dev.dev)
return;
 
@@ -935,9 +937,21 @@ interface_set_prefix_address(struct 
device_prefix_assignment *assignment,
addr.mask < 64 ? 64 : addr.mask, 
iface->ip6table, NULL, NULL, false);
 
if (prefix->iface) {
-   if (prefix->iface->ip6table)
+   rt_table_id = prefix->iface->ip6table;
+
+   if (rt_table_id)
set_ip_source_policy(false, true, 
IPRULE_PRIORITY_NW, &addr.addr,
-   addr.mask, 
prefix->iface->ip6table, iface, NULL, true);
+   addr.mask, rt_table_id, iface, 
NULL, true);
+
+   if (!rt_table_id)
+   system_resolve_rt_table("main", &rt_table_id);
+
+   /*
+* Remove ip rule allowing traffic coming from the 
prefix
+* interface and directed to the sub delegated prefix
+*/
+   set_ip_source_policy(false, true, 
IPRULE_PRIORITY_SUB_PREFIX, &addr.addr,
+   addr.mask, rt_table_id, 
prefix->iface, NULL, false);
 
set_ip_source_policy(false, true, 
IPRULE_PRIORITY_REJECT, &addr.addr,
addr.mask, 0, iface, 
"unreachable", true);
@@ -972,12 +986,25 @@ interface_set_prefix_address(struct 
device_prefix_assignment *assignment,
addr.mask < 64 ? 64 : 
addr.mask, iface->ip6table, NULL, NULL, false);
 
if (prefix->iface) {
+   rt_table_id = prefix->iface->ip6table;
+
set_ip_source_policy(true, true, 
IPRULE_PRIORITY_REJECT, &addr.addr,
addr.mask, 0, iface, 
"unreachable", true);
 
-   if (prefix->iface->ip6table)
+   if (rt_table_id)
set_ip_source_policy(true, true, 
IPRULE_PRIORITY_NW, &addr.addr,
-   addr.mask, 
prefix->iface->ip6table, iface, NULL, true);
+   addr.mask, rt_table_id, 
iface, NULL, true);
+
+   if (!rt_table_id)
+   system_resolve_rt_table("main", 
&rt_table_id);
+
+   /*
+* Add ip rule allowing traffic coming from the 
prefix
+* interface and directed to the sub delegated 
prefix
+*/
+   set_ip_source_policy(true, tr

Re: [PATCH] glibc: add arc700 patch

2020-12-26 Thread Hans Dedecker
Hi,

On Fri, Dec 25, 2020 at 1:37 AM Rosen Penev  wrote:
>
> glibc does not officially support ARC700 so this adds the missing
> pieces. I looked at uClibc-ng and a patch by Synopsis for glibc.
>
> ran make toolchain/glibc/refresh to clean up fuzz.
>
> Signed-off-by: Rosen Penev 
> ---
>  toolchain/glibc/common.mk |  2 +-
>  ...use-of-DES-encryption-functions-in-n.patch | 87 +++
>  .../glibc/patches/100-fix_cross_rpcgen.patch  |  1 +
>  toolchain/glibc/patches/300-arc.patch | 55 
Will the ARC700 patch be pushed upstream ?

Hans
>  4 files changed, 87 insertions(+), 58 deletions(-)
>  create mode 100644 toolchain/glibc/patches/300-arc.patch
>
> diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk
> index faf749eea3..555bd19a61 100644
> --- a/toolchain/glibc/common.mk
> +++ b/toolchain/glibc/common.mk
> @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=glibc
>  PKG_VERSION:=2.32
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>
>  PKG_SOURCE_PROTO:=git
>  PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
> diff --git 
> a/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
>  
> b/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
> index 002e7a1770..10d9f65d18 100644
> --- 
> a/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
> +++ 
> b/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
> @@ -23,11 +23,9 @@ provides them.
>   sunrpc/des_soft.c  |   2 +-
>   13 files changed, 305 insertions(+), 90 deletions(-)
>
> -diff --git a/conform/data/stdlib.h-data b/conform/data/stdlib.h-data
> -index 6913828196..d8f2fb 100644
>  --- a/conform/data/stdlib.h-data
>  +++ b/conform/data/stdlib.h-data
> -@@ -149,6 +149,9 @@ function {unsigned short int*} seed48 (unsigned short 
> int[3])
> +@@ -149,6 +149,9 @@ function {unsigned short int*} seed48 (u
>   #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && 
> !defined XPG4 && !defined XPG42 && !defined UNIX98
>   function int setenv (const char*, const char*, int)
>   #endif
> @@ -37,8 +35,6 @@ index 6913828196..d8f2fb 100644
>   #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && 
> !defined POSIX && !defined POSIX2008
>   function {char*} setstate (char*)
>   #endif
> -diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data
> -index aa070528e8..ddf4f25132 100644
>  --- a/conform/data/unistd.h-data
>  +++ b/conform/data/unistd.h-data
>  @@ -437,6 +437,9 @@ function int chroot (const char*)
> @@ -61,8 +57,6 @@ index aa070528e8..ddf4f25132 100644
>   function int execl (const char*, const char*, ...)
>   function int execle (const char*, const char*, ...)
>   function int execlp (const char*, const char*, ...)
> -diff --git a/crypt/cert.c b/crypt/cert.c
> -index e070ca398d..80029e9078 100644
>  --- a/crypt/cert.c
>  +++ b/crypt/cert.c
>  @@ -10,22 +10,6 @@
> @@ -102,8 +96,6 @@ index e070ca398d..80029e9078 100644
>  -}
>  -
>  -#endif
> -diff --git a/crypt/crypt-entry.c b/crypt/crypt-entry.c
> -index 502b5846f0..09332c690a 100644
>  --- a/crypt/crypt-entry.c
>  +++ b/crypt/crypt-entry.c
>  @@ -35,7 +35,6 @@
> @@ -114,7 +106,7 @@ index 502b5846f0..09332c690a 100644
>
>   /* Prototypes for local functions.  */
>   #ifndef __GNU_LIBRARY__
> -@@ -177,7 +176,17 @@ crypt (const char *key, const char *salt)
> +@@ -177,7 +176,17 @@ crypt (const char *key, const char *salt
> return __crypt_r (key, salt, &_ufc_foobar);
>   }
>
> @@ -134,8 +126,6 @@ index 502b5846f0..09332c690a 100644
>  +  return crypt (key, salt);
>  +}
>   #endif
> -diff --git a/crypt/crypt.h b/crypt/crypt.h
> -index ca8ad456cc..7d0de95018 100644
>  --- a/crypt/crypt.h
>  +++ b/crypt/crypt.h
>  @@ -36,6 +36,14 @@ __BEGIN_DECLS
> @@ -168,8 +158,6 @@ index ca8ad456cc..7d0de95018 100644
>   #endif
>
>   __END_DECLS
> -diff --git a/crypt/crypt_util.c b/crypt/crypt_util.c
> -index 4b2f0a89cb..b012cde6bd 100644
>  --- a/crypt/crypt_util.c
>  +++ b/crypt/crypt_util.c
>  @@ -34,7 +34,6 @@
> @@ -196,7 +184,7 @@ index 4b2f0a89cb..b012cde6bd 100644
>
>   /*
>* This is the final
> -@@ -788,7 +785,6 @@ _ufc_output_conversion_r (ufc_long v1, ufc_long v2, 
> const char *salt,
> +@@ -788,7 +785,6 @@ _ufc_output_conversion_r (ufc_long v1, u
> __data->crypt_3_buf[13] = 0;
>   }
>
> @@ -204,7 +192,7 @@ index 4b2f0a89cb..b012cde6bd 100644
>
>   /*
>* UNIX encrypt function. Takes a bitvector
> -@@ -889,14 +885,12 @@ __encrypt_r (char *__block, int __edflag,
> +@@ -889,14 +885,12 @@ __encrypt_r (char *__block, int __edflag
> }
>   }
>   weak_alias (__encrypt_r, encrypt_r)
> @@ -219,7 +207,7 @@ index 4b2f0a89cb..b012cde6bd 100644
>
>
>   /*
> -@@ -921,15 +915,12 @@ __setkey_r (const char *__key, struct crypt_data * 
> __restrict __data)
> +@@ -921,15 +915,12 @@ __setkey_r (const char *__key, struct cr
> _ufc_mk_keytab_r((char *) ktab, __data

Re: [PATCH] netifd: add segment routing support

2020-12-13 Thread Hans Dedecker
On Sat, Dec 12, 2020 at 9:51 PM  wrote:
>
> From: Nick Hainke 
>
> seg6_enabled - Bool
>   Accept or drop SR-enabled IPv6 packets on this interface.
>
> More Information:
> https://www.kernel.org/doc/html/latest/networking/seg6-sysctl.html
>
> Now you can set as interface option
>   option ip6segmentrouting '1'
>
> It is not enough to turn on "seg6_enabled" on the interface. Further,
> we have to enable "/all/seg6_enabled". This means that a working config
> is "interface + all".
>
> Signed-off-by: Nick Hainke 
Patch applied with some minor tweaks
(https://git.openwrt.org/?p=project/netifd.git;a=commit;h=458b1a7e9473c150a40cae5d8be174f4bb03bd39);
thx

Hans
> ---
>  device.c   | 21 +
>  device.h   |  5 +
>  system-linux.c | 22 ++
>  3 files changed, 48 insertions(+)
>
> diff --git a/device.c b/device.c
> index 73cc4bf..7145788 100644
> --- a/device.c
> +++ b/device.c
> @@ -36,6 +36,7 @@ static const struct blobmsg_policy 
> dev_attrs[__DEV_ATTR_MAX] = {
> [DEV_ATTR_TXQUEUELEN] = { .name = "txqueuelen", .type = 
> BLOBMSG_TYPE_INT32 },
> [DEV_ATTR_ENABLED] = { .name = "enabled", .type = BLOBMSG_TYPE_BOOL },
> [DEV_ATTR_IPV6] = { .name = "ipv6", .type = BLOBMSG_TYPE_BOOL },
> +   [DEV_ATTR_IP6SEGMENTROUTING] = { .name = "ip6segmentrouting", .type = 
> BLOBMSG_TYPE_BOOL },
> [DEV_ATTR_PROMISC] = { .name = "promisc", .type = BLOBMSG_TYPE_BOOL },
> [DEV_ATTR_RPFILTER] = { .name = "rpfilter", .type = 
> BLOBMSG_TYPE_STRING },
> [DEV_ATTR_ACCEPTLOCAL] = { .name = "acceptlocal", .type = 
> BLOBMSG_TYPE_BOOL },
> @@ -230,6 +231,7 @@ device_merge_settings(struct device *dev, struct 
> device_settings *n)
> (s->flags & (DEV_OPT_MACADDR|DEV_OPT_DEFAULT_MACADDR) ? 
> s->macaddr : os->macaddr),
> sizeof(n->macaddr));
> n->ipv6 = s->flags & DEV_OPT_IPV6 ? s->ipv6 : os->ipv6;
> +   n->ip6segmentrouting = s->flags & DEV_OPT_IP6SEGMENTROUTING ? 
> s->ip6segmentrouting : os->ip6segmentrouting;
> n->promisc = s->flags & DEV_OPT_PROMISC ? s->promisc : os->promisc;
> n->rpfilter = s->flags & DEV_OPT_RPFILTER ? s->rpfilter : 
> os->rpfilter;
> n->acceptlocal = s->flags & DEV_OPT_ACCEPTLOCAL ? s->acceptlocal : 
> os->acceptlocal;
> @@ -299,6 +301,11 @@ device_init_settings(struct device *dev, struct 
> blob_attr **tb)
> s->flags |= DEV_OPT_IPV6;
> }
>
> +   if ((cur = tb[DEV_ATTR_IP6SEGMENTROUTING])) {
> +   s->ip6segmentrouting = blobmsg_get_bool(cur);
> +   s->flags |= DEV_OPT_IP6SEGMENTROUTING;
> +   }
> +
> if ((cur = tb[DEV_ATTR_PROMISC])) {
> s->promisc = blobmsg_get_bool(cur);
> s->flags |= DEV_OPT_PROMISC;
> @@ -844,6 +851,18 @@ device_init_pending(void)
> }
>  }
>
> +bool
> +check_ip6segmentrouting(void)
> +{
> +   struct device *dev, *tmp;
> +   bool ip6segmentrouting = false;
> +
> +   avl_for_each_element_safe(&devices, dev, avl, tmp) {
> +   ip6segmentrouting |= dev->settings.ip6segmentrouting;
> +   }
> +   return ip6segmentrouting;
> +}
> +
>  static enum dev_change_type
>  device_set_config(struct device *dev, struct device_type *type,
>   struct blob_attr *attr)
> @@ -1053,6 +1072,8 @@ device_dump_status(struct blob_buf *b, struct device 
> *dev)
> blobmsg_add_u32(b, "txqueuelen", st.txqueuelen);
> if (st.flags & DEV_OPT_IPV6)
> blobmsg_add_u8(b, "ipv6", st.ipv6);
> +   if (st.flags & DEV_OPT_IP6SEGMENTROUTING)
> +   blobmsg_add_u8(b, "ip6segmentrouting", 
> st.ip6segmentrouting);
> if (st.flags & DEV_OPT_PROMISC)
> blobmsg_add_u8(b, "promisc", st.promisc);
> if (st.flags & DEV_OPT_RPFILTER)
> diff --git a/device.h b/device.h
> index ab5a162..6ee439d 100644
> --- a/device.h
> +++ b/device.h
> @@ -53,6 +53,7 @@ enum {
> DEV_ATTR_SENDREDIRECTS,
> DEV_ATTR_NEIGHLOCKTIME,
> DEV_ATTR_ISOLATE,
> +   DEV_ATTR_IP6SEGMENTROUTING,
> __DEV_ATTR_MAX,
>  };
>
> @@ -107,6 +108,7 @@ enum {
> DEV_OPT_SENDREDIRECTS   = (1 << 21),
> DEV_OPT_NEIGHLOCKTIME   = (1 << 22),
> DEV_OPT_ISOLATE = (1 << 23),
> +   DEV_OPT_IP6SEGMENTROUTING   = (1 << 24),
>  };
>
>  /* events broadcasted to all users of a device */
> @@ -173,6 +175,7 @@ struct device_settings {
> bool learning;
> bool unicast_flood;
> bool sendredirects;
> +   bool ip6segmentrouting;
> bool isolate;
>  };
>
> @@ -320,4 +323,6 @@ device_set_disabled(struct device *dev, bool value)
> device_refresh_present(dev);
>  }
>
> +bool check_ip6segmentrouting(void);
> +
>  #endif
> diff --git a/system-linux.c b/system-linux.c
> index bf746f9..53a02e9 100644
> --- a/system-linux

Re: [PATCH] netifd: add segment routing support

2020-12-12 Thread Hans Dedecker
Hi,

On Wed, Dec 2, 2020 at 3:33 PM  wrote:
>
> From: Nick Hainke 
>
> seg6_enabled - Bool
>   Accept or drop SR-enabled IPv6 packets on this interface.
>
> More Information:
> https://www.kernel.org/doc/html/latest/networking/seg6-sysctl.html
>
> Now you can set as interface option
>   option ip6segmentrouting '1'
>
> It is not enough to turn on "seg6_enabled" on the interface. Further,
> we have to enable "/all/seg6_enabled". This means that a working config
> is "interface + all".
>
> Signed-off-by: Nick Hainke 
The patch does not apply anymore on latest master; could you resend it
based on latest master ?

Thx
Hans
> ---
>  device.c   | 21 +
>  device.h   |  5 +
>  system-linux.c | 22 ++
>  3 files changed, 48 insertions(+)
>
> diff --git a/device.c b/device.c
> index 3e2b5e9..ba61a54 100644
> --- a/device.c
> +++ b/device.c
> @@ -41,6 +41,7 @@ static const struct blobmsg_policy 
> dev_attrs[__DEV_ATTR_MAX] = {
> [DEV_ATTR_TXQUEUELEN] = { .name = "txqueuelen", .type = 
> BLOBMSG_TYPE_INT32 },
> [DEV_ATTR_ENABLED] = { .name = "enabled", .type = BLOBMSG_TYPE_BOOL },
> [DEV_ATTR_IPV6] = { .name = "ipv6", .type = BLOBMSG_TYPE_BOOL },
> +   [DEV_ATTR_IP6SEGMENTROUTING] = { .name = "ip6segmentrouting", .type = 
> BLOBMSG_TYPE_BOOL },
> [DEV_ATTR_PROMISC] = { .name = "promisc", .type = BLOBMSG_TYPE_BOOL },
> [DEV_ATTR_RPFILTER] = { .name = "rpfilter", .type = 
> BLOBMSG_TYPE_STRING },
> [DEV_ATTR_ACCEPTLOCAL] = { .name = "acceptlocal", .type = 
> BLOBMSG_TYPE_BOOL },
> @@ -228,6 +229,7 @@ device_merge_settings(struct device *dev, struct 
> device_settings *n)
> (s->flags & DEV_OPT_MACADDR ? s->macaddr : os->macaddr),
> sizeof(n->macaddr));
> n->ipv6 = s->flags & DEV_OPT_IPV6 ? s->ipv6 : os->ipv6;
> +   n->ip6segmentrouting = s->flags & DEV_OPT_IP6SEGMENTROUTING ? 
> s->ip6segmentrouting : os->ip6segmentrouting;
> n->promisc = s->flags & DEV_OPT_PROMISC ? s->promisc : os->promisc;
> n->rpfilter = s->flags & DEV_OPT_RPFILTER ? s->rpfilter : 
> os->rpfilter;
> n->acceptlocal = s->flags & DEV_OPT_ACCEPTLOCAL ? s->acceptlocal : 
> os->acceptlocal;
> @@ -297,6 +299,11 @@ device_init_settings(struct device *dev, struct 
> blob_attr **tb)
> s->flags |= DEV_OPT_IPV6;
> }
>
> +   if ((cur = tb[DEV_ATTR_IP6SEGMENTROUTING])) {
> +   s->ip6segmentrouting = blobmsg_get_bool(cur);
> +   s->flags |= DEV_OPT_IP6SEGMENTROUTING;
> +   }
> +
> if ((cur = tb[DEV_ATTR_PROMISC])) {
> s->promisc = blobmsg_get_bool(cur);
> s->flags |= DEV_OPT_PROMISC;
> @@ -826,6 +833,18 @@ device_init_pending(void)
> }
>  }
>
> +bool
> +check_ip6segmentrouting(void)
> +{
> +   struct device *dev, *tmp;
> +   bool ip6segmentrouting = false;
> +
> +   avl_for_each_element_safe(&devices, dev, avl, tmp) {
> +   ip6segmentrouting |= dev->settings.ip6segmentrouting;
> +   }
> +   return ip6segmentrouting;
> +}
> +
>  static enum dev_change_type
>  device_set_config(struct device *dev, struct device_type *type,
>   struct blob_attr *attr)
> @@ -1035,6 +1054,8 @@ device_dump_status(struct blob_buf *b, struct device 
> *dev)
> blobmsg_add_u32(b, "txqueuelen", st.txqueuelen);
> if (st.flags & DEV_OPT_IPV6)
> blobmsg_add_u8(b, "ipv6", st.ipv6);
> +   if (st.flags & DEV_OPT_IP6SEGMENTROUTING)
> +   blobmsg_add_u8(b, "ip6segmentrouting", 
> st.ip6segmentrouting);
> if (st.flags & DEV_OPT_PROMISC)
> blobmsg_add_u8(b, "promisc", st.promisc);
> if (st.flags & DEV_OPT_RPFILTER)
> diff --git a/device.h b/device.h
> index b2b18ab..6b898e5 100644
> --- a/device.h
> +++ b/device.h
> @@ -53,6 +53,7 @@ enum {
> DEV_ATTR_SENDREDIRECTS,
> DEV_ATTR_NEIGHLOCKTIME,
> DEV_ATTR_ISOLATE,
> +   DEV_ATTR_IP6SEGMENTROUTING,
> __DEV_ATTR_MAX,
>  };
>
> @@ -106,6 +107,7 @@ enum {
> DEV_OPT_SENDREDIRECTS   = (1 << 21),
> DEV_OPT_NEIGHLOCKTIME   = (1 << 22),
> DEV_OPT_ISOLATE = (1 << 23),
> +   DEV_OPT_IP6SEGMENTROUTING   = (1 << 24),
>  };
>
>  /* events broadcasted to all users of a device */
> @@ -172,6 +174,7 @@ struct device_settings {
> bool learning;
> bool unicast_flood;
> bool sendredirects;
> +   bool ip6segmentrouting;
> bool isolate;
>  };
>
> @@ -319,4 +322,6 @@ device_set_disabled(struct device *dev, bool value)
> device_refresh_present(dev);
>  }
>
> +bool check_ip6segmentrouting(void);
> +
>  #endif
> diff --git a/system-linux.c b/system-linux.c
> index 1d5d232..1d1cf8d 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -304,6 +304,11 @@ static void system

Re: odhcp6c RENEW timeout issue leads to OOM/OOPS [Was: Re: QEMU x86/64 ubus issues ... ]

2020-12-04 Thread Hans Dedecker
On Fri, Dec 4, 2020 at 11:45 AM Petr Štetiar  wrote:
>
> Hans Dedecker  [2020-12-03 21:18:11]:
>
> Hi,
>
> > Looking into the new pcap capture I must admit I've never seen such a DHCPv6
> > server with such weird behavior.
>
> it's OpenWrt so odhcpd.
Could you run odhcpd with loglevel 7 as I would like to understand
what triggers the numerous transmission of the Reconfigure messages

Thx
Hans
>
> -- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: odhcp6c RENEW timeout issue leads to OOM/OOPS [Was: Re: QEMU x86/64 ubus issues ... ]

2020-12-03 Thread Hans Dedecker
On Wed, Dec 2, 2020 at 9:25 PM Petr Štetiar  wrote:
>
> Hans Dedecker  [2020-12-01 21:12:30]:
>
> Hi,
>
> > Can you check if commit
> > https://git.openwrt.org/?p=project/odhcp6c.git;a=commit;h=a7b2221f687264c020b7a18a4e690d79f312a667
> > fixes the issue in your setup ?
>
> yes, it seems so as it's currently almost 24h up without any issues.
Thank you for testing !
Looking into the new pcap capture I must admit I've never seen such a
DHCPv6 server with such weird behavior.

Hans
>
> > While doing the test can you put odhcp6c into verbose mode (-v) and
> > take again a pcap trace on the wan ?
>
> http://ynezz.true.cz/openwrt/odhcp6c/capture-2020-12-02.pcap.gz
> http://ynezz.true.cz/openwrt/odhcp6c/syslog-2020-12-02.log.gz
>
> Thanks!
>
> Cheers,
>
> Petr

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: odhcp6c RENEW timeout issue leads to OOM/OOPS [Was: Re: QEMU x86/64 ubus issues ... ]

2020-12-01 Thread Hans Dedecker
Hi Petr,

On Sat, Nov 28, 2020 at 8:48 PM Hans Dedecker  wrote:
>
> Hi,
>
> On Sat, Nov 28, 2020 at 5:04 PM Petr Štetiar  wrote:
> >
> > Hans Dedecker  [2020-11-26 21:19:30]:
> >
> > Hi,
> >
> > > Is it possible to have a pcap trace of the DHCPv6 messages on the wan ?
> > > I hope to find some time next weekend to investigate the issue further
> >
> > http://ynezz.true.cz/openwrt/odhcp6c/capture.pcap.gz#
> Thank you for the traces; looking into the DHCPv6 packets make the issue 
> clear.
> Packet 22 is a DHCPv6 reply packet in response to a renew which in its
> turn is triggered by a DHCPv6 reconfigure packet.
> The packet contains an IA-PD option but no IA prefix option which is
> strange. According to the DHCPv6 RFC renew messages must be kept
> sending when T1 has expired for either an IA address or IA prefix when
> the server does not reply the IA address or IA prefix which is
> happening in this case.
> I will do further investigation how we could protect odhpc6c against
> such DHCPv6 server behavior
Can you check if commit
https://git.openwrt.org/?p=project/odhcp6c.git;a=commit;h=a7b2221f687264c020b7a18a4e690d79f312a667
fixes the issue in your setup ?
While doing the test can you put odhcp6c into verbose mode (-v) and
take again a pcap trace on the wan ?

Hans
>
> Hans
> >
> > Cheers,
> >
> > Petr

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: odhcp6c RENEW timeout issue leads to OOM/OOPS [Was: Re: QEMU x86/64 ubus issues ... ]

2020-11-28 Thread Hans Dedecker
Hi,

On Sat, Nov 28, 2020 at 5:04 PM Petr Štetiar  wrote:
>
> Hans Dedecker  [2020-11-26 21:19:30]:
>
> Hi,
>
> > Is it possible to have a pcap trace of the DHCPv6 messages on the wan ?
> > I hope to find some time next weekend to investigate the issue further
>
> http://ynezz.true.cz/openwrt/odhcp6c/capture.pcap.gz#
Thank you for the traces; looking into the DHCPv6 packets make the issue clear.
Packet 22 is a DHCPv6 reply packet in response to a renew which in its
turn is triggered by a DHCPv6 reconfigure packet.
The packet contains an IA-PD option but no IA prefix option which is
strange. According to the DHCPv6 RFC renew messages must be kept
sending when T1 has expired for either an IA address or IA prefix when
the server does not reply the IA address or IA prefix which is
happening in this case.
I will do further investigation how we could protect odhpc6c against
such DHCPv6 server behavior

Hans
>
> Cheers,
>
> Petr

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: odhcp6c RENEW timeout issue leads to OOM/OOPS [Was: Re: QEMU x86/64 ubus issues ... ]

2020-11-26 Thread Hans Dedecker
Hi Petr

On Thu, Nov 26, 2020 at 9:58 AM Petr Štetiar  wrote:
>
> Hi Hans,
>
> I've tried to ping you on IRC few days ago as I've found some strange issue
> with odhcp6c which leads to OOM/OOPS[1] (log with just the important parts).
> It simply happens every time after about 10 hours for me when I boot the 
> system
> in QEMU and have LAN/WAN networks connected there.
>
> It looks like that RENEW retry timeout is being decremented from 13060s down 
> to
> 1s during those few hours, then it goes in the crazy loop and it seems to 
> trash
> the machine completely, sometimes OOMs, sometimes OOPS and reboots due to the
> squashfs issues.
Thank you for the traces;it looks like the reply message in response
to the renew message does not update the renew time which is strange.
Is it possible to have a pcap trace of the DHCPv6 messages on the wan ?
I hope to find some time next weekend to investigate the issue further

Hans
>
> Nothing is happening on that machine, I just boot it and then let it idle.
>
> I've also uploaded complete unfiltered syslog[2] for you.  I'm able to
> reproduce it easily, so happy to help test the fix.
>
> This is on latest and greatest master, x86/64 in QEMU. Thanks!
>
> 1. http://sprunge.us/vv0Idx
> 2. http://ynezz.true.cz/openwrt/odhcp6c/syslog.log.gz
>
> Cheers,
>
> Petr

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH netifd] interface-ip: Normalise prefix address using netmask before using it

2020-11-25 Thread Hans Dedecker
Hi,

On Wed, Nov 25, 2020 at 6:36 PM Daniel Gröber  wrote:
>
> When a proto registers a prefix with an address which has bits outside the
> netmask set this confuses the prefix-assignment code further down the line.
>
> For example if we have an interface with
>
> option ip6prefix fdff:::::1/48
>
> and a couple with
>
> option ip6assign 64
>
> then all these interfaces will be assigned fdff:::::1/64 which
> is obviously wrong, they should at least have unique prefixes.
>
> What is happening here is that we simply OR the calculated assignment part
> into the address in interface_set_prefix_address:961, like so:
>
> addr.addr.in6.s6_addr32[1] |= htonl(assignment->assigned);
>
> but we never masked the host address bits out of the address after parsing
> it using inet_pton. To fix this we simply mask away the host bits in the
> address before using it.
This is fixed in netifd by commit
https://git.openwrt.org/?p=project/netifd.git;a=commitdiff;h=645ceed0ed706b073edd6a0d5a2eb936208b48c9

Hans
>
> Signed-off-by: Daniel Gröber 
> ---
>  interface-ip.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/interface-ip.c b/interface-ip.c
> index 6efc3c5..e8f2dbd 100644
> --- a/interface-ip.c
> +++ b/interface-ip.c
> @@ -1294,6 +1294,8 @@ interface_ip_add_device_prefix(struct interface *iface, 
> struct in6_addr *addr,
> prefix->iface = iface;
> INIT_LIST_HEAD(&prefix->assignments);
>
> +   clear_if_addr((union if_addr *)&prefix->addr, prefix->length);
> +
> if (excl_addr) {
> prefix->excl_addr = *excl_addr;
> prefix->excl_length = excl_length;
> --
> 2.20.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] netifd: add possibility to switch off route config

2020-11-23 Thread Hans Dedecker
On Mon, Nov 23, 2020 at 12:08 PM Florian Eckert  wrote:
>
> This change adds the new configuration option `disabled` for the route
> section, which can be used to temporarily disable the section so that
> the route is not set. The advantage is that I do not have to delete the
> whole configuration to achieve this.
>
> config route
>   option disabled '1
>
> Signed-off-by: Florian Eckert 
> ---
>  .../patches/001-make-route-disable.patch  | 29 +++
>  1 file changed, 29 insertions(+)
>  create mode 100644 
> package/network/config/netifd/patches/001-make-route-disable.patch
Patch needs to be submitted as a patch on the netifd git repo not as a
separate patch on the OpenWrt git repo
>
> diff --git 
> a/package/network/config/netifd/patches/001-make-route-disable.patch 
> b/package/network/config/netifd/patches/001-make-route-disable.patch
> new file mode 100644
> index 00..8184449e4e
> --- /dev/null
> +++ b/package/network/config/netifd/patches/001-make-route-disable.patch
> @@ -0,0 +1,29 @@
> +--- a/interface-ip.c
>  b/interface-ip.c
> +@@ -49,6 +49,7 @@ enum {
> +   ROUTE_ONLINK,
> +   ROUTE_TYPE,
> +   ROUTE_PROTO,
> ++  ROUTE_DISABLED,
> +   __ROUTE_MAX
> + };
> +
> +@@ -65,6 +66,7 @@ static const struct blobmsg_policy route
> +   [ROUTE_ONLINK] = { .name = "onlink", .type = BLOBMSG_TYPE_BOOL },
> +   [ROUTE_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING },
> +   [ROUTE_PROTO] = { .name = "proto", .type = BLOBMSG_TYPE_STRING },
> ++  [ROUTE_DISABLED] = { .name = "disabled", .type = BLOBMSG_TYPE_BOOL },
> + };
> +
> + const struct uci_blob_param_list route_attr_list = {
> +@@ -400,6 +402,10 @@ interface_ip_add_route(struct interface
> +
> +   blobmsg_parse(route_attr, __ROUTE_MAX, tb, blobmsg_data(attr), 
> blobmsg_data_len(attr));
> +
> ++  if ((cur = tb[ROUTE_DISABLED]) != NULL && blobmsg_get_bool(cur)) {
> ++  return;
> ++  }
Respect existing code style; no curly brackets around single line statements

Hans
> ++
> +   if (!iface) {
> +   if ((cur = tb[ROUTE_INTERFACE]) == NULL)
> +   return;
> --
> 2.20.1
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 1/2] kernel: Remove support for MAP-E FMRs RFC 7597

2020-11-22 Thread Hans Dedecker
Hi Hauke,

On Sun, Nov 22, 2020 at 12:33 AM Hauke Mehrtens  wrote:
>
> I am not aware that any user space code uses this feature in OpenWrt and
> maintaining this patch costs some effort especially when we add a new
> kernel major version.
The map package supports the creation of map-e interfaces
(https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/ipv6/map/files/map.sh;h=652c3065e3da10d917e182914b653babf09d8e3e;hb=HEAD#l76);
netifd as well has support for the creation of map-e interfaces
(https://git.openwrt.org/?p=project/netifd.git;a=blob;f=system-linux.c;h=78455aeab38d4a97161b11ec910275b050568dea;hb=HEAD#l2620)
I don't know how widely used map-e is but if the patch is removed we
should aw well clean up user space.

Hans
>
> This patch was originally introduced in commit 32246436147f ("Add kernel
> support for MAP-E FMRs") in May 2014 and implements (parts?) or MAP-E
> FMRs (draft-ietf-softwire-map-10) which is now RFC 7597
>
> If you still need this feature also try to get this into mainline Linux.
>
> Signed-off-by: Hauke Mehrtens 
> ---
>  ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 501 --
>  1 file changed, 501 deletions(-)
>  delete mode 100644 
> target/linux/generic/pending-5.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
>
> diff --git 
> a/target/linux/generic/pending-5.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
>  
> b/target/linux/generic/pending-5.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
> deleted file mode 100644
> index 8bcca1c4d159..
> --- 
> a/target/linux/generic/pending-5.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch
> +++ /dev/null
> @@ -1,501 +0,0 @@
> -From: Steven Barth 
> -Subject: Add support for MAP-E FMRs (mesh mode)
> -
> -MAP-E FMRs (draft-ietf-softwire-map-10) are rules for IPv4-communication
> -between MAP CEs (mesh mode) without the need to forward such data to a
> -border relay. This is similar to how 6rd works but for IPv4 over IPv6.
> -
> -Signed-off-by: Steven Barth 
> 
> - include/net/ip6_tunnel.h   |  13 ++
> - include/uapi/linux/if_tunnel.h |  13 ++
> - net/ipv6/ip6_tunnel.c  | 276 
> +++--
> - 3 files changed, 291 insertions(+), 11 deletions(-)
> -
>  a/include/net/ip6_tunnel.h
> -+++ b/include/net/ip6_tunnel.h
> -@@ -18,6 +18,18 @@
> - /* determine capability on a per-packet basis */
> - #define IP6_TNL_F_CAP_PER_PACKET 0x4
> -
> -+/* IPv6 tunnel FMR */
> -+struct __ip6_tnl_fmr {
> -+  struct __ip6_tnl_fmr *next; /* next fmr in list */
> -+  struct in6_addr ip6_prefix;
> -+  struct in_addr ip4_prefix;
> -+
> -+  __u8 ip6_prefix_len;
> -+  __u8 ip4_prefix_len;
> -+  __u8 ea_len;
> -+  __u8 offset;
> -+};
> -+
> - struct __ip6_tnl_parm {
> -   char name[IFNAMSIZ];/* name of tunnel device */
> -   int link;   /* ifindex of underlying L2 interface */
> -@@ -29,6 +41,7 @@ struct __ip6_tnl_parm {
> -   __u32 flags;/* tunnel flags */
> -   struct in6_addr laddr;  /* local tunnel end-point address */
> -   struct in6_addr raddr;  /* remote tunnel end-point address */
> -+  struct __ip6_tnl_fmr *fmrs; /* FMRs */
> -
> -   __be16  i_flags;
> -   __be16  o_flags;
>  a/include/uapi/linux/if_tunnel.h
> -+++ b/include/uapi/linux/if_tunnel.h
> -@@ -77,10 +77,23 @@ enum {
> -   IFLA_IPTUN_ENCAP_DPORT,
> -   IFLA_IPTUN_COLLECT_METADATA,
> -   IFLA_IPTUN_FWMARK,
> -+  IFLA_IPTUN_FMRS,
> -   __IFLA_IPTUN_MAX,
> - };
> - #define IFLA_IPTUN_MAX(__IFLA_IPTUN_MAX - 1)
> -
> -+enum {
> -+  IFLA_IPTUN_FMR_UNSPEC,
> -+  IFLA_IPTUN_FMR_IP6_PREFIX,
> -+  IFLA_IPTUN_FMR_IP4_PREFIX,
> -+  IFLA_IPTUN_FMR_IP6_PREFIX_LEN,
> -+  IFLA_IPTUN_FMR_IP4_PREFIX_LEN,
> -+  IFLA_IPTUN_FMR_EA_LEN,
> -+  IFLA_IPTUN_FMR_OFFSET,
> -+  __IFLA_IPTUN_FMR_MAX,
> -+};
> -+#define IFLA_IPTUN_FMR_MAX (__IFLA_IPTUN_FMR_MAX - 1)
> -+
> - enum tunnel_encap_types {
> -   TUNNEL_ENCAP_NONE,
> -   TUNNEL_ENCAP_FOU,
>  a/net/ipv6/ip6_tunnel.c
> -+++ b/net/ipv6/ip6_tunnel.c
> -@@ -11,6 +11,9 @@
> -  *  linux/net/ipv6/sit.c and linux/net/ipv4/ipip.c
> -  *
> -  *  RFC 2473
> -+ *
> -+ *  Changes:
> -+ *  Steven Barth :   MAP-E FMR support
> -  */
> -
> - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -@@ -67,9 +70,9 @@ static bool log_ecn_error = true;
> - module_param(log_ecn_error, bool, 0644);
> - MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
> -
> --static u32 HASH(const struct in6_addr *addr1, const struct in6_addr *addr2)
> -+static u32 HASH(const struct in6_addr *addr)
> - {
> --  u32 hash = ipv6_addr_hash(addr1) ^ ipv6_addr_hash(addr2);
> -+  u32 hash = ipv6_addr_hash(addr);
> -
> -   return hash_32(hash, IP6_TUNNEL_HASH_SIZE_SHIFT);
> - }
> -@@ -136,20 +139,29 @@ static struct net_device_stats *ip6_get_
> - static struct ip6_tnl

[PATCH] ethtool: update to version 5.9

2020-11-15 Thread Hans Dedecker
The ipkg sizes changes as follows for mips 24kc :
5.8 : ethtool_5.8-1_mips_24kc.ipk 34930
5.9 : ethtool_5.9-1_mips_24kc.ipk 35241

Signed-off-by: Hans Dedecker 
---
 package/network/utils/ethtool/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/network/utils/ethtool/Makefile 
b/package/network/utils/ethtool/Makefile
index 6547eee9a5..df8d7ce119 100644
--- a/package/network/utils/ethtool/Makefile
+++ b/package/network/utils/ethtool/Makefile
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ethtool
-PKG_VERSION:=5.8
+PKG_VERSION:=5.9
 PKG_RELEASE:=1
 
 PKG_MAINTAINER:=Felix Fietkau 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/software/network/ethtool
-PKG_HASH:=2f3b54d08d048f5977b80cb6cb4744994370def7553ee634d39dbbb6ccf87546
+PKG_HASH:=512932010af87bc3e09773c89baea44bca96c1da1151bbcf109fa0e055a88a6f
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING
-- 
2.25.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] dropbear: update to 2.81

2020-11-14 Thread Hans Dedecker
Update dropbear to latest stable 2.81; for the changes see 
https://matt.ucc.asn.au/dropbear/CHANGES

Refresh patches

Signed-off-by: Hans Dedecker 
---
 package/network/services/dropbear/Makefile  | 6 +++---
 .../network/services/dropbear/patches/110-change_user.patch | 2 +-
 .../services/dropbear/patches/160-lto-jobserver.patch   | 4 ++--
 .../910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch   | 4 +---
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/package/network/services/dropbear/Makefile 
b/package/network/services/dropbear/Makefile
index 1ecca2feb1..8520426382 100644
--- a/package/network/services/dropbear/Makefile
+++ b/package/network/services/dropbear/Makefile
@@ -8,14 +8,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dropbear
-PKG_VERSION:=2020.80
-PKG_RELEASE:=4
+PKG_VERSION:=2020.81
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
http://matt.ucc.asn.au/dropbear/releases/ \
https://dropbear.nl/mirror/releases/
-PKG_HASH:=d927941b91f2da150b2033f1a88b6a47999bf0afb1493a73e9216cffdb5d7949
+PKG_HASH:=48235d10b37775dbda59341ac0c4b239b82ad6318c31568b985730c788aac53b
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
diff --git a/package/network/services/dropbear/patches/110-change_user.patch 
b/package/network/services/dropbear/patches/110-change_user.patch
index f66b319100..1dd67948af 100644
--- a/package/network/services/dropbear/patches/110-change_user.patch
+++ b/package/network/services/dropbear/patches/110-change_user.patch
@@ -1,6 +1,6 @@
 --- a/svr-chansession.c
 +++ b/svr-chansession.c
-@@ -950,12 +950,12 @@ static void execchild(const void *user_d
+@@ -954,12 +954,12 @@ static void execchild(const void *user_d
/* We can only change uid/gid as root ... */
if (getuid() == 0) {
  
diff --git a/package/network/services/dropbear/patches/160-lto-jobserver.patch 
b/package/network/services/dropbear/patches/160-lto-jobserver.patch
index dbba613ac3..1ba7dd6f44 100644
--- a/package/network/services/dropbear/patches/160-lto-jobserver.patch
+++ b/package/network/services/dropbear/patches/160-lto-jobserver.patch
@@ -1,6 +1,6 @@
 --- a/Makefile.in
 +++ b/Makefile.in
-@@ -199,17 +199,17 @@ dropbearkey: $(dropbearkeyobjs)
+@@ -198,17 +198,17 @@ dropbearkey: $(dropbearkeyobjs)
  dropbearconvert: $(dropbearconvertobjs)
  
  dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile
@@ -22,7 +22,7 @@
  
  
  # multi-binary compilation.
-@@ -220,7 +220,7 @@ ifeq ($(MULTI),1)
+@@ -219,7 +219,7 @@ ifeq ($(MULTI),1)
  endif
  
  dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile
diff --git 
a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
 
b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
index afa0ebb310..b774a38b1a 100644
--- 
a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
+++ 
b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
@@ -19,11 +19,9 @@ Signed-off-by: Petr Štetiar 
  signkey.c | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)
 
-diff --git a/signkey.c b/signkey.c
-index 92fe6a242cd0..d16ab174d83a 100644
 --- a/signkey.c
 +++ b/signkey.c
-@@ -657,8 +657,12 @@ int buf_verify(buffer * buf, sign_key *key, enum 
signature_type expect_sigtype,
+@@ -657,8 +657,12 @@ int buf_verify(buffer * buf, sign_key *k
sigtype = signature_type_from_name(type_name, type_name_len);
m_free(type_name);
  
-- 
2.25.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] iproute2: update to 5.9

2020-11-12 Thread Hans Dedecker
Update iproute2 to latest stable 5.9; for the changes see 
https://lwn.net/Articles/834755/

Refresh patches

Signed-off-by: Hans Dedecker 
---
 package/network/utils/iproute2/Makefile | 4 ++--
 .../utils/iproute2/patches/115-add-config-xtlibdir.patch| 2 +-
 .../utils/iproute2/patches/175-reduce-dynamic-syms.patch| 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/package/network/utils/iproute2/Makefile 
b/package/network/utils/iproute2/Makefile
index 90f8b59a02..237f84736b 100644
--- a/package/network/utils/iproute2/Makefile
+++ b/package/network/utils/iproute2/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iproute2
-PKG_VERSION:=5.8.0
+PKG_VERSION:=5.9.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
-PKG_HASH:=cfcd1f890290f8c8afcc91d9444ad929b9252c16f9ab3f286c50dd3c59dc646e
+PKG_HASH:=a25dac94bcdcf2f73316c7f812115ea7a5710580bad892b08a83d00c6b33dacf
 PKG_BUILD_PARALLEL:=1
 PKG_BUILD_DEPENDS:=iptables
 PKG_LICENSE:=GPL-2.0
diff --git 
a/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch 
b/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch
index 03df7809f7..8702d5fd2d 100644
--- a/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch
+++ b/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch
@@ -1,6 +1,6 @@
 --- a/tc/Makefile
 +++ b/tc/Makefile
-@@ -127,6 +127,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR
+@@ -128,6 +128,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR
  ifneq ($(IPT_LIB_DIR),)
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
  endif
diff --git 
a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch 
b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch
index e5d5492a35..da961a183b 100644
--- a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch
+++ b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch
@@ -9,7 +9,7 @@
  endif
  
  TCLIB := tc_core.o
-@@ -143,7 +143,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
+@@ -144,7 +144,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
  all: tc $(TCSO)
  
  tc: $(TCOBJ) $(LIBNETLINK) libtc.a
@@ -18,7 +18,7 @@
  
  libtc.a: $(TCLIB)
$(QUIET_AR)$(AR) rcs $@ $^
-@@ -165,6 +165,7 @@ install: all
+@@ -166,6 +166,7 @@ install: all
  clean:
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \
rm -f emp_ematch.tab.*
@@ -26,7 +26,7 @@
  
  q_atm.so: q_atm.c
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o 
q_atm.so q_atm.c -latm
-@@ -204,4 +205,15 @@ static-syms.h: $(wildcard *.c)
+@@ -205,4 +206,15 @@ static-syms.h: $(wildcard *.c)
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char 
\1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
done > $@
  
-- 
2.25.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] dnsmasq: 'ipset' config sections

2020-11-12 Thread Hans Dedecker
On Thu, Nov 12, 2020 at 1:52 PM Aleksandr Mezin
 wrote:
>
> By the way, this new config syntax should be documented somewhere, I guess?
It would be very helpful if the new config syntax is documented in
https://openwrt.org/docs/guide-user/base-system/dhcp

Hans
>
> On Thu, Nov 12, 2020 at 1:50 AM Hans Dedecker  wrote:
> >
> > Hi,
> >
> > On Mon, Nov 9, 2020 at 11:55 AM Aleksandr Mezin
> >  wrote:
> > >
> > > Is something wrong with this patch? Should I CC someone to get the
> > > patch reviewed? I'm unable to figure out who is the maintainer of
> > > dnsmasq package
> > Nothing wrong the patch as it looks fine; it just takes some time
> > before somebody finds time to review and test a patch.
> > I just applied the patch to master; thx
> >
> > Hans
> > >
> > > On Fri, Oct 23, 2020 at 11:03 AM Aleksandr Mezin
> > >  wrote:
> > > >
> > > > Allow configuring ipsets with dedicated config sections:
> > > >
> > > > config ipset
> > > > list name 'ss_rules_dst_forward'
> > > > list name 'ss_rules6_dst_forward'
> > > > list domain 't.me'
> > > > list domain 'telegram.org'
> > > >
> > > > instead of current, rather inconvenient syntax:
> > > >
> > > > config dnsmasq
> > > > ...
> > > > list ipset 
> > > > '/t.me/telegram.org/ss_rules_dst_forward,ss_rules6_dst_forward'
> > > >
> > > > Current syntax will still continue to work though.
> > > >
> > > > With this change, a LuCI GUI for DNS ipsets should be easy to implement.
> > > >
> > > > Signed-off-by: Aleksandr Mezin 
> > > > ---
> > > >  .../services/dnsmasq/files/dnsmasq.init   | 27 +++
> > > >  1 file changed, 27 insertions(+)
> > > >
> > > > diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
> > > > b/package/network/services/dnsmasq/files/dnsmasq.init
> > > > index 0fa3074f92..fff8f8f793 100644
> > > > --- a/package/network/services/dnsmasq/files/dnsmasq.init
> > > > +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> > > > @@ -769,6 +769,29 @@ dhcp_relay_add() {
> > > > fi
> > > >  }
> > > >
> > > > +dnsmasq_ipset_add() {
> > > > +   local cfg="$1"
> > > > +   local ipsets domains
> > > > +
> > > > +   add_ipset() {
> > > > +   ipsets="${ipsets:+$ipsets,}$1"
> > > > +   }
> > > > +
> > > > +   add_domain() {
> > > > +   # leading '/' is expected
> > > > +   domains="$domains/$1"
> > > > +   }
> > > > +
> > > > +   config_list_foreach "$cfg" "name" add_ipset
> > > > +   config_list_foreach "$cfg" "domain" add_domain
> > > > +
> > > > +   if [ -z "$ipsets" ] || [ -z "$domains" ]; then
> > > > +   return 0
> > > > +   fi
> > > > +
> > > > +   xappend "--ipset=$domains/$ipsets"
> > > > +}
> > > > +
> > > >  dnsmasq_start()
> > > >  {
> > > > local cfg="$1"
> > > > @@ -1056,6 +1079,10 @@ dnsmasq_start()
> > > > config_foreach filter_dnsmasq cname dhcp_cname_add "$cfg"
> > > > echo >> $CONFIGFILE_TMP
> > > >
> > > > +   echo >> $CONFIGFILE_TMP
> > > > +   config_foreach filter_dnsmasq ipset dnsmasq_ipset_add "$cfg"
> > > > +   echo >> $CONFIGFILE_TMP
> > > > +
> > > > echo >> $CONFIGFILE_TMP
> > > > mv -f $CONFIGFILE_TMP $CONFIGFILE
> > > > mv -f $HOSTFILE_TMP $HOSTFILE
> > > > --
> > > > 2.29.0
> > > >
> > >
> > > ___
> > > openwrt-devel mailing list
> > > openwrt-devel@lists.openwrt.org
> > > https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] dnsmasq: 'ipset' config sections

2020-11-11 Thread Hans Dedecker
Hi,

On Mon, Nov 9, 2020 at 11:55 AM Aleksandr Mezin
 wrote:
>
> Is something wrong with this patch? Should I CC someone to get the
> patch reviewed? I'm unable to figure out who is the maintainer of
> dnsmasq package
Nothing wrong the patch as it looks fine; it just takes some time
before somebody finds time to review and test a patch.
I just applied the patch to master; thx

Hans
>
> On Fri, Oct 23, 2020 at 11:03 AM Aleksandr Mezin
>  wrote:
> >
> > Allow configuring ipsets with dedicated config sections:
> >
> > config ipset
> > list name 'ss_rules_dst_forward'
> > list name 'ss_rules6_dst_forward'
> > list domain 't.me'
> > list domain 'telegram.org'
> >
> > instead of current, rather inconvenient syntax:
> >
> > config dnsmasq
> > ...
> > list ipset 
> > '/t.me/telegram.org/ss_rules_dst_forward,ss_rules6_dst_forward'
> >
> > Current syntax will still continue to work though.
> >
> > With this change, a LuCI GUI for DNS ipsets should be easy to implement.
> >
> > Signed-off-by: Aleksandr Mezin 
> > ---
> >  .../services/dnsmasq/files/dnsmasq.init   | 27 +++
> >  1 file changed, 27 insertions(+)
> >
> > diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
> > b/package/network/services/dnsmasq/files/dnsmasq.init
> > index 0fa3074f92..fff8f8f793 100644
> > --- a/package/network/services/dnsmasq/files/dnsmasq.init
> > +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> > @@ -769,6 +769,29 @@ dhcp_relay_add() {
> > fi
> >  }
> >
> > +dnsmasq_ipset_add() {
> > +   local cfg="$1"
> > +   local ipsets domains
> > +
> > +   add_ipset() {
> > +   ipsets="${ipsets:+$ipsets,}$1"
> > +   }
> > +
> > +   add_domain() {
> > +   # leading '/' is expected
> > +   domains="$domains/$1"
> > +   }
> > +
> > +   config_list_foreach "$cfg" "name" add_ipset
> > +   config_list_foreach "$cfg" "domain" add_domain
> > +
> > +   if [ -z "$ipsets" ] || [ -z "$domains" ]; then
> > +   return 0
> > +   fi
> > +
> > +   xappend "--ipset=$domains/$ipsets"
> > +}
> > +
> >  dnsmasq_start()
> >  {
> > local cfg="$1"
> > @@ -1056,6 +1079,10 @@ dnsmasq_start()
> > config_foreach filter_dnsmasq cname dhcp_cname_add "$cfg"
> > echo >> $CONFIGFILE_TMP
> >
> > +   echo >> $CONFIGFILE_TMP
> > +   config_foreach filter_dnsmasq ipset dnsmasq_ipset_add "$cfg"
> > +   echo >> $CONFIGFILE_TMP
> > +
> > echo >> $CONFIGFILE_TMP
> > mv -f $CONFIGFILE_TMP $CONFIGFILE
> > mv -f $HOSTFILE_TMP $HOSTFILE
> > --
> > 2.29.0
> >
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] [RFT] glibc: update to latest stable version 2.32

2020-10-25 Thread Hans Dedecker
Update to latest stable version 2.32

refresh patches :
050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
00-fix_cross_rpcgen.patch

Signed-off-by: Hans Dedecker 
---
 toolchain/glibc/common.mk |   6 +-
 ...use-of-DES-encryption-functions-in-n.patch | 138 ++
 .../glibc/patches/100-fix_cross_rpcgen.patch  |  17 ---
 3 files changed, 81 insertions(+), 80 deletions(-)

diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk
index ad4b324374..fe0e7b9d6b 100644
--- a/toolchain/glibc/common.mk
+++ b/toolchain/glibc/common.mk
@@ -7,13 +7,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=glibc
-PKG_VERSION:=2.31
+PKG_VERSION:=2.32
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=4bc9918c998085800ecf5bbb3c863e66ea6252a0
-PKG_MIRROR_HASH:=518776819b5ccc004a842de755c6c203996d673d94d7013927712e252c17
+PKG_SOURCE_VERSION:=0b9460d22e285432d232f42c7442a3226e1bf830
+PKG_MIRROR_HASH:=3e990ffb5e3beaa26fda8b7f490c79db1e1a11659226fdee56074e0d335a91cd
 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
 
diff --git 
a/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
 
b/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
index 4e3e2eebb2..002e7a1770 100644
--- 
a/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
+++ 
b/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch
@@ -1,11 +1,11 @@
-From cfc93329e00cd23c226f34b3ffd5552a93c35bd7 Mon Sep 17 00:00:00 2001
-From: Hauke Mehrtens 
-Date: Mon, 23 Mar 2020 22:33:46 +0100
+From 08f5e0df46ce1ad617bcde1fd5542545397630b9 Mon Sep 17 00:00:00 2001
+From: Hans Dedecker 
+Date: Sat, 24 Oct 2020 21:13:30 +0200
 Subject: Revert "Disallow use of DES encryption functions in new programs."
 
 This reverts commit b10a0accee709a5efff2fadf0b0bbb79ff0ad759.
 
-ppp still uses the encrypt functions from the libc. musl libc also
+ppp still uses the encrypt functions from the libc while musl libc also
 provides them.
 ---
  conform/data/stdlib.h-data |   3 +
@@ -15,18 +15,19 @@ provides them.
  crypt/crypt.h  |  16 +++
  crypt/crypt_util.c |   9 --
  manual/conf.texi   |   2 -
- manual/crypt.texi  | 201 +
+ manual/crypt.texi  | 204 +
  manual/string.texi |  82 +++
- posix/unistd.h |  22 ++--
+ posix/unistd.h |  17 +++-
  stdlib/stdlib.h|   6 ++
- sunrpc/Makefile|   2 +-
  sunrpc/des_crypt.c |   7 +-
  sunrpc/des_soft.c  |   2 +-
- 14 files changed, 303 insertions(+), 96 deletions(-)
+ 13 files changed, 305 insertions(+), 90 deletions(-)
 
+diff --git a/conform/data/stdlib.h-data b/conform/data/stdlib.h-data
+index 6913828196..d8f2fb 100644
 --- a/conform/data/stdlib.h-data
 +++ b/conform/data/stdlib.h-data
-@@ -149,6 +149,9 @@ function {unsigned short int*} seed48 (u
+@@ -149,6 +149,9 @@ function {unsigned short int*} seed48 (unsigned short 
int[3])
  #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && 
!defined XPG4 && !defined XPG42 && !defined UNIX98
  function int setenv (const char*, const char*, int)
  #endif
@@ -36,6 +37,8 @@ provides them.
  #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && 
!defined POSIX && !defined POSIX2008
  function {char*} setstate (char*)
  #endif
+diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data
+index aa070528e8..ddf4f25132 100644
 --- a/conform/data/unistd.h-data
 +++ b/conform/data/unistd.h-data
 @@ -437,6 +437,9 @@ function int chroot (const char*)
@@ -58,6 +61,8 @@ provides them.
  function int execl (const char*, const char*, ...)
  function int execle (const char*, const char*, ...)
  function int execlp (const char*, const char*, ...)
+diff --git a/crypt/cert.c b/crypt/cert.c
+index e070ca398d..80029e9078 100644
 --- a/crypt/cert.c
 +++ b/crypt/cert.c
 @@ -10,22 +10,6 @@
@@ -97,6 +102,8 @@ provides them.
 -}
 -
 -#endif
+diff --git a/crypt/crypt-entry.c b/crypt/crypt-entry.c
+index 502b5846f0..09332c690a 100644
 --- a/crypt/crypt-entry.c
 +++ b/crypt/crypt-entry.c
 @@ -35,7 +35,6 @@
@@ -107,7 +114,7 @@ provides them.
  
  /* Prototypes for local functions.  */
  #ifndef __GNU_LIBRARY__
-@@ -177,7 +176,17 @@ crypt (const char *key, const char *salt
+@@ -177,7 +176,17 @@ crypt (const char *key, const char *salt)
return __crypt_r (key, salt, &_ufc_foobar);
  }
  
@@ -127,6 +134,8 @@ provides them.
 +  return crypt (key, salt);
 +}
  #endif
+diff --git a/crypt/crypt.h b/crypt/crypt.h
+index ca8ad456cc..7d0de95018 100644
 --- a/crypt/cryp

Re: [PATCH netifd 4/4] interface: proto_ip: order by address index first

2020-10-21 Thread Hans Dedecker
On Wed, Oct 21, 2020 at 5:08 AM Yousong Zhou  wrote:
>
> At the moment, dnsmasq initscript generates dhcp-range for an interface
> by inspecting first address of that interface from netifd ubus output.
>
> Order by address index as specified in the uci config make netifd ubus
> output consistent with linux network interfaces' primary/secondary
> address settings.  More importantly, the ubus output and dnsmasq config
> generation will be more predictable.
>
> Signed-off-by: Yousong Zhou 
Acked-by: Hans Dedecker 
> ---
>  interface-ip.c | 11 +--
>  proto.c|  4 ++--
>  2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/interface-ip.c b/interface-ip.c
> index f1ed8d3..35834a5 100644
> --- a/interface-ip.c
> +++ b/interface-ip.c
> @@ -516,8 +516,15 @@ error:
>  static int
>  addr_cmp(const void *k1, const void *k2, void *ptr)
>  {
> -   return memcmp(k1, k2, sizeof(struct device_addr) -
> - offsetof(struct device_addr, flags));
> +   const struct device_addr *a1 = k1;
> +   const struct device_addr *a2 = k2;
> +   const int cmp_offset = offsetof(struct device_addr, flags);
> +   const int cmp_size = sizeof(struct device_addr) - cmp_offset;
> +
> +   if (a1->index != a2->index) {
> +   return a1->index - a2->index;
> +   }
small nitpick: remove the brackets to keep in line with existing coding style
> +   return memcmp(k1+cmp_offset, k2+cmp_offset, cmp_size);
>  }
>
>  static int
> diff --git a/proto.c b/proto.c
> index f7d27aa..01473f2 100644
> --- a/proto.c
> +++ b/proto.c
> @@ -174,7 +174,7 @@ parse_static_address_option(struct interface *iface, 
> struct blob_attr *attr,
> }
> addr->index = n_addr;
> n_addr++;
> -   vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags);
> +   vlist_add(&iface->proto_ip.addr, &addr->node, addr);
> }
>
> return n_addr;
> @@ -275,7 +275,7 @@ parse_address_list(struct interface *iface, struct 
> blob_attr *attr, bool v6,
>
> addr->index = n_addr;
> n_addr++;
> -   vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags);
> +   vlist_add(&iface->proto_ip.addr, &addr->node, addr);
> }
>
> return n_addr;

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH netifd 3/4] device_addr: record address index as in the blob

2020-10-21 Thread Hans Dedecker
On Wed, Oct 21, 2020 at 5:08 AM Yousong Zhou  wrote:
>
> Signed-off-by: Yousong Zhou 
Acked-by: Hans Dedecker 
> ---
>  interface-ip.h | 1 +
>  proto.c| 2 ++
>  2 files changed, 3 insertions(+)
>
> diff --git a/interface-ip.h b/interface-ip.h
> index 5ab9299..b17ad94 100644
> --- a/interface-ip.h
> +++ b/interface-ip.h
> @@ -127,6 +127,7 @@ struct device_addr {
> struct vlist_node node;
> bool enabled;
> bool failed;
> +   int index;
> unsigned int policy_table;
>
> struct device_route subnet;
> diff --git a/proto.c b/proto.c
> index d80cae0..f7d27aa 100644
> --- a/proto.c
> +++ b/proto.c
> @@ -172,6 +172,7 @@ parse_static_address_option(struct interface *iface, 
> struct blob_attr *attr,
> interface_add_error(iface, "proto", 
> "INVALID_ADDRESS", &str, 1);
> return -1;
> }
> +   addr->index = n_addr;
> n_addr++;
> vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags);
> }
> @@ -272,6 +273,7 @@ parse_address_list(struct interface *iface, struct 
> blob_attr *attr, bool v6,
> if (!addr)
> return -1;
>
> +   addr->index = n_addr;
> n_addr++;
> vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags);
> }

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH netifd 2/4] proto: rework parse_addr to return struct device_addr

2020-10-21 Thread Hans Dedecker
On Wed, Oct 21, 2020 at 5:08 AM Yousong Zhou  wrote:
>
> This is a preparation for the next commit to record address index for
> the returned device_addr struct
>
> Signed-off-by: Yousong Zhou 
Acked-by: Hans Dedecker 
> ---
>  proto.c | 26 +++---
>  1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/proto.c b/proto.c
> index cbc92b1..d80cae0 100644
> --- a/proto.c
> +++ b/proto.c
> @@ -116,16 +116,16 @@ alloc_device_addr(bool v6, bool ext)
> return addr;
>  }
>
> -static bool
> -parse_addr(struct interface *iface, const char *str, bool v6, int mask,
> -  bool ext, uint32_t broadcast, uint32_t ptp, bool deprecated)
> +static struct device_addr *
> +parse_addr(const char *str, bool v6, int mask, bool ext, uint32_t broadcast,
> +   uint32_t ptp, bool deprecated)
>  {
> struct device_addr *addr;
> int af = v6 ? AF_INET6 : AF_INET;
>
> addr = alloc_device_addr(v6, ext);
> if (!addr)
> -   return false;
> +   return NULL;
>
> addr->mask = mask;
> if (!parse_ip_and_netmask(af, str, &addr->addr, &addr->mask))
> @@ -143,14 +143,12 @@ parse_addr(struct interface *iface, const char *str, 
> bool v6, int mask,
> if (deprecated)
> addr->preferred_until = system_get_rtime();
>
> -   vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags);
> -   return true;
> +   return addr;
>
>  error:
> -   interface_add_error(iface, "proto", "INVALID_ADDRESS", &str, 1);
> free(addr);
>
> -   return false;
> +   return NULL;
>  }
>
>  static int
> @@ -159,6 +157,8 @@ parse_static_address_option(struct interface *iface, 
> struct blob_attr *attr,
> uint32_t ptp, bool deprecated)
>  {
> struct blob_attr *cur;
> +   struct device_addr *addr;
> +   const char *str;
> int n_addr = 0;
> int rem;
>
> @@ -166,10 +166,14 @@ parse_static_address_option(struct interface *iface, 
> struct blob_attr *attr,
> if (blobmsg_type(cur) != BLOBMSG_TYPE_STRING)
> return -1;
>
> -   n_addr++;
> -   if (!parse_addr(iface, blobmsg_data(cur), v6, netmask, ext,
> -   broadcast, ptp, deprecated))
> +   str = blobmsg_data(cur);
> +   addr = parse_addr(str, v6, netmask, ext, broadcast, ptp, 
> deprecated);
> +   if (addr == NULL) {
> +   interface_add_error(iface, "proto", 
> "INVALID_ADDRESS", &str, 1);
> return -1;
> +   }
> +   n_addr++;
> +   vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags);
> }
>
> return n_addr;

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH][netifd] system-linux: initialize ifreq struct before using it

2020-10-08 Thread Hans Dedecker
Hi Alin,

On Thu, Oct 8, 2020 at 1:31 PM Alin Nastac  wrote:
Could you add which issue this fixes ?

Thx
Hans
>
> Signed-off-by: Alin Nastac 
> ---
>  system-linux.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/system-linux.c b/system-linux.c
> index 6778b1d..9188899 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -904,6 +904,8 @@ failure:
>  int system_if_resolve(struct device *dev)
>  {
> struct ifreq ifr;
> +
> +   memset(&ifr, 0, sizeof(ifr));
> strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
> if (!ioctl(sock_ioctl, SIOCGIFINDEX, &ifr))
> return ifr.ifr_ifindex;
> --
> 2.7.4
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] wireguard-tools: bump to 1.0.20200827

2020-09-08 Thread Hans Dedecker
Hi,

On Tue, Sep 8, 2020 at 6:30 PM Jason A. Donenfeld  wrote:
>
> * ipc: split into separate files per-platform
>
> This is in preparation for FreeBSD support, which I had hoped to have this
> release, but we're still waiting on some tooling fixes, so hopefully next
> wg(8) will support that. Either way, the code base is now a lot more amenable
> to adding more kernel platform support.
>
> * man: wg-quick: use syncconf instead of addconf for strip example
>
> Simple documentation fix.
>
> * pubkey: isblank is a subset of isspace
> * ctype: use non-locale-specific ctype.h
>
> In addition to ensuring that isalpha() and such isn't locale-specific, we also
> make these constant time, even though we're never distinguishing between bits
> of a secret using them. From that perspective, though, this is markedly better
> than the locale-specific table lookups in glibc, even though base64 characters
> span two cache lines and valid private keys must hit both. This may be useful
> for other projects too: https://git.zx2c4.com/wireguard-tools/tree/src/ctype.h

The patch is missing a SoB

Hans
> ---
>  package/network/utils/wireguard-tools/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/utils/wireguard-tools/Makefile 
> b/package/network/utils/wireguard-tools/Makefile
> index fb7c0b6..a5264a5 100644
> --- a/package/network/utils/wireguard-tools/Makefile
> +++ b/package/network/utils/wireguard-tools/Makefile
> @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
>
>  PKG_NAME:=wireguard-tools
>
> -PKG_VERSION:=1.0.20200513
> +PKG_VERSION:=1.0.20200827
>  PKG_RELEASE:=2
>
>  PKG_SOURCE:=wireguard-tools-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-tools/snapshot/
> -PKG_HASH:=e73409a9fb8c90506db241d1e1a4e7372a60dbfa400e37f4ab2fd70a92ba495f
> +PKG_HASH:=51bc85e33a5b3cf353786ae64b0f1216d7a871447f058b6137f793eb0f53b7fd
>
>  PKG_LICENSE:=GPL-2.0
>  PKG_LICENSE_FILES:=COPYING
> --
> 2.28.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] ethtool: Update to version 5.8

2020-08-30 Thread Hans Dedecker
On Sat, Aug 29, 2020 at 10:15 PM Hauke Mehrtens  wrote:
>
> Signed-off-by: Hauke Mehrtens 
Tested-by: Hans Dedecker 
> ---
>  package/network/utils/ethtool/Makefile | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/utils/ethtool/Makefile 
> b/package/network/utils/ethtool/Makefile
> index c2f92a4ed9fc..6547eee9a5a7 100644
> --- a/package/network/utils/ethtool/Makefile
> +++ b/package/network/utils/ethtool/Makefile
> @@ -8,13 +8,13 @@
>  include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=ethtool
> -PKG_VERSION:=5.4
> +PKG_VERSION:=5.8
>  PKG_RELEASE:=1
>
>  PKG_MAINTAINER:=Felix Fietkau 
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@KERNEL/software/network/ethtool
> -PKG_HASH:=22f81e4927d6eb6a13a259d705248a96005fce2005e15257f639f5a1c8c52b6b
> +PKG_HASH:=2f3b54d08d048f5977b80cb6cb4744994370def7553ee634d39dbbb6ccf87546
>
>  PKG_LICENSE:=GPL-2.0
>  PKG_LICENSE_FILES:=COPYING
> @@ -45,6 +45,8 @@ define Package/ethtool/config
> bool "Enable pretty printing"
>  endef
>
> +CONFIGURE_ARGS += --disable-netlink
> +
>  ifeq ($(CONFIG_ETHTOOL_PRETTY_DUMP),y)
>  CONFIGURE_ARGS += --enable-pretty-dump
>  else
> --
> 2.20.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] dropbear: allow disabling support for scp

2020-08-13 Thread Hans Dedecker
Hi,

On Wed, Jul 22, 2020 at 3:34 PM Rui Salvaterra  wrote:
>
> If not needed, disabling scp allows for a nice size reduction.
>
> Dropbear executable size comparison:
>
> 153621 bytes (baseline)
> 133077 bytes (without scp)
>
> In other words, we trim a total of 20544 bytes.
>
> [Note: This patch is on top of
> "dropbear: fix ssh alternative when dbclient isn't built"]
>
> Signed-off-by: Rui Salvaterra 
> ---
>  package/network/services/dropbear/Config.in | 4 
>  package/network/services/dropbear/Makefile  | 8 +---
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/package/network/services/dropbear/Config.in 
> b/package/network/services/dropbear/Config.in
> index 0ac84ee206..b9ecbc815b 100644
> --- a/package/network/services/dropbear/Config.in
> +++ b/package/network/services/dropbear/Config.in
> @@ -102,4 +102,8 @@ config DROPBEAR_DBCLIENT
> bool "Build dropbear with dbclient"
> default y
>
> +config DROPBEAR_SCP
> +   bool "Build dropbear with scp"
> +   default y
> +
>  endmenu
> diff --git a/package/network/services/dropbear/Makefile 
> b/package/network/services/dropbear/Makefile
> index edd20909b1..8b57b214ae 100644
> --- a/package/network/services/dropbear/Makefile
> +++ b/package/network/services/dropbear/Makefile
> @@ -31,7 +31,7 @@ PKG_CONFIG_DEPENDS:= \
> CONFIG_DROPBEAR_RSA CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
> CONFIG_DROPBEAR_ED25519 CONFIG_DROPBEAR_CHACHA20POLY1305 \
> CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
> -   CONFIG_DROPBEAR_DBCLIENT
> +   CONFIG_DROPBEAR_DBCLIENT CONFIG_DROPBEAR_SCP
>
>  include $(INCLUDE_DIR)/package.mk
>
> @@ -53,7 +53,9 @@ define Package/dropbear
>CATEGORY:=Base system
>TITLE:=Small SSH2 client/server
>DEPENDS:= +DROPBEAR_ZLIB:zlib
> -  ALTERNATIVES:=100:/usr/bin/scp:/usr/sbin/dropbear
> +  ALTERNATIVES:=
> +  $(if $(CONFIG_DROPBEAR_SCP),ALTERNATIVES+= \
> + 100:/usr/bin/scp:/usr/sbin/dropbear,)
>$(if $(CONFIG_DROPBEAR_DBCLIENT),ALTERNATIVES+= \
>   100:/usr/bin/ssh:/usr/sbin/dropbear,)
>
> @@ -149,7 +151,7 @@ endef
>  define Build/Compile
> +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
> $(TARGET_CONFIGURE_OPTS) \
> -   PROGRAMS="dropbear $(if 
> $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey scp" \
> +   PROGRAMS="dropbear $(if 
> $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey $(if 
> $(CONFIG_DROPBEAR_SCP),scp,)" \
> MULTI=1 SCPPROGRESS=1
> +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
> $(TARGET_CONFIGURE_OPTS) \
> --
> 2.27.0
The patch is not applying anymore :

Applying: dropbear: allow disabling support for scp
error: sha1 information is lacking or useless
(package/network/services/dropbear/Config.in).
error: could not build fake ancestor

Can you send a V2 based on latest master ?

Hans
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] odhcpd: remove bogus IPKG_INSTROOT reference

2020-06-10 Thread Hans Dedecker
On Wed, Jun 10, 2020 at 6:27 PM Kevin Darbyshire-Bryant
 wrote:
>
> IPKG_INSTROOT is only set under image builder and we won't be running
> this script at build time either, so remove the reference before it gets
> cargo-culted into other scripts.
>
> Signed-off-by: Kevin Darbyshire-Bryant 
Acked-by: Hans Dedecker 
> ---
>  package/network/services/odhcpd/Makefile| 2 +-
>  package/network/services/odhcpd/files/odhcpd-update | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/services/odhcpd/Makefile 
> b/package/network/services/odhcpd/Makefile
> index 6510ce6c80..07d7d7d673 100644
> --- a/package/network/services/odhcpd/Makefile
> +++ b/package/network/services/odhcpd/Makefile
> @@ -8,7 +8,7 @@
>  include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=odhcpd
> -PKG_RELEASE:=3
> +PKG_RELEASE:=4
>
>  PKG_SOURCE_PROTO:=git
>  PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git
> diff --git a/package/network/services/odhcpd/files/odhcpd-update 
> b/package/network/services/odhcpd/files/odhcpd-update
> index 9bc7abcc1c..c1814e00b0 100755
> --- a/package/network/services/odhcpd/files/odhcpd-update
> +++ b/package/network/services/odhcpd/files/odhcpd-update
> @@ -1,6 +1,6 @@
>  #!/bin/sh
>  # Make dnsmasq reread hostfile by sending SIGHUP signal
>
> -. $IPKG_INSTROOT/lib/functions/procd.sh
> +. /lib/functions/procd.sh
>
>  procd_send_signal dnsmasq
> --
> 2.24.3 (Apple Git-128)
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] netifd: Improve handling of device rename

2020-06-06 Thread Hans Dedecker
On Wed, Mar 11, 2020 at 2:13 PM Kristian Evensen
 wrote:
>
> After an interface has been renamed on a "fast" device (for example
> x86_64), the interface is sometimes not handled correctly by netifd.
> Looking in the logs, I see the following messages when renaming fails:
>
> Wed Mar 11 08:52:44 2020 kern.info kernel: [68383.522038] igb :03:00.0 
> nlw_1: renamed from eth2
> Wed Mar 11 08:52:44 2020 daemon.err netifd[2739]: __device_add_user(710): Add 
> user for device 'nlw_1', refcount=2
> Wed Mar 11 08:52:44 2020 daemon.err netifd[2739]: device_claim(413): Claim 
> Network device nlw_1, new active count: 2
> Wed Mar 11 08:52:44 2020 daemon.err netifd[2739]: device_claim(432): claim 
> Network device nlw_1 failed: -1
>
> Instrumenting netifd further reveals that there is a race between the hotplug
> "@move" event and ioctl(SIOCGIFINDEX). When the above error happens, the
> ioctl-call fails with ENODEV. Looking closer at the kernel code, it seems the
> hotplug-event is triggered before the renaming is completed. The easiest way 
> to
> trigger the race, is if an interface name with the old name is not handled by
> netifd and an interface with the new name is. If only the old name is handled,
> or both names, I was not able to provoke the race.
>
> When the renaming is complete, a NEWLINK-message is generated. This patch
> modifies the logic surrounding renaming, so that we wait for the
> NEWLINK-message before marking an interface as present. The changes made are:
>
> * We only handle move-events for interfaces we know, and we return after
> device has been set as not present.
> * When we receive a NEWLINK message for an interface managed by netifd,
> we call device_set_present. device_set_present is guarded by the same
> checks as the add hotplug-event.
>
> After these changes, renaming works properly on both "fast" and "slow"
> devices. Removing a device is also handled correctly.
>
> Signed-off-by: Kristian Evensen 
> ---
>  system-linux.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/system-linux.c b/system-linux.c
> index d533be8..aff67d6 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -590,6 +590,11 @@ static int cb_rtnl_event(struct nl_msg *msg, void *arg)
> if (!system_get_dev_sysctl("/sys/class/net/%s/carrier", dev->ifname, 
> buf, sizeof(buf)))
> link_state = strtoul(buf, NULL, 0);
>
> +   if (dev->type == &simple_device_type &&
> +   !system_if_force_external(dev->ifname) &&
> +   !dev->present)
> +   device_set_present(dev, true);
> +
> device_set_link(dev, link_state ? true : false);
>
>  out:
> @@ -652,13 +657,15 @@ handle_hotplug_msg(char *data, int size)
>  move:
> dev = device_find(interface_old);
> if (!dev)
> -   goto found;
> +   return;
>
> if (dev->type != &simple_device_type)
> goto found;
>
> device_set_present(dev, false);
>
> +   return;
> +
>  found:
> dev = device_find(interface);
> if (!dev)
> --
> 2.20.1
Patch applied with minor modification
(https://git.openwrt.org/?p=project/netifd.git;a=commitdiff;h=51e9fb8151e8f2c16ac1400bf4d64147ee7e8f5a)

Thx
Hans
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH netifd] vlandev: support setting ingress/egress QoS mappings

2020-05-09 Thread Hans Dedecker
Hi,

As a general remark it's better to use vlist_simple_tree and
vlist_simple_node for the list implementation; for the reasons see
below

On Sun, May 3, 2020 at 7:43 PM Pau Espin Pedrol  wrote:
>
> From: Pau Espin Pedrol 
>
> It allows setting mappings for instance this way:
> """
> config device
>   option name 'vlan41'
>   option type '8021q'
>   option vid '41'
>   option ifname 'eth1'
>   list   ingress_qos_mapping '1:2'
>   list   ingress_qos_mapping '2:5'
>   list   egress_qos_mapping '0:3'
> """
>
> Signed-off-by: Pau Espin Pedrol 
> Tested-by: Pedro 
> ---
>  system-linux.c | 22 +-
>  system.h   |  8 +
>  vlandev.c  | 80 ++
>  3 files changed, 109 insertions(+), 1 deletion(-)
>
> diff --git a/system-linux.c b/system-linux.c
> index 62636c4..c61a5a2 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -1401,8 +1401,10 @@ int system_vlan_del(struct device *dev)
>  int system_vlandev_add(struct device *vlandev, struct device *dev, struct 
> vlandev_config *cfg)
>  {
> struct nl_msg *msg;
> -   struct nlattr *linkinfo, *data;
> +   struct nlattr *linkinfo, *data, *qos;
> struct ifinfomsg iim = { .ifi_family = AF_UNSPEC };
> +   struct vlan_qos_mapping *dep;
> +   struct ifla_vlan_qos_mapping nl_qos_map;
> int rv;
>
> msg = nlmsg_alloc_simple(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_CREATE | 
> NLM_F_EXCL);
> @@ -1431,6 +1433,24 @@ int system_vlandev_add(struct device *vlandev, struct 
> device *dev, struct vlande
> netifd_log_message(L_WARNING, "%s Your kernel is older than 
> linux 3.10.0, 802.1ad is not supported defaulting to 802.1q", 
> vlandev->type->name);
>  #endif
>
> +   if (!(qos = nla_nest_start(msg, IFLA_VLAN_INGRESS_QOS)))
> +   goto nla_put_failure;

Add an empty line after the goto statement
>
> +   list_for_each_entry(dep, &cfg->ingress_qos_mapping_list, list) {
> +   nl_qos_map.from = dep->from;
> +   nl_qos_map.to = dep->to;
> +   nla_put(msg, IFLA_VLAN_QOS_MAPPING, sizeof(nl_qos_map), 
> &nl_qos_map);
> +   }
> +   nla_nest_end(msg, qos);
> +
> +   if (!(qos = nla_nest_start(msg, IFLA_VLAN_EGRESS_QOS)))
> +   goto nla_put_failure;

Add an empty line after the goto statement
>
> +   list_for_each_entry(dep, &cfg->egress_qos_mapping_list, list) {
> +   nl_qos_map.from = dep->from;
> +   nl_qos_map.to = dep->to;
> +   nla_put(msg, IFLA_VLAN_QOS_MAPPING, sizeof(nl_qos_map), 
> &nl_qos_map);
> +   }
> +   nla_nest_end(msg, qos);
> +
> nla_nest_end(msg, data);
> nla_nest_end(msg, linkinfo);
>
> diff --git a/system.h b/system.h
> index b377416..e677c95 100644
> --- a/system.h
> +++ b/system.h
> @@ -158,9 +158,17 @@ enum vlan_proto {
> VLAN_PROTO_8021AD = 0x88A8
>  };
>
> +struct vlan_qos_mapping {
> +   struct list_head list; /* entry in 
> vlandev_config->{e,in}ress_qos_mapping_list */

It's better to use  struct vlist_simple_node iso struct list_head; see
struct dns_server as example
>
> +   uint32_t from;
> +   uint32_t to;
> +};
> +
>  struct vlandev_config {
> enum vlan_proto proto;
> uint16_t vid;
> +   struct list_head ingress_qos_mapping_list; /* list of struct 
> vlan_qos_mapping  */

Use  struct vlist_simple_tree iso struct list_head
>
> +   struct list_head egress_qos_mapping_list;  /* list of struct 
> vlan_qos_mapping  */

 Use  struct vlist_simple_tree iso struct list_head
>
>  };
>
>  static inline int system_get_addr_family(unsigned int flags)
> diff --git a/vlandev.c b/vlandev.c
> index ceaeb3e..3d4d0e4 100644
> --- a/vlandev.c
> +++ b/vlandev.c
> @@ -13,6 +13,7 @@
>   */
>
>  #include 
> +#include 
>
>  #include "netifd.h"
>  #include "device.h"
> @@ -22,12 +23,16 @@
>  enum {
> VLANDEV_ATTR_IFNAME,
> VLANDEV_ATTR_VID,
> +   VLANDEV_ATTR_INGRESS_QOS_MAPPING,
> +   VLANDEV_ATTR_EGRESS_QOS_MAPPING,
> __VLANDEV_ATTR_MAX
>  };
>
>  static const struct blobmsg_policy vlandev_attrs[__VLANDEV_ATTR_MAX] = {
> [VLANDEV_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_STRING },
> [VLANDEV_ATTR_VID] = { "vid", BLOBMSG_TYPE_INT32 },
> +   [VLANDEV_ATTR_INGRESS_QOS_MAPPING] = { "ingress_qos_mapping", 
> BLOBMSG_TYPE_ARRAY },
> +   [VLANDEV_ATTR_EGRESS_QOS_MAPPING] = { "egress_qos_mapping", 
> BLOBMSG_TYPE_ARRAY },
>  };
>
>  static const struct uci_blob_param_list vlandev_attr_list = {
> @@ -122,13 +127,41 @@ static void
>  vlandev_free(struct device *dev)
>  {
> struct vlandev_device *mvdev;
> +   struct vlan_qos_mapping *dep, *tmp;
>
> mvdev = container_of(dev, struct vlandev_device, dev);
> device_remove_user(&mvdev->parent);
> free(mvdev->config_data);
> +   list_for_each_entry_safe(dep, tmp, 
> &mvdev->config.ingress_qos_mapping_list, list) {
> +   list_del(&dep->l

Re: [OpenWrt-Devel] [PATCH netifd] vlandev: support setting ingress/egress QoS mappings

2020-05-01 Thread Hans Dedecker
Hi,

On Tue, Apr 28, 2020 at 9:41 AM Pau Espin Pedrol  wrote:

> From: Pau Espin Pedrol 
>
> It allows setting mappings for instance this way:
> """
> config device
>   option name 'vlan41'
>   option type '8021q'
>   option vid '41'
>   option ifname 'eth1'
>   list   ingress_qos_mapping '1:2'
>   list   ingress_qos_mapping '2:5'
>   list   egress_qos_mapping '0:3'
> """
>
> Size of mapping arrays (ingress=8, egress=16) taken from linux kernel
> "struct vlan_dev_priv".
>
> Signed-off-by: Pau Espin Pedrol 
> Tested-by: Pedro 
> ---
>  system-linux.c | 19 -
>  system.h   |  5 +
>  vlandev.c  | 57 ++
>  3 files changed, 80 insertions(+), 1 deletion(-)
>
> diff --git a/system-linux.c b/system-linux.c
> index 62636c4..fa236ad 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -1401,9 +1401,10 @@ int system_vlan_del(struct device *dev)
>  int system_vlandev_add(struct device *vlandev, struct device *dev, struct
> vlandev_config *cfg)
>  {
> struct nl_msg *msg;
> -   struct nlattr *linkinfo, *data;
> +   struct nlattr *linkinfo, *data, *qos;
> struct ifinfomsg iim = { .ifi_family = AF_UNSPEC };
> int rv;
> +   int i;
>
> msg = nlmsg_alloc_simple(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_CREATE
> | NLM_F_EXCL);
>
> @@ -1431,6 +1432,22 @@ int system_vlandev_add(struct device *vlandev,
> struct device *dev, struct vlande
> netifd_log_message(L_WARNING, "%s Your kernel is older
> than linux 3.10.0, 802.1ad is not supported defaulting to 802.1q",
> vlandev->type->name);
>  #endif
>
> +   if (!(qos = nla_nest_start(msg, IFLA_VLAN_INGRESS_QOS)))
> +   goto nla_put_failure;
> +   for (i = 0; i < cfg->ingress_qos_mappings_len; i++)
> +   nla_put(msg, IFLA_VLAN_QOS_MAPPING,
> +   sizeof(cfg->ingress_qos_mappings[i]),
> +   &cfg->ingress_qos_mappings[i]);
> +   nla_nest_end(msg, qos);
> +
> +   if (!(qos = nla_nest_start(msg, IFLA_VLAN_EGRESS_QOS)))
> +   goto nla_put_failure;
> +   for (i = 0; i < cfg->egress_qos_mappings_len; i++)
> +   nla_put(msg, IFLA_VLAN_QOS_MAPPING,
> +   sizeof(cfg->egress_qos_mappings[i]),
> +   &cfg->egress_qos_mappings[i]);
> +   nla_nest_end(msg, qos);
> +
> nla_nest_end(msg, data);
> nla_nest_end(msg, linkinfo);
>
> diff --git a/system.h b/system.h
> index b377416..d8fc0c4 100644
> --- a/system.h
> +++ b/system.h
> @@ -18,6 +18,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include "device.h"
>  #include "interface-ip.h"
>  #include "iprule.h"
> @@ -161,6 +162,10 @@ enum vlan_proto {
>  struct vlandev_config {
> enum vlan_proto proto;
> uint16_t vid;
> +   struct ifla_vlan_qos_mapping ingress_qos_mappings[8];
>
+   size_t ingress_qos_mappings_len;
> +   struct ifla_vlan_qos_mapping egress_qos_mappings[16];
>
Use a netifd defined struct as struct ifla_vlan_qos_mapping is a Linux
specific struct ; the usage of struct ifla_vlan_qos should be confined to
system-linux.c.
Also use lists here iso fixed arrays as at least for egress qos settings
you can define more than 16 entries after checking the Linux kernel code

> +   size_t egress_qos_mappings_len;
>  };
>
>  static inline int system_get_addr_family(unsigned int flags)
> diff --git a/vlandev.c b/vlandev.c
> index ceaeb3e..2cc9a19 100644
> --- a/vlandev.c
> +++ b/vlandev.c
> @@ -13,6 +13,7 @@
>   */
>
>  #include 
> +#include 
>
>  #include "netifd.h"
>  #include "device.h"
> @@ -22,12 +23,16 @@
>  enum {
> VLANDEV_ATTR_IFNAME,
> VLANDEV_ATTR_VID,
> +   VLANDEV_ATTR_INGRESS_QOS_MAPPING,
> +   VLANDEV_ATTR_EGRESS_QOS_MAPPING,
> __VLANDEV_ATTR_MAX
>  };
>
>  static const struct blobmsg_policy vlandev_attrs[__VLANDEV_ATTR_MAX] = {
> [VLANDEV_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_STRING },
> [VLANDEV_ATTR_VID] = { "vid", BLOBMSG_TYPE_INT32 },
> +   [VLANDEV_ATTR_INGRESS_QOS_MAPPING] = { "ingress_qos_mapping",
> BLOBMSG_TYPE_ARRAY },
> +   [VLANDEV_ATTR_EGRESS_QOS_MAPPING] = { "egress_qos_mapping",
> BLOBMSG_TYPE_ARRAY },
>  };
>
>  static const struct uci_blob_param_list vlandev_attr_list = {
> @@ -152,6 +157,42 @@ vlandev_config_init(struct device *dev)
> device_add_user(&mvdev->parent, basedev);
>  }
>
> +static size_t vlandev_qos_mappings_list_apply(struct
> ifla_vlan_qos_mapping *qos_mapping, size_t len, struct blob_attr *list)
> +{
> +   struct blob_attr *cur;
> +   int rem, rc;
> +   int i = 0;
> +
> +   blobmsg_for_each_attr(cur, list, rem) {
> +   if (i == len) {
> +   netifd_log_message(L_WARNING, "parsing failed: too
> many (>%d) qos mappings\n", len);
>
Check is not necessary anymore if lists are used

> +   return 0;
> +   }
> +
> +   if 

Re: [OpenWrt-Devel] Routes disappearing when ip "ip link set down ethX" and bring it up again

2020-05-01 Thread Hans Dedecker
On Thu, Apr 30, 2020 at 9:32 PM Philip Prindeville <
philipp_s...@redfish-solutions.com> wrote:

> Hi all,
>
> I noticed that if eth5 is my “wan” interface and I do:
>
> # ip link set down dev eth5
>
> make some firewall changes, then do:
>
> # ip link set up dev eth5
>
> then my routes don’t get repopulated.


> I thought that procd installed triggers so that if an interface flaps,
> then a helper would run (in this case the network helper).
>
Netifd is responsible for management of IP routes/addresses; so if a link
is forced down by an external command netifd will not be aware and will not
re-install IP routes/addresses
You can easily bring down an interface by using ifdown which is handled by
netifd

Hans

>
> Is this not happening?
>
> Thanks,
>
> -Philip
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] dnsmasq: always inform about disabled dhcp service

2020-04-28 Thread Hans Dedecker
On Tue, Apr 28, 2020 at 5:20 PM Petr Štetiar  wrote:

> Init script checks for an already active DHCP server on the interface
> and if such DHCP server is found, then it logs "refusing to start DHCP"
> message, starts dnsmasq without DHCP service unless `option force 1` is
> set and caches the DHCP server check result.
>
> Each consecutive service start then uses this cached DHCP server check
> result, but doesn't provide log feedback about disabled DHCP service
> anymore.
>
> So this patch ensures, that the log message about disabled DHCP service
> on particular interface is always provided.
>
> Signed-off-by: Petr Štetiar 
>
Acked-by: Hans Dedecker 

> ---
>  package/network/services/dnsmasq/files/dnsmasq.init | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/package/network/services/dnsmasq/files/dnsmasq.init
> b/package/network/services/dnsmasq/files/dnsmasq.init
> index 1051087e05a6..9288971426ae 100644
> --- a/package/network/services/dnsmasq/files/dnsmasq.init
> +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> @@ -110,11 +110,6 @@ dhcp_check() {
>
> udhcpc -n -q -s /bin/true -t 1 -i "$ifname" >&- && rv=1 || rv=0
>
> -   [ $rv -eq 1 ] && \
> -   logger -t dnsmasq \
> -   "found already running DHCP-server on interface
> '$ifname'" \
> -   "refusing to start, use 'option force 1' to
> override"
> -
> echo $rv > "$stamp"
> return $rv
>  }
> @@ -517,7 +512,12 @@ dhcp_add() {
>
> #check for an already active dhcp server on the interface, unless
> 'force' is set
> config_get_bool force "$cfg" force 0
> -   [ $force -gt 0 ] || dhcp_check "$ifname" || return 0
> +   [ $force -gt 0 ] || dhcp_check "$ifname" || {
> +   logger -t dnsmasq \
> +   "found already running DHCP-server on interface
> '$ifname'" \
> +   "refusing to start, use 'option force 1' to
> override"
> +   return 0
> +   }
>
> config_get start "$cfg" start 100
> config_get limit "$cfg" limit 150
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] tools/cmake: update to 3.17.0

2020-04-05 Thread Hans Dedecker
Hi,

On Mon, Apr 6, 2020 at 12:38 AM Rosen Penev  wrote:

> Remove libressl patches. They are no longer needed.
>
Can you add why they're not needed anymore ?

Thx
Hans

>
> Replace qt tests patch with one that disables all of them.
>
> Refresh remaining one.
>
> Signed-off-by: Rosen Penev 
> ---
>  tools/cmake/Makefile  |  6 ++--
>  .../cmake/patches/100-disable_qt_tests.patch  | 34 ---
>  tools/cmake/patches/100-no-testing.patch  | 33 ++
>  .../110-libarchive-fix-libressl-compat.patch  | 11 --
>  .../130-bootstrap_parallel_make_flag.patch|  2 +-
>  .../patches/140-libarchive-fix-libressl.patch | 25 --
>  6 files changed, 37 insertions(+), 74 deletions(-)
>  delete mode 100644 tools/cmake/patches/100-disable_qt_tests.patch
>  create mode 100644 tools/cmake/patches/100-no-testing.patch
>  delete mode 100644
> tools/cmake/patches/110-libarchive-fix-libressl-compat.patch
>  delete mode 100644 tools/cmake/patches/140-libarchive-fix-libressl.patch
>
> diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile
> index 336db5dd1f..ab3d225aa6 100644
> --- a/tools/cmake/Makefile
> +++ b/tools/cmake/Makefile
> @@ -7,13 +7,13 @@
>  include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=cmake
> -PKG_VERSION:=3.16.5
> +PKG_VERSION:=3.17.0
>  PKG_CPE_ID:=cpe:/a:kitware:cmake
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
>  PKG_SOURCE_URL:=
> https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \
> -   https://cmake.org/files/v3.16/
> -PKG_HASH:=5f760b50b8ecc9c0c37135fae5fbf00a2fef617059aa9d61c1bb91653e5a8bfc
> +   https://cmake.org/files/v3.17/
> +PKG_HASH:=b74c05b55115eacc4fa2b77a814981dbda05cdc95a53e279fe16b7b272f00847
>
>  HOST_BUILD_PARALLEL:=1
>  HOST_CONFIGURE_PARALLEL:=1
> diff --git a/tools/cmake/patches/100-disable_qt_tests.patch
> b/tools/cmake/patches/100-disable_qt_tests.patch
> deleted file mode 100644
> index 9c0957a390..00
> --- a/tools/cmake/patches/100-disable_qt_tests.patch
> +++ /dev/null
> @@ -1,34 +0,0 @@
>  a/Tests/RunCMake/CMakeLists.txt
> -+++ b/Tests/RunCMake/CMakeLists.txt
> -@@ -375,15 +375,6 @@ else()
> -   message(WARNING "Could not find or build ctresalloc")
> - endif()
> -
> --find_package(Qt4 QUIET)
> --find_package(Qt5Core QUIET)
> --if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS
> 5.1.0)
> --  add_RunCMake_test(IncompatibleQt)
> --endif()
> --if (QT4_FOUND)
> --  add_RunCMake_test(ObsoleteQtMacros
> -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
> --endif()
> --
> - find_package(PkgConfig QUIET)
> - if(PKG_CONFIG_FOUND)
> -   add_RunCMake_test(FindPkgConfig)
>  a/Tests/CMakeLists.txt
> -+++ b/Tests/CMakeLists.txt
> -@@ -489,13 +489,6 @@ if(BUILD_TESTING)
> -
> -   list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
> -
> --  if(NOT DEFINED CMake_TEST_Qt4)
> --set(CMake_TEST_Qt4 1)
> --  endif()
> --  if(CMake_TEST_Qt4 AND NOT QT4_FOUND)
> --find_package(Qt4 QUIET)
> --  endif()
> --
> -   if(CMake_TEST_Qt4 AND QT4_FOUND)
> - # test whether the Qt4 which has been found works, on some machines
> - # which run nightly builds there were errors like "wrong file format"
> diff --git a/tools/cmake/patches/100-no-testing.patch
> b/tools/cmake/patches/100-no-testing.patch
> new file mode 100644
> index 00..501302b835
> --- /dev/null
> +++ b/tools/cmake/patches/100-no-testing.patch
> @@ -0,0 +1,33 @@
> +--- a/Modules/CTest.cmake
>  b/Modules/CTest.cmake
> +@@ -47,7 +47,7 @@ the :variable:`CTEST_USE_LAUNCHERS` variable::
> + in the ``CTestConfig.cmake`` file.
> +
> #]===]
> +
> +-option(BUILD_TESTING "Build the testing tree." ON)
> ++option(BUILD_TESTING "Build the testing tree." OFF)
> +
> + # function to turn generator name into a version string
> + # like vs9 or vs10
> +--- a/Modules/Dart.cmake
>  b/Modules/Dart.cmake
> +@@ -33,7 +33,7 @@ whether testing support should be enabled.  The default
> is ON.
> + #
> + #
> +
> +-option(BUILD_TESTING "Build the testing tree." ON)
> ++option(BUILD_TESTING "Build the testing tree." OFF)
> +
> + if(BUILD_TESTING)
> +   find_package(Dart QUIET)
> +--- a/Tests/Contracts/VTK/Dashboard.cmake.in
>  b/Tests/Contracts/VTK/Dashboard.cmake.in
> +@@ -25,7 +25,7 @@ ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
> +
> + file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
> +   BUILD_EXAMPLES:BOOL=ON
> +-  BUILD_TESTING:BOOL=ON
> ++  BUILD_TESTING:BOOL=OFF
> +   VTK_WRAP_PYTHON:BOOL=ON
> +   ExternalData_OBJECT_STORES:FILEPATH=@base_dir@/ExternalData
> + ")
> diff --git a/tools/cmake/patches/110-libarchive-fix-libressl-compat.patch
> b/tools/cmake/patches/110-libarchive-fix-libressl-compat.patch
> deleted file mode 100644
> index ba6565b6af..00
> --- a/tools/cmake/patches/110-libarchive-fix-libressl-compat.patch
> +++ /dev/null
> @@ -1,11 +0,0 @@
>  a/Utilities/cmlibarchive/libarchi

Re: [OpenWrt-Devel] [PATCH] netifd: fix 14_migrate-dhcp-release script

2020-04-04 Thread Hans Dedecker
On Sat, Apr 4, 2020 at 9:04 PM  wrote:

> >>> prepend 'uci' to 'commit network'
> >> Can you explain why the prepend of 'uci' is required ?
> >> In other words what is not working as I fail to spot the issue
> >
> > I think the author is right. "commit" is no command but an argument to
> the uci command.
> > I've tested the script and it works fine for me ..
> > So I want to understand what is failing ...
>
> uci-defaults "scripts" are implemented here:
>
> https://github.com/openwrt/openwrt/blob/master/package/base-files/files/lib/functions.sh#L256-L263
>
> As you see, after all of them have been sourced a global "uci commit" is
> called anyway.
>
> So, after all, the "uci commit something" statements in uci-defaults files
> are actually not strictly necessary. However, many authors prefer to have
> committed what they touch directly in the uci-defaults script.
> This is handled relatively inconsistently across OpenWrt main/packages
> repos, I once had a look into it and found that it was about 50:50 back
> then (having a commit in the file vs. not having it).
>
I observed the same inconsistency across the code base which makes it hard
to refer to a default way of working

>
> However, I'd still expect the "commit network" to produce some error
> anywhere.
>
I did not see an issue when doing a quick test as the global 'uci commit'
covered up the issue for me

>
> But instead of adding the "uci" in front, another working solution would
> be to just drop the line entirely.
>
Agree and I would prefer this solution

Thx,
Hans

>
> Best
>
> Adrian
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] netifd: fix 14_migrate-dhcp-release script

2020-04-04 Thread Hans Dedecker
Hi

On Sat, Apr 4, 2020 at 8:46 PM  wrote:

> >> prepend 'uci' to 'commit network'
> > Can you explain why the prepend of 'uci' is required ?
> > In other words what is not working as I fail to spot the issue
>
> I think the author is right. "commit" is no command but an argument to the
> uci command.
>
I've tested the script and it works fine for me ..
So I want to understand what is failing ...

Hans

>
> Best
>
> Adrian
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] netifd: fix 14_migrate-dhcp-release script

2020-04-04 Thread Hans Dedecker
Hi,

On Fri, Mar 27, 2020 at 1:36 PM Peter Stadler <
peter.stad...@student.uibk.ac.at> wrote:

> prepend 'uci' to 'commit network'
>
Can you explain why the prepend of 'uci' is required ?
In other words what is not working as I fail to spot the issue

Hans

>
> Signed-off-by: Peter Stadler 
> ---
>  .../netifd/files/etc/uci-defaults/14_migrate-dhcp-release   | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
> a/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
> b/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
> index 651c437cb2..f1b384eecc 100644
> ---
> a/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
> +++
> b/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
> @@ -18,6 +18,6 @@ migrate_release() {
>
>  config_load network
>  config_foreach migrate_release interface
> -commit network
> +uci commit network
>
>  exit 0
> --
> 2.24.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] umdns: fix 64-bit time format string

2020-03-28 Thread Hans Dedecker
On Fri, Mar 27, 2020 at 12:00 AM Rosen Penev  wrote:
>
> Fixes compilation under musl 1.2.0
>
> Signed-off-by: Rosen Penev 
> ---
>  service.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/service.c b/service.c
> index 97b6f91..2a7c28f 100644
> --- a/service.c
> +++ b/service.c
> @@ -122,7 +122,7 @@ service_timeout(struct service *s)
> time_t t = monotonic_time();
>
> if (t - s->t <= TOUT_LOOKUP) {
> -   DBG(2, "t=%lu, s->t=%lu, t - s->t = %lu\n", t, s->t, t - 
> s->t);
> +   DBG(2, "t=" PRId64 ", s->t=" PRId64 ", t - s->t = " PRId64  
> "\n", (int64_t)t, (int64_t)s->t, (int64_t)(t - s->t));
This will fail to compile just like the odhcpd patch as it should be %"PRId64"

Hans
> return 0;
> }
>
> --
> 2.25.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] odhcpd: fix compilation with musl 1.2.0

2020-03-28 Thread Hans Dedecker
Hi,

On Fri, Mar 27, 2020 at 12:07 AM Rosen Penev  wrote:
>
> SYS_clock_gettime is gone with musl 1.2.0. Switched to the function.
>
> Also fixed two format strings that fail as time_t is 64-bit with 1.2.0.
>
> Signed-off-by: Rosen Penev 
> ---
>  src/dhcpv6-ia.c | 8 
>  src/odhcpd.c| 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
> index 1a13945..9f5c77e 100644
> --- a/src/dhcpv6-ia.c
> +++ b/src/dhcpv6-ia.c
> @@ -338,12 +338,12 @@ void dhcpv6_ia_write_statefile(void)
> odhcpd_hexlify(duidbuf, 
> ctxt.c->clid_data, ctxt.c->clid_len);
>
> /* iface DUID iaid hostname lifetime 
> assigned length [addrs...] */
> -   ctxt.buf_idx = snprintf(ctxt.buf, 
> ctxt.buf_len, "# %s %s %x %s%s %ld %x %u ",
> +   ctxt.buf_idx = snprintf(ctxt.buf, 
> ctxt.buf_len, "# %s %s %x %s%s " PRId64 " %x %u ",
> 
> ctxt.iface->ifname, duidbuf, ntohl(ctxt.c->iaid),
> 
> (ctxt.c->flags & OAF_BROKEN_HOSTNAME) ? "broken\\x20" : "",
> 
> (ctxt.c->hostname ? ctxt.c->hostname : "-"),
> 
> (ctxt.c->valid_until > now ?
> -   
> (ctxt.c->valid_until - now + wall_time) :
> +   
> (int64_t)(ctxt.c->valid_until - now + wall_time) :
> 
> (INFINITE_VALID(ctxt.c->valid_until) ? -1 : 0)),
> 
> ctxt.c->assigned, (unsigned)ctxt.c->length);
This fails for me :
/home/dedeckeh/OpenWrt_staging/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/odhcpd-full/odhcpd-2020-03-14-6594c6b1/src/dhcpv6-ia.c:
In function 'dhcpv6_ia_write_statefile':
/home/dedeckeh/OpenWrt_staging/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/odhcpd-full/odhcpd-2020-03-14-6594c6b1/src/dhcpv6-ia.c:341:54:
error: format '%x' expects argument of type 'unsigned int', but
argument 9 has type 'long long int' [-Werror=format=]
  ctxt.buf_idx = snprintf(ctxt.buf, ctxt.buf_len, "# %s %s %x %s%s
" PRId64 " %x %u ",
  ^~
/home/dedeckeh/OpenWrt_staging/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/odhcpd-full/odhcpd-2020-03-14-6594c6b1/src/dhcpv6-ia.c:345:9:
 (ctxt.c->valid_until > now ?
 
  (int64_t)(ctxt.c->valid_until - now + wall_time) :
  ~~
  (INFINITE_VALID(ctxt.c->valid_until) ? -1 : 0)),
  ~~~
/home/dedeckeh/OpenWrt_staging/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/odhcpd-full/odhcpd-2020-03-14-6594c6b1/src/dhcpv6-ia.c:341:83:
note: format string is defined here
  ctxt.buf_idx = snprintf(ctxt.buf, ctxt.buf_len, "# %s %s %x %s%s
" PRId64 " %x %u ",

   ~^

   %llx
/home/dedeckeh/OpenWrt_staging/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/odhcpd-full/odhcpd-2020-03-14-6594c6b1/src/dhcpv6-ia.c:341:54:
error: too many arguments for format [-Werror=format-extra-args]
  ctxt.buf_idx = snprintf(ctxt.buf, ctxt.buf_len, "# %s %s %x %s%s
" PRId64 " %x %u ",

>
> @@ -368,12 +368,12 @@ void dhcpv6_ia_write_statefile(void)
> odhcpd_hexlify(duidbuf, c->hwaddr, 
> sizeof(c->hwaddr));
>
> /* iface DUID iaid hostname lifetime 
> assigned length [addrs...] */
> -   ctxt.buf_idx = snprintf(ctxt.buf, 
> ctxt.buf_len, "# %s %s ipv4 %s%s %ld %x 32 ",
> +   ctxt.buf_idx = snprintf(ctxt.buf, 
> ctxt.buf_len, "# %s %s ipv4 %s%s " PRId64 " %x 32 ",
> 
> ctxt.iface->ifname, duidbuf,
> (c->flags & 
> OAF_BROKEN_HOSTNAME) ? "broken\\x20" : "",
> (c->hostname 
> ? c->hostname : "-"),
> 
> (c->valid_until > now ?
> -   
> (c->valid_until - now + wall_time) :
> +   
> (int64_t)(c->valid_until - now + wall_time) :
Same here :

/home/dedeckeh/OpenWrt_staging/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/odhcpd-full/odhcpd-2020-03-14-6594c6b1/src/

Re: [OpenWrt-Devel] [PATCH] umdns: fix 64-bit time format string

2020-03-26 Thread Hans Dedecker
On Thu, Mar 26, 2020 at 1:53 AM Rosen Penev  wrote:
>
> Fixes compilation under musl 1.2.0
>
> Signed-off-by: Rosen Penev 
> ---
>  service.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/service.c b/service.c
> index 97b6f91..f9d3b48 100644
> --- a/service.c
> +++ b/service.c
> @@ -122,7 +122,7 @@ service_timeout(struct service *s)
> time_t t = monotonic_time();
>
> if (t - s->t <= TOUT_LOOKUP) {
> -   DBG(2, "t=%lu, s->t=%lu, t - s->t = %lu\n", t, s->t, t - 
> s->t);
> +   DBG(2, "t=%lld, s->t=%lld, t - s->t = %lld\n", (int64_t)t, 
> (int64_t)s->t, (int64_t)(t - s->t));
Please use PRId64 iso lld

Hans
> return 0;
> }
>
> --
> 2.25.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv3] odhcpd: fix compilation with musl 1.2.0

2020-03-26 Thread Hans Dedecker
On Thu, Mar 26, 2020 at 12:13 AM Rosen Penev  wrote:
>
> SYS_clock_gettime is gone with musl 1.2.0. Switched to the function.
>
> Also fixed two format strings that fail as time_t is 64-bit with 1.2.0.
>
> Signed-off-by: Rosen Penev 
> ---
>  v3: no need for linking to librt
>  v2: switch to function
>  src/dhcpv6-ia.c | 8 
>  src/odhcpd.c| 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
> index 1a13945..01b0939 100644
> --- a/src/dhcpv6-ia.c
> +++ b/src/dhcpv6-ia.c
> @@ -338,12 +338,12 @@ void dhcpv6_ia_write_statefile(void)
> odhcpd_hexlify(duidbuf, 
> ctxt.c->clid_data, ctxt.c->clid_len);
>
> /* iface DUID iaid hostname lifetime 
> assigned length [addrs...] */
> -   ctxt.buf_idx = snprintf(ctxt.buf, 
> ctxt.buf_len, "# %s %s %x %s%s %ld %x %u ",
> +   ctxt.buf_idx = snprintf(ctxt.buf, 
> ctxt.buf_len, "# %s %s %x %s%s %lld %x %u ",
Please use PRId64 iso lld
> 
> ctxt.iface->ifname, duidbuf, ntohl(ctxt.c->iaid),
> 
> (ctxt.c->flags & OAF_BROKEN_HOSTNAME) ? "broken\\x20" : "",
> 
> (ctxt.c->hostname ? ctxt.c->hostname : "-"),
> 
> (ctxt.c->valid_until > now ?
> -   
> (ctxt.c->valid_until - now + wall_time) :
> +   
> (int64_t)(ctxt.c->valid_until - now + wall_time) :
> 
> (INFINITE_VALID(ctxt.c->valid_until) ? -1 : 0)),
> 
> ctxt.c->assigned, (unsigned)ctxt.c->length);
>
> @@ -368,12 +368,12 @@ void dhcpv6_ia_write_statefile(void)
> odhcpd_hexlify(duidbuf, c->hwaddr, 
> sizeof(c->hwaddr));
>
> /* iface DUID iaid hostname lifetime 
> assigned length [addrs...] */
> -   ctxt.buf_idx = snprintf(ctxt.buf, 
> ctxt.buf_len, "# %s %s ipv4 %s%s %ld %x 32 ",
> +   ctxt.buf_idx = snprintf(ctxt.buf, 
> ctxt.buf_len, "# %s %s ipv4 %s%s %lld %x 32 ",
Same here

Hans
> 
> ctxt.iface->ifname, duidbuf,
> (c->flags & 
> OAF_BROKEN_HOSTNAME) ? "broken\\x20" : "",
> (c->hostname 
> ? c->hostname : "-"),
> 
> (c->valid_until > now ?
> -   
> (c->valid_until - now + wall_time) :
> +   
> (int64_t)(c->valid_until - now + wall_time) :
> 
> (INFINITE_VALID(c->valid_until) ? -1 : 0)),
> 
> ntohl(c->addr));
>
> diff --git a/src/odhcpd.c b/src/odhcpd.c
> index 4b8e589..26094b1 100644
> --- a/src/odhcpd.c
> +++ b/src/odhcpd.c
> @@ -440,7 +440,7 @@ int odhcpd_urandom(void *data, size_t len)
>  time_t odhcpd_time(void)
>  {
> struct timespec ts;
> -   syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &ts);
> +   clock_gettime(CLOCK_MONOTONIC, &ts);
> return ts.tv_sec;
>  }
>
> --
> 2.25.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] netifd: fix compilation with musl 1.2.0

2020-03-25 Thread Hans Dedecker
On Wed, Mar 25, 2020 at 9:27 AM Petr Štetiar  wrote:
>
> Rosen Penev  [2020-03-24 22:56:19]:
>
> Hi,
>
> > --- a/system-linux.c
> > +++ b/system-linux.c
> > @@ -59,6 +59,10 @@
> >  #define IFA_FLAGS (IFA_MULTICAST + 1)
> >  #endif
> >
> > +#ifndef __NR_clock_gettime
> > +#define __NR_clock_gettime __NR_clock_gettime64
> > +#endif
>
> could you fix it by removing that probably now obsolete workaround by
> replacing that syscall() with direct clock_gettime()? Thanks!
I've the same opinion; so +1

Hans
>
> -- ynezz
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] netifd: use the 64-bit version of clock_gettime

2020-03-22 Thread Hans Dedecker
hi,

On Fri, Mar 20, 2020 at 10:59 PM Rosen Penev  wrote:
>
> Fixes compilation with musl 1.2.0 which removes this syscall.
>
> Signed-off-by: Rosen Penev 
> ---
>  system-linux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/system-linux.c b/system-linux.c
> index d533be8..902ab50 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -2421,7 +2421,7 @@ time_t system_get_rtime(void)
> struct timespec ts;
> struct timeval tv;
>
> -   if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts) == 0)
> +   if (syscall(__NR_clock_gettime64, CLOCK_MONOTONIC, &ts) == 0)
> return ts.tv_sec;
This breaks compilation on glibc

/home/dedeckeh/WDR4300_glibc_staging/build_dir/target-mips_24kc_glibc/netifd-2020-02-05-dbdef938/system-linux.c:2424:14:
error: '__NR_clock_gettime64' undeclared (first use in this function);
did you mean 'SYS_clock_gettime'?
  if (syscall(__NR_clock_gettime64, CLOCK_MONOTONIC, &ts) == 0)
  ^~~~
  SYS_clock_gettime

Hans
>
> if (gettimeofday(&tv, NULL) == 0)
> --
> 2.24.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] iproute2: revert add libcap support, enabled in ip-full

2020-03-16 Thread Hans Dedecker
Hi Mathias,

On Sun, Mar 15, 2020 at 11:40 PM Mathias Kresin  wrote:
>
> 05/03/2020 23:29, Alin Năstac:
> > On Thu, Mar 5, 2020 at 8:34 PM Mathias Kresin  wrote:
> >>
> >> This reverts commit a6da3f9ef746101b84a6f530f5a40de28341b69a.
> >
> > Not exactly a revert, since it keeps HAVE_CAP logic.
>
> Sure, I want to make sure that HAVE_CAP is really disabled.
>
> >> The libcap isn't as optional as the commit messages suggests. A hard
> >> dependency to the libcap package is added, which is only available in
> >> the external packages feed. Therefore it is impossible to package
> >> ip-full without having the external packages feed up and running, which
> >> is a regression to the former behaviour.
> >
> > The libcap support is by all means optional, otherwise iproute2 build
> > will fail when its missing.
>
> You describe exactly the issue I hit while building ip-full. During
> development I don't have any external/third-party feeds installed. And
> the OpenWrt base system shouldn't depend on external/third-party feeds.
> These feeds are an add on and by no means a requirement.
>
> > Besides, your commit actually removes this
> > dependency. If this is not a living proof of the facultative nature of
> > this dependency, I don't know what else is.
>
> Sorry, I don't get what you're trying to say.
>
> > One would argue that ip-full should correspond to the full fledged
> > version of the packet. If the dependency of an external package is the
> > issue, how about making a different variant with HAVE_CAP support? It
> > could be called ip-really-full (or ip-fullest).
>
> Try to get libcap into the OpenWrt base system and enable HAVE_CAP
> afterwards?
I'm in favor of this approach as currently a part of the ip-full
functionality is broken and I see ip-full for now and in the future as
a core package

Hans
>
> Mathias
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] iproute2: revert add libcap support, enabled in ip-full

2020-03-05 Thread Hans Dedecker
On Thu, Mar 5, 2020 at 8:34 PM Mathias Kresin  wrote:
>
> This reverts commit a6da3f9ef746101b84a6f530f5a40de28341b69a.
>
> The libcap isn't as optional as the commit messages suggests. A hard
> dependency to the libcap package is added, which is only available in
> the external packages feed. Therefore it is impossible to package
> ip-full without having the external packages feed up and running, which
> is a regression to the former behaviour.
>
> Signed-off-by: Mathias Kresin 
Acked-by: Hans Dedecker 
> ---
>  package/network/utils/iproute2/Makefile | 18 +-
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/package/network/utils/iproute2/Makefile 
> b/package/network/utils/iproute2/Makefile
> index 34b768a906..cff582283c 100644
> --- a/package/network/utils/iproute2/Makefile
> +++ b/package/network/utils/iproute2/Makefile
> @@ -47,7 +47,7 @@ $(call Package/iproute2/Default)
>   VARIANT:=full
>   PROVIDES:=ip
>   ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
> - DEPENDS:=+libnl-tiny +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libcap
> + DEPENDS:=+libnl-tiny +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
>  endef
>
>  define Package/tc
> @@ -55,43 +55,43 @@ $(call Package/iproute2/Default)
>TITLE:=Traffic control utility
>VARIANT:=tc
>PROVIDES:=tc
> -  DEPENDS:=+kmod-sched-core +libxtables +libelf 
> +(PACKAGE_devlink||PACKAGE_rdma):libmnl +PACKAGE_ip-full:libcap
> +  DEPENDS:=+kmod-sched-core +libxtables +libelf 
> +(PACKAGE_devlink||PACKAGE_rdma):libmnl
>  endef
>
>  define Package/genl
>  $(call Package/iproute2/Default)
>TITLE:=General netlink utility frontend
> -  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl 
> +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
> +  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl 
> +(PACKAGE_tc||PACKAGE_ip-full):libelf
>  endef
>
>  define Package/ip-bridge
>  $(call Package/iproute2/Default)
>TITLE:=Bridge configuration utility from iproute2
> -  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl 
> +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
> +  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl 
> +(PACKAGE_tc||PACKAGE_ip-full):libelf
>  endef
>
>  define Package/ss
>  $(call Package/iproute2/Default)
>TITLE:=Socket statistics utility
> -  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl 
> +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
> +  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl 
> +(PACKAGE_tc||PACKAGE_ip-full):libelf
>  endef
>
>  define Package/nstat
>  $(call Package/iproute2/Default)
>TITLE:=Network statistics utility
> -  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl 
> +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
> +  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl 
> +(PACKAGE_tc||PACKAGE_ip-full):libelf
>  endef
>
>  define Package/devlink
>  $(call Package/iproute2/Default)
>TITLE:=Network devlink utility
> -  DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf 
> +PACKAGE_ip-full:libcap
> +  DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
>  endef
>
>  define Package/rdma
>  $(call Package/iproute2/Default)
>TITLE:=Network rdma utility
> -  DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf 
> +PACKAGE_ip-full:libcap
> +  DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
>  endef
>
>  ifeq ($(BUILD_VARIANT),tiny)
> @@ -100,7 +100,7 @@ endif
>
>  ifeq ($(BUILD_VARIANT),full)
>HAVE_ELF:=y
> -  HAVE_CAP:=y
> +  HAVE_CAP:=n
>  endif
>
>  ifeq ($(BUILD_VARIANT),tc)
> --
> 2.17.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] iproute2: update to 5.5.0, enable LTO

2020-02-13 Thread Hans Dedecker
On Wed, Feb 12, 2020 at 1:24 PM DENG Qingfang  wrote:
>
> Update iproute2 to 5.5.0
> Enable LTO to save several KB of size
>
> Signed-off-by: DENG Qingfang 
Patch applied; thx

Hans
> ---
>  package/network/utils/iproute2/Makefile|  8 
>  .../network/utils/iproute2/patches/100-configure.patch |  2 +-
>  .../iproute2/patches/115-add-config-xtlibdir.patch |  2 +-
>  .../iproute2/patches/140-keep_libmnl_optional.patch|  2 +-
>  .../iproute2/patches/145-keep_libelf_optional.patch|  2 +-
>  .../iproute2/patches/150-keep_libcap_optional.patch|  2 +-
>  .../iproute2/patches/175-reduce-dynamic-syms.patch | 10 +-
>  .../iproute2/patches/180-drop_FAILED_POLICY.patch  |  2 +-
>  .../iproute2/patches/200-drop_libbsd_dependency.patch  |  2 +-
>  9 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/package/network/utils/iproute2/Makefile 
> b/package/network/utils/iproute2/Makefile
> index d11a13facc..34b768a906 100644
> --- a/package/network/utils/iproute2/Makefile
> +++ b/package/network/utils/iproute2/Makefile
> @@ -8,12 +8,12 @@
>  include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=iproute2
> -PKG_VERSION:=5.4.0
> -PKG_RELEASE:=2
> +PKG_VERSION:=5.5.0
> +PKG_RELEASE:=1
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
> -PKG_HASH:=fe97aa60a0d4c5ac830be18937e18dc3400ca713a33a89ad896ff1e3d46086ae
> +PKG_HASH:=bac543435cac208a11db44c9cc8e35aa902befef8750594654ee71941c388f7b
>  PKG_BUILD_PARALLEL:=1
>  PKG_BUILD_DEPENDS:=iptables
>  PKG_LICENSE:=GPL-2.0
> @@ -121,7 +121,7 @@ define Build/Configure
> > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
>  endef
>
> -TARGET_CFLAGS += -ffunction-sections -fdata-sections
> +TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
>  TARGET_LDFLAGS += -Wl,--gc-sections
>  TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
>
> diff --git a/package/network/utils/iproute2/patches/100-configure.patch 
> b/package/network/utils/iproute2/patches/100-configure.patch
> index 248b1c0e01..0c19b2086a 100644
> --- a/package/network/utils/iproute2/patches/100-configure.patch
> +++ b/package/network/utils/iproute2/patches/100-configure.patch
> @@ -1,6 +1,6 @@
>  --- a/configure
>  +++ b/configure
> -@@ -32,7 +32,8 @@ int main(int argc, char **argv) {
> +@@ -34,7 +34,8 @@ int main(int argc, char **argv) {
>   }
>   EOF
>
> diff --git 
> a/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch 
> b/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch
> index 720a7ac1e9..fa5ab8b9af 100644
> --- a/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch
> +++ b/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch
> @@ -8,5 +8,5 @@
>  +  CFLAGS += -DXT_LIB_DIR=\"$(XT_LIB_DIR)\"
>  +endif
>
> - YACC := bison
>   LEX := flex
> + CFLAGS += -DYY_NO_INPUT
> diff --git 
> a/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch 
> b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch
> index d255ae7b0e..20cd0766a1 100644
> --- a/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch
> +++ b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch
> @@ -1,6 +1,6 @@
>  --- a/configure
>  +++ b/configure
> -@@ -255,7 +255,7 @@ check_selinux()
> +@@ -257,7 +257,7 @@ check_selinux()
>
>   check_mnl()
>   {
> diff --git 
> a/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch 
> b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch
> index 2e3ad18809..d25c719f8e 100644
> --- a/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch
> +++ b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch
> @@ -1,6 +1,6 @@
>  --- a/configure
>  +++ b/configure
> -@@ -228,7 +228,7 @@ EOF
> +@@ -230,7 +230,7 @@ EOF
>
>   check_elf()
>   {
> diff --git 
> a/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch 
> b/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch
> index 05336a737c..d15549e3d2 100644
> --- a/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch
> +++ b/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch
> @@ -1,6 +1,6 @@
>  --- a/configure
>  +++ b/configure
> -@@ -313,7 +313,7 @@ EOF
> +@@ -315,7 +315,7 @@ EOF
>
>   check_cap()
>   {
> diff --git 
> a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch 
> b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch
> index 0385bd737b..545b3c2c06 100644
> --- a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch
> +++ b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch
> @@ -9,7 +9,7 @@
>   endif
>
>   TCLIB := tc_core.o
> -@@ -141,7 +141,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
> +@@ -140,7 +140,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
>   all: tc $(TCSO)
>
>   tc: $(TCOBJ) $(LIBNETLINK) libtc.a
> @@ -18,15 +18

Re: [OpenWrt-Devel] [netifd][PATCH] interface-ip: transfer prefix route ownership to kernel when IPv6 address becomes deprecated

2020-02-04 Thread Hans Dedecker
Hi Alin,
On Mon, Feb 3, 2020 at 4:27 PM Alin Nastac  wrote:
>
> From: Alin Nastac 
>
> When netifd manages the prefix route directly, it will remove it
> the moment prefix gets deprecated. This will make it impossible
> for the target to send ICMPv6 errors back to LAN devices still
> using the deprecated prefix, thus breaking the L-14 requirement
> of RFC 7084.
>
> Signed-off-by: Alin Nastac 
The patch fails to apply with the following error message :

Applying: interface-ip: transfer prefix route ownership to kernel when
IPv6 address becomes deprecated
error: sha1 information is lacking or useless (interface-ip.c).
error: could not build fake ancestor
Patch failed at 0001 interface-ip: transfer prefix route ownership to
kernel when IPv6 address becomes deprecated

Hans
> ---
>  interface-ip.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/interface-ip.c b/interface-ip.c
> index 91c305b..ff8f219 100644
> --- a/interface-ip.c
> +++ b/interface-ip.c
> @@ -913,7 +913,7 @@ interface_set_prefix_address(struct 
> device_prefix_assignment *assignment,
>
> addr.addr.in6 = assignment->addr;
> addr.mask = assignment->length;
> -   addr.flags = DEVADDR_INET6 | DEVADDR_OFFLINK;
> +   addr.flags = DEVADDR_INET6;
> addr.preferred_until = prefix->preferred_until;
> addr.valid_until = prefix->valid_until;
>
> @@ -960,6 +960,7 @@ interface_set_prefix_address(struct 
> device_prefix_assignment *assignment,
> route.addr = addr.addr;
> }
>
> +   addr.flags |= DEVADDR_OFFLINK;
> if (system_add_address(l3_downlink, &addr))
> return;
>
> --
> 2.7.4
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ccache: update to 3.7.7

2020-01-16 Thread Hans Dedecker
On Thu, Jan 16, 2020 at 4:36 PM DENG Qingfang  wrote:
>
> Update ccache to 3.7.7
>
> Release notes:
> https://ccache.dev/releasenotes.html#_ccache_3_7_7
>
> Signed-off-by: DENG Qingfang 
Patch applied, thx

Hans
> ---
>  tools/ccache/Makefile   | 4 ++--
>  tools/ccache/patches/100-honour-copts.patch | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile
> index 50a1a412a8..4e99207872 100644
> --- a/tools/ccache/Makefile
> +++ b/tools/ccache/Makefile
> @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk
>  include $(INCLUDE_DIR)/target.mk
>
>  PKG_NAME:=ccache
> -PKG_VERSION:=3.7.6
> +PKG_VERSION:=3.7.7
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  
> PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION)
> -PKG_HASH:=73e2633ac9bca387b5a39c72a8f85634670c4091dab639228c433898163c86c0
> +PKG_HASH:=b7c1d6d6fe42f18e424de92746af863e0bc85794da3d69e44300840c478c98cd
>
>  include $(INCLUDE_DIR)/host-build.mk
>
> diff --git a/tools/ccache/patches/100-honour-copts.patch 
> b/tools/ccache/patches/100-honour-copts.patch
> index 97bacae2d2..a3cef56213 100644
> --- a/tools/ccache/patches/100-honour-copts.patch
> +++ b/tools/ccache/patches/100-honour-copts.patch
> @@ -1,6 +1,6 @@
>  --- a/src/ccache.c
>  +++ b/src/ccache.c
> -@@ -2224,6 +2224,7 @@ calculate_object_hash(struct args *args,
> +@@ -2220,6 +2220,7 @@ calculate_object_hash(struct args *args,
> "CPLUS_INCLUDE_PATH",
> "OBJC_INCLUDE_PATH",
> "OBJCPLUS_INCLUDE_PATH", // clang
> --
> 2.24.1
>
>
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [OpenWrt-Devel, V3, 2/2] kmodloader: added -a arg to modprobe

2019-12-27 Thread Hans Dedecker
On Sat, Dec 21, 2019 at 2:32 AM Gerard Ryan  wrote:
>
> Does anyone have any tips on how to expedite the review of this patch?
> Am I missing something or is the patch malformed?
Patch looks fine; some style comments inline

Hans
>
> Thanks in advance,
> Gerard
>
> On Tue, Oct 22, 2019 at 7:08 PM Gerard Ryan  wrote:
> >
> > -a treats all non-op trailing arguments as module names
> > and attempts to load all of them. This behaviour mirrors the behaviour
> > of the respective -a in /tools/modprobe.c from https://git.kernel.org.
> >
> > This is primarily to satiate the multiple modules passed by
> > docker/libnetwork.
> >
> > Signed-off-by: Gerard Ryan 
> > ---
> > Compile tested: x86_x64, Hyper-V, OpenWrt Master
> > Run tested: x86_x64, Hyper-V, OpenWrt Master
> >
> > You can also find this patch on GitHub if you prefer.
> > https://github.com/G-M0N3Y-2503/openwrt-ubox-mirror/tree/feature_extend_modprobe_options
> >
> > Since https://patchwork.ozlabs.org/patch/1175792/ I adjusted some 
> > whitespace to indent more consistently and split the patch by the args they 
> > implement.
> > Since https://patchwork.ozlabs.org/patch/1179955/ I reworded the commit 
> > message to explain the functionality of -a
> >
> >  kmodloader.c | 68 +---
> >  1 file changed, 38 insertions(+), 30 deletions(-)
> >
> > diff --git a/kmodloader.c b/kmodloader.c
> > index 07b6700..838bc8c 100644
> > --- a/kmodloader.c
> > +++ b/kmodloader.c
> > @@ -681,6 +681,7 @@ static int print_modprobe_usage(void)
> > ULOG_INFO(
> > "Usage:\n"
> > "\tmodprobe [-q] [-v] filename\n"
> > +   "\tmodprobe -a [-q] [-v] filename [filename...]\n"
> > );
> >
> > return -1;
> > @@ -854,16 +855,20 @@ static int main_modinfo(int argc, char **argv)
> >
> >  static int main_modprobe(int argc, char **argv)
> >  {
> > +   int exit_code = EXIT_SUCCESS;
Group this line with the other int parameter declarations below; for
alignment with other functions like lsmod and rmmod I prefer to set
exit_code to 0.
Another alternative is to change this for all functions but then in a
separate patch.
> > struct module_node *mn;
> > struct module *m;
> > -   char *name;
> > -   char *mod = NULL;
> > +   int load_fail;
> > int log_level = LOG_WARNING;
> > int opt;
> > bool quiet = false;
> > +   bool use_all = false;
> >
> > -   while ((opt = getopt(argc, argv, "qv")) != -1 ) {
> > +   while ((opt = getopt(argc, argv, "aqv")) != -1 ) {
> > switch (opt) {
> > +   case 'a':
> > +   use_all = true;
> > +   break;
> > case 'q': /* s! */
> > quiet = true;
> > break;
> > @@ -882,48 +887,51 @@ static int main_modprobe(int argc, char **argv)
> > /* after print_modprobe_usage() so it won't be filtered out */
> > ulog_threshold(log_level);
> >
> > -   mod = argv[optind];
> > -
> > if (scan_module_folders())
> > return -1;
> >
> > if (scan_loaded_modules())
> > return -1;
> >
> > -   name = get_module_name(mod);
> > -   m = find_module(name);
> > -   if (m && m->state == LOADED) {
> > -   if (!quiet)
> > -   ULOG_ERR("%s is already loaded\n", name);
> > -   return 0;
> > -   } else if (!m) {
> > -   if (!quiet)
> > -   ULOG_ERR("failed to find a module named %s\n", 
> > name);
> > -   return -1;
> > -   } else {
> > -   int fail;
> > +   do {
> > +   char *name;
> >
> > -   m->state = PROBE;
> > +   name = get_module_name(argv[optind]);
> > +   m = find_module(name);
> >
> > -   fail = load_modprobe(true);
> > +   if (m && m->state == LOADED) {
> > +   if (!quiet)
> > +   ULOG_INFO("%s is already loaded\n", name);
> > +   } else if (!m) {
> > +   if (!quiet)
> > +   ULOG_ERR("failed to find a module named 
> > %s\n", name);
> > +   exit_code = EXIT_FAILURE;
Same as above use -1 for alignment with other functions
> > +   } else {
> > +   m->state = PROBE;
> > +   }
> >
> > -   if (fail) {
> > -   ULOG_ERR("%d module%s could not be probed\n",
> > -fail, (fail == 1) ? ("") : ("s"));
> > +   optind++;
> > +   } while (use_all && optind < argc);
> >
> > -   avl_for_each_element(&modules, mn, avl) {
> > -   if (mn->is_alias)
> > -   continue;
> > -

Re: [OpenWrt-Devel] Inquery

2019-12-11 Thread Hans Dedecker
On Wed, Dec 11, 2019 at 3:22 PM Daniel Golle  wrote:
>
> Hi Tomislav,
>
> On Wed, Dec 11, 2019 at 11:24:21AM +0100, Tom Psyborg wrote:
> > suck it
>
> As a community, we decided to give our self a set of minimal rules[1].
> And even though it is in the last position, rule #12 "Be nice to each
> other." is meant just as serious as all the other rules.
>
> So here, not for the first time, you are using language which has the
> only purpose to hurt other people (for which reason ever, it doesn't
> matter). This is therefore a very clear violation to the above
> mentioned rule. You statement "suck it" (guess what) is also an obvious
> and disgusting example of a masculist culture which hurts our community
> as a whole and I strongly believe we should not tolerate that.
>
> And yes this was a spam mail. And it's even needless to say that
> replying to a spam email in which ever way will always make it worse.
> But that's not the point here and I will not engage in any discussion
> on that matter.
>
> Please learn to behave or leave us alone.
>
> [1]: https://openwrt.org/rules

+1


>
>
> >
> > On 11/12/2019, rqgxfc  wrote:
> > >
> > >
> > > Hello Sir ,
> > >
> > > We are  a trading company named Shaanxi Hao Zi Guan Materials Co.,Ltd  . 
> > > Now
> > > we are very interested in your products , we will plan to  sell your
> > > products in the Chinese market . If you are interested in cooperation,
> > > please send us a catalog and pricelist .w
> > > Looking forward to receiving your reply .
> > >
> > > Best regards,
> > > Catherina
> >
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] The meaning of Signed-off-by for netifd [Was: Re: [PATCH netifd] interface: warn if ip6hint is truncated]

2019-12-03 Thread Hans Dedecker
On Tue, Dec 3, 2019 at 3:59 PM Uwe Kleine-König  wrote:
>
> Hello Hans,
>
> On 12/3/19 8:50 AM, Hans Dedecker wrote:
> > On Fri, Nov 29, 2019 at 9:29 PM Uwe Kleine-König  
> > wrote:
> >>
> >> On 11/29/19 8:50 PM, Hans Dedecker wrote:
> >>> On Wed, Nov 20, 2019 at 7:11 PM Uwe Kleine-König  
> >>> wrote:
> >>>>
> >>>> When for example a /60 is assigned to a network the last 4 bits of the
> >>>> ip6hint are unused. Emit a warning if any of these unused bits is set as
> >>>> it indicates that someone didn't understand how the hint is used. (As I
> >>>> did earlier today resulting in spending some time understanding the
> >>>> code.)
> >>> Patch applied with some minor tweaks
> >>> (https://git.openwrt.org/?p=project/netifd.git;a=commit;h=e45b1408284c05984b38a910a1f0a07d6c761397);
> >>
> >> The updated warning message is fine.
> >>
> >>> I added your SoB as this was missing in the patch
> >>
> >> I wonder what the significance of the SoB is given that a) it's not
> >> documented (at least in the netifd sources) and b) it seems to be ok to
> >> "fake" someone else's SoB and c) there are several commits in the newer
> >> history of netifd that don't have a SoB of either Author or Committer
> >> (or both).
> > For details why a SoB is required; see
> > https://openwrt.org/submitting-patches#sign_your_work.
> > If there're any commits in the netifd repo which don't have a SoB this
> > must rather stay an exception than becoming a general rule.
>
> ok, so you claim my SoB means that *I* confirmed that my change is
> compatible to the netifd's license. I didn't do that though.
>
> Even if it was me who added that line I doubt is has any relevance for
> netifd because nothing in the netifd sources explains what an SoB means.
> And the link you sent applies only to patches for openwrt, not netifd.
> (Also if this is the only place for openwrt where the significance of an
> SoB is described I wonder if this is relevant given that from the POV of
> openwrt.git the wiki is an external resource that can be modified by
> anyone. What if someone removes item (d) from the wiki or introduces an
> (e)?)
>
> Don't get me wrong, my patch is compatible to netifd's license. But if
> you want that netifd's license situation stays reasonably safe and
> clean, it IMHO cannot be that you add a SoB for someone else, and give
> that SoB a meaning that isn't documented for your project and assumes
> things about that someone else that you cannot know for sure. So if you
> require a formalism, please formalize it properly. (Of course INAL, but
> that's my understanding of how open source licensing works.)
I won't waste further my time and energy on this ...
I acted in good faith and next time if I find a patch from you without
SoB I will just simply reject it to avoid contra productive
discussions
Patches delivered for all projects (netifd/libubox/ubus/...)
maintained by OpenWrt must have a SoB in line what is described on the
Wiki; this does not solely apply to the OpenWrt repo

This closes the discussion for me

Hans
>
> Best regards
> Uwe
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH netifd] interface: warn if ip6hint is truncated

2019-12-02 Thread Hans Dedecker
Hi,

On Fri, Nov 29, 2019 at 9:29 PM Uwe Kleine-König  wrote:
>
> On 11/29/19 8:50 PM, Hans Dedecker wrote:
> > On Wed, Nov 20, 2019 at 7:11 PM Uwe Kleine-König  
> > wrote:
> >>
> >> When for example a /60 is assigned to a network the last 4 bits of the
> >> ip6hint are unused. Emit a warning if any of these unused bits is set as
> >> it indicates that someone didn't understand how the hint is used. (As I
> >> did earlier today resulting in spending some time understanding the
> >> code.)
> > Patch applied with some minor tweaks
> > (https://git.openwrt.org/?p=project/netifd.git;a=commit;h=e45b1408284c05984b38a910a1f0a07d6c761397);
>
> The updated warning message is fine.
>
> > I added your SoB as this was missing in the patch
>
> I wonder what the significance of the SoB is given that a) it's not
> documented (at least in the netifd sources) and b) it seems to be ok to
> "fake" someone else's SoB and c) there are several commits in the newer
> history of netifd that don't have a SoB of either Author or Committer
> (or both).
For details why a SoB is required; see
https://openwrt.org/submitting-patches#sign_your_work.
If there're any commits in the netifd repo which don't have a SoB this
must rather stay an exception than becoming a general rule.

Hans
>
> Best regards
> Uwe
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH netifd] interface: warn if ip6hint is truncated

2019-11-29 Thread Hans Dedecker
On Wed, Nov 20, 2019 at 7:11 PM Uwe Kleine-König  wrote:
>
> When for example a /60 is assigned to a network the last 4 bits of the
> ip6hint are unused. Emit a warning if any of these unused bits is set as
> it indicates that someone didn't understand how the hint is used. (As I
> did earlier today resulting in spending some time understanding the
> code.)
Patch applied with some minor tweaks
(https://git.openwrt.org/?p=project/netifd.git;a=commit;h=e45b1408284c05984b38a910a1f0a07d6c761397);
I added your SoB as this was missing in the patch

Hans
> ---
>  interface.c | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/interface.c b/interface.c
> index 028dc6ccd5e5..839de0bb88ad 100644
> --- a/interface.c
> +++ b/interface.c
> @@ -863,9 +863,15 @@ interface_alloc(const char *name, struct blob_attr 
> *config, bool dynamic)
> }
>
> iface->assignment_hint = -1;
> -   if ((cur = tb[IFACE_ATTR_IP6HINT]))
> -   iface->assignment_hint = strtol(blobmsg_get_string(cur), 
> NULL, 16) &
> -   ~((1 << (64 - iface->assignment_length)) - 1);
> +   if ((cur = tb[IFACE_ATTR_IP6HINT])) {
> +   int32_t assignment_hint = strtol(blobmsg_get_string(cur), 
> NULL, 16);
> +
> +   iface->assignment_hint = assignment_hint & ~((1 << (64 - 
> iface->assignment_length)) - 1);
> +
> +   if (iface->assignment_hint != assignment_hint)
> +   netifd_log_message(L_WARNING, "Ignoring set bits of 
> assignment hint for interface '%s'\n",
> +  iface->name);
> +   }
>
> if ((cur = tb[IFACE_ATTR_IP6CLASS]))
> interface_add_assignment_classes(iface, cur);
> --
> 2.24.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] netifd: dhcp proto convert release to norelease

2019-11-19 Thread Hans Dedecker
On Tue, Nov 19, 2019 at 4:12 PM Kevin Darbyshire-Bryant
 wrote:
>
> Change dhcp no/release on shutdown to 'norelease' uci option to match
> existing proto dhcpv6 usage.
>
> Signed-off-by: Kevin Darbyshire-Bryant 
Acked-by: Hans Dedecker 
> ---
> v2 - store the migrate script under netifd structure instead of as part
> of base-files
>
>  package/network/config/netifd/Makefile|  2 +-
>  .../etc/uci-defaults/14_migrate-dhcp-release  | 23 +++
>  .../netifd/files/lib/netifd/proto/dhcp.sh | 10 
>  3 files changed, 29 insertions(+), 6 deletions(-)
>  create mode 100644 
> package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
>
> diff --git a/package/network/config/netifd/Makefile 
> b/package/network/config/netifd/Makefile
> index 875628f66a..e24ebaba30 100644
> --- a/package/network/config/netifd/Makefile
> +++ b/package/network/config/netifd/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=netifd
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>
>  PKG_SOURCE_PROTO:=git
>  PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
> diff --git 
> a/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
>  
> b/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
> new file mode 100644
> index 00..651c437cb2
> --- /dev/null
> +++ 
> b/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
> @@ -0,0 +1,23 @@
> +. /lib/functions.sh
> +
> +migrate_release() {
> +   local config="$1"
> +   local proto
> +   local release
> +
> +   config_get proto "$config" proto
> +   config_get release "$config" release
> +
> +   [ "$proto" = "dhcp" ] && [ -n "$release" ] && {
> +   norelease="$((!$release))"
> +   uci_set network "$config" norelease "$norelease"
> +   uci_remove network "$config" release
> +   }
> +
> +}
> +
> +config_load network
> +config_foreach migrate_release interface
> +commit network
> +
> +exit 0
> diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh 
> b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
> index 0d06eba06e..3034b2ba68 100755
> --- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
> +++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
> @@ -14,7 +14,7 @@ proto_dhcp_init_config() {
> proto_config_add_string clientid
> proto_config_add_string vendorid
> proto_config_add_boolean 'broadcast:bool'
> -   proto_config_add_boolean 'release:bool'
> +   proto_config_add_boolean 'norelease:bool'
> proto_config_add_string 'reqopts:list(string)'
> proto_config_add_boolean 'defaultreqopts:bool'
> proto_config_add_string iface6rd
> @@ -35,8 +35,8 @@ proto_dhcp_setup() {
> local config="$1"
> local iface="$2"
>
> -   local ipaddr hostname clientid vendorid broadcast release reqopts 
> defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes 
> classlessroute
> -   json_get_vars ipaddr hostname clientid vendorid broadcast release 
> reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes 
> classlessroute
> +   local ipaddr hostname clientid vendorid broadcast norelease reqopts 
> defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes 
> classlessroute
> +   json_get_vars ipaddr hostname clientid vendorid broadcast norelease 
> reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes 
> classlessroute
>
> local opt dhcpopts
> for opt in $reqopts; do
> @@ -50,7 +50,7 @@ proto_dhcp_setup() {
>
> [ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts=
> [ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
> -   [ "$release" = 1 ] && release="-R" || release=
> +   [ "$norelease" = 1 ] && norelease="" || norelease="-R"
> [ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || 
> clientid="-C"
> [ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
> [ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append 
> dhcpopts "-O 212"
> @@ -70,7 +70,7 @@ proto_dhcp_setup() {
> ${ipaddr:+-r $ipaddr} \
> ${hostname:+-x "hostname:$hostname"} \
> ${vendorid:+-V "$vendorid"} \
> -   $clientid $defaultreqopts $broadcast $release $dhcpopts
> +   $clientid $defaultreqopts $broadcast $norelease $dhcpopts
>  }
>
>  proto_dhcp_renew() {
> --
> 2.21.0 (Apple Git-122.2)
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] script hook for odhcpd

2019-11-09 Thread Hans Dedecker
On Sat, Nov 9, 2019 at 2:43 AM Alberto Bursi  wrote:
>
> I'm adding hotplug.d support to all DHCP events.
> For now only dnsmasq triggers them, with
> openwrt/package/network/services/dnsmasq/files/dhcp-script.sh
>
> DHCP clients like udcpc and udcp6c are easy to add as the client calls
> a script hook with documented arguments and environment
> variables I can pass to scripts in hotplug.d/dhcp.
>
> I'm not finding anything useful for odhcpd.
>
> It does have a similar script,
> openwrt/package/network/services/odhcpd/files/odhcpd-update
> that is called "lease trigger", and currently just calls dnsmasq to
> reload hosts file.
>
> It does not seem to be called with any argument or environmental variable I
> can use for hotplug scripts.
That's correct; odhcpd has no hotplug script support at the moment
triggered by DHCP(v6) lease changes.
>
> I can also use its ubus API to get a list of ipv4 leases or ipv6 leases.
>
> Did I miss something? Any ideas to implement DHCP hotplug in ipv6 server?
What is your exact use case ?

Hans
>
>
> -Alberto
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] odhcpd: router: Fix out of scope memory access

2019-09-03 Thread Hans Dedecker
On Mon, Sep 2, 2019 at 10:30 PM Hauke Mehrtens  wrote:
>
> A pointer to search_buf is accessed by search_domain outside of the
> if branch which defines search_buf. The compiler could already reuse
> this memory.
>
> Coverity: #1445747
> Signed-off-by: Hauke Mehrtens 
> ---
Patch applied; thx

Hans
>  src/router.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/router.c b/src/router.c
> index 07dd146..700e1ff 100644
> --- a/src/router.c
> +++ b/src/router.c
> @@ -607,6 +607,7 @@ static int send_router_advert(struct interface *iface, 
> const struct in6_addr *fr
> struct in6_addr dns_pref, *dns_addr = NULL;
> size_t dns_cnt = 0, search_len = iface->search_len;
> uint8_t *search_domain = iface->search;
> +   uint8_t search_buf[256];
>
> /* DNS Recursive DNS */
> if (iface->dns_cnt > 0) {
> @@ -630,8 +631,6 @@ static int send_router_advert(struct interface *iface, 
> const struct in6_addr *fr
>
> /* DNS Search options */
> if (!search_domain && !res_init() && _res.dnsrch[0] && 
> _res.dnsrch[0][0]) {
> -   uint8_t search_buf[256];
> -
> int len = dn_comp(_res.dnsrch[0], search_buf,
> sizeof(search_buf), NULL, NULL);
> if (len > 0) {
> --
> 2.20.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] procd: fix shutdown when running in a container

2019-08-07 Thread Hans Dedecker
On Mon, Aug 5, 2019 at 6:09 PM Paul Spooren  wrote:
>
> Applies patch from @mikma [0] to fix Docker shutdown. Added detection to
> state.c if running in a containre or not.
>
> Tested with a x86/64 Docker image.
>
> Fixes FS#2425
>
> CC: Mikael Magnusson 
> CC: Petr Štetiar 
>
> [0]: 
> https://github.com/mikma/lxd-openwrt/blob/master/patches/procd-master/0003-docker-fix-problem-stopping-container.patch
>
> Signed-off-by: Paul Spooren 
Patch applied with some style changes

Hans
> ---
>  state.c | 25 +++--
>  1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/state.c b/state.c
> index ccf4104..b7cba88 100644
> --- a/state.c
> +++ b/state.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>
> +#include "container.h"
>  #include "procd.h"
>  #include "syslog.h"
>  #include "plug/hotplug.h"
> @@ -157,18 +158,22 @@ static void state_enter(void)
> else
> LOG("- reboot -\n");
>
> -   /* Allow time for last message to reach serial console, etc */
> -   sleep(1);
> +   if(!is_container()) {
> +   /* Allow time for last message to reach serial 
> console, etc */
> +   sleep(1);
>
> -   /* We have to fork here, since the kernel calls 
> do_exit(EXIT_SUCCESS)
> -* in linux/kernel/sys.c, which can cause the machine to 
> panic when
> -* the init process exits... */
> -   if (!vfork( )) { /* child */
> -   reboot(reboot_event);
> -   _exit(EXIT_SUCCESS);
> +   /* We have to fork here, since the kernel calls 
> do_exit(EXIT_SUCCESS)
> +* in linux/kernel/sys.c, which can cause the machine 
> to panic when
> +* the init process exits... */
> +   if (!vfork( )) { /* child */
> +   reboot(reboot_event);
> +   _exit(EXIT_SUCCESS);
> +   }
> +   while (1)
> +   sleep(1);
> +   } else {
> +   exit(0);
> }
> -   while (1)
> -   sleep(1);
>  #else
> exit(0);
>  #endif
> --
> 2.20.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH-18.06] omcproxy: fix compilation on little-endian CPUs

2019-08-05 Thread Hans Dedecker
Hi,

On Tue, Jul 23, 2019 at 5:02 AM Rosen Penev  wrote:
>
> From: Eneas U de Queiroz 
>
> Don't use cpu_to_be32 outside of a function.
>
> Signed-off-by: Eneas U de Queiroz 
This patch has already been applied in the past; see
https://git.openwrt.org/?p=project/omcproxy.git;a=commit;h=722151f04348cf1b759613c087bced52fb45790a

Hans
> ---
>  Please backport to 18.06
>  
> https://downloads.openwrt.org/releases/faillogs-18.06/arm_cortex-a9_vfpv3/base/omcproxy/compile.txt
>  package/network/services/omcproxy/Makefile|  2 +-
>  ...-use-cpu_to_be32-outside-of-function.patch | 35 +++
>  2 files changed, 36 insertions(+), 1 deletion(-)
>  create mode 100644 
> package/network/services/omcproxy/patches/100-mrib.c-don-t-use-cpu_to_be32-outside-of-function.patch
>
> diff --git a/package/network/services/omcproxy/Makefile 
> b/package/network/services/omcproxy/Makefile
> index 28de833a1c..e121fa0b23 100644
> --- a/package/network/services/omcproxy/Makefile
> +++ b/package/network/services/omcproxy/Makefile
> @@ -8,7 +8,7 @@
>  include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=omcproxy
> -PKG_RELEASE:=4
> +PKG_RELEASE:=5
>
>  PKG_SOURCE_URL:=https://github.com/sbyx/omcproxy.git
>  PKG_SOURCE_PROTO:=git
> diff --git 
> a/package/network/services/omcproxy/patches/100-mrib.c-don-t-use-cpu_to_be32-outside-of-function.patch
>  
> b/package/network/services/omcproxy/patches/100-mrib.c-don-t-use-cpu_to_be32-outside-of-function.patch
> new file mode 100644
> index 00..d71315b60e
> --- /dev/null
> +++ 
> b/package/network/services/omcproxy/patches/100-mrib.c-don-t-use-cpu_to_be32-outside-of-function.patch
> @@ -0,0 +1,35 @@
> +From 721064f2eb1dabe5bda63dcaff249b73ab891e6c Mon Sep 17 00:00:00 2001
> +From: Eneas U de Queiroz 
> +Date: Fri, 14 Dec 2018 15:13:41 -0200
> +Subject: [PATCH] mrib.c: don't use cpu_to_be32 outside of function
> +
> +cpu_to_be32 is not a constant, so it can't be used outside of a
> +function.
> +
> +Signed-off-by: Eneas U de Queiroz 
> +
> +--- a/src/mrib.c
>  b/src/mrib.c
> +@@ -21,6 +21,7 @@
> + #include 
> + #include 
> + #include 
> ++#include 
> + #include 
> + #include 
> + #include 
> +@@ -54,7 +55,13 @@ struct mrib_iface {
> +   struct uloop_timeout timer;
> + };
> +
> +-static uint32_t ipv4_rtr_alert = cpu_to_be32(0x9404);
> ++/* we can't use cpu_to_be32 outside a function */
> ++#if __BYTE_ORDER == __BIG_ENDIAN
> ++static uint32_t ipv4_rtr_alert = 0x9404;
> ++#else
> ++static uint32_t ipv4_rtr_alert = 0x0494;
> ++#endif
> ++
> + static struct {
> +   struct ip6_hbh hdr;
> +   struct ip6_opt_router rt;
> --
> 2.17.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ppp: Add missing headers

2019-07-17 Thread Hans Dedecker
Hi,

On Thu, Jul 18, 2019 at 3:36 AM Rosen Penev  wrote:
>
> Fixes compilation with -Werror=implicit-function-declaration.
>
> Patch submitted upstream: https://github.com/paulusmack/ppp/pull/124
The upstream patch is not in line with the expected standards as
described in 
https://github.com/paulusmack/ppp/commit/347904e33a8a1993316e57445a1ba8243cd947ce

Hans
>
> Signed-off-by: Rosen Penev 
> ---
>  package/network/services/ppp/Makefile |  2 +-
>  .../services/ppp/patches/700-musl.patch   | 22 +++
>  2 files changed, 23 insertions(+), 1 deletion(-)
>  create mode 100644 package/network/services/ppp/patches/700-musl.patch
>
> diff --git a/package/network/services/ppp/Makefile 
> b/package/network/services/ppp/Makefile
> index c8016dc619..7f266e126b 100644
> --- a/package/network/services/ppp/Makefile
> +++ b/package/network/services/ppp/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>  include $(INCLUDE_DIR)/kernel.mk
>
>  PKG_NAME:=ppp
> -PKG_RELEASE:=2
> +PKG_RELEASE:=3
>
>  PKG_SOURCE_PROTO:=git
>  PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
> diff --git a/package/network/services/ppp/patches/700-musl.patch 
> b/package/network/services/ppp/patches/700-musl.patch
> new file mode 100644
> index 00..70fad9ef99
> --- /dev/null
> +++ b/package/network/services/ppp/patches/700-musl.patch
> @@ -0,0 +1,22 @@
> +From bbe58b9f83ba197d1cca1ca4338214e35f6131c8 Mon Sep 17 00:00:00 2001
> +From: Rosen Penev 
> +Date: Tue, 2 Jul 2019 12:53:12 -0700
> +Subject: [PATCH] pppd.h: Add missing headers
> +
> +---
> + pppd/pppd.h | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/pppd/pppd.h b/pppd/pppd.h
> +index 6e3743fd..b3470571 100644
> +--- a/pppd/pppd.h
>  b/pppd/pppd.h
> +@@ -50,6 +50,8 @@
> + #define __PPPD_H__
> +
> + #include /* for FILE */
> ++#include/* for encrypt */
> ++#include/* for setkey */
> + #include/* for NGROUPS_MAX */
> + #include /* for MAXPATHLEN and BSD4_4, if 
> defined */
> + #include /* for u_int32_t, if defined */
> --
> 2.17.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] wireguard: bump to 0.0.20190702

2019-07-02 Thread Hans Dedecker
On Tue, Jul 2, 2019 at 2:43 PM Jason A. Donenfeld  wrote:
>
> * curve25519: not all linkers support bmi2 and adx
>
> This should allow WireGuard to build on older toolchains.
>
> * global: switch to coarse ktime
>
> Our prior use of fast ktime before meant that sometimes, depending on how
> broken the motherboard was, we'd wind up calling into the HPET slow path. Here
> we move to coarse ktime which is always super speedy. In the process we had to
> fix the resolution of the clock, as well as introduce a new interface for it,
> landing in 5.3. Older kernels fall back to a fast-enough mechanism based on
> jiffies.
>
> https://lore.kernel.org/lkml/tip-e3ff9c3678b4d80e22d2557b68726174578ea...@git.kernel.org/
> https://lore.kernel.org/lkml/20190621203249.3909-3-ja...@zx2c4.com/
>
> * netlink: cast struct over cb->args for type safety
>
> This follow recent upstream changes such as:
>
> https://lore.kernel.org/lkml/20190628144022.31376-1-ja...@zx2c4.com/
>
> * peer: use LIST_HEAD macro
>
> Style nit.
>
> * receive: queue dead packets to napi queue instead of empty rx_queue
>
> This mitigates a WARN_ON being triggered by the workqueue code. It was quite
> hard to trigger, except sporadically, or reliably with a PC Engines ALIX, an
> extremely slow board with an AMD LX800 that Ryan Whelan of Axatrax was kind
> enough to mail me.
>
> Signed-off-by: Jason A. Donenfeld 
Patch applied; thx

Hand
> ---
>  package/network/services/wireguard/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/services/wireguard/Makefile 
> b/package/network/services/wireguard/Makefile
> index 310d559..0516769 100644
> --- a/package/network/services/wireguard/Makefile
> +++ b/package/network/services/wireguard/Makefile
> @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
>
>  PKG_NAME:=wireguard
>
> -PKG_VERSION:=0.0.20190601
> +PKG_VERSION:=0.0.20190702
>  PKG_RELEASE:=1
>
>  PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
> -PKG_HASH:=7528461824a0174bd7d4f15e68d8f0ce9a8ea318411502b80759438e8ef65568
> +PKG_HASH:=1a1311bc71abd47a72c47d918be3bacc486b3de90734661858af75cc990dbaac
>
>  PKG_LICENSE:=GPL-2.0 Apache-2.0
>  PKG_LICENSE_FILES:=COPYING
> --
> 2.21.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] nghttp2: deduplicate files in staging_dir

2019-06-22 Thread Hans Dedecker
On Fri, Jun 21, 2019 at 3:05 PM Eneas U de Queiroz via openwrt-devel
 wrote:
>
> The sender domain has a DMARC Reject/Quarantine policy which disallows
> sending mailing list messages using the original "From" header.
>
> To mitigate this problem, the original message has been wrapped
> automatically by the mailing list software.
>
>
> -- Forwarded message --
> From: Eneas U de Queiroz 
> To: openwrt-devel@lists.openwrt.org
> Cc: Eneas U de Queiroz 
> Bcc:
> Date: Fri, 21 Jun 2019 10:05:23 -0300
> Subject: [PATCH] nghttp2: deduplicate files in staging_dir
> '38b22b1e: deduplicate files in libnghttp2' missed duplicates in
> staging_dir by Build/InstallDev.
>
> Signed-off-by: Eneas U de Queiroz 
Patch pushed to master; thx

Hans
>
> diff --git a/package/libs/nghttp2/Makefile b/package/libs/nghttp2/Makefile
> index b96ebd8acb..2f0b4bcabc 100644
> --- a/package/libs/nghttp2/Makefile
> +++ b/package/libs/nghttp2/Makefile
> @@ -35,7 +35,7 @@ define Build/InstallDev
> $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/nghttp2/*.h 
> $(1)/usr/include/nghttp2/
> $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
> $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc 
> $(1)/usr/lib/pkgconfig/
> -   $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libnghttp2.so* 
> $(1)/usr/lib/
> +   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnghttp2.so* $(1)/usr/lib/
>  endef
>
>  define Package/libnghttp2/install
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/3] netsupport: improve xfrm module support

2019-06-16 Thread Hans Dedecker
On Sun, Jun 16, 2019 at 1:50 AM Andre Valentin  wrote:
>
> Hi!
> Am 15.06.19 um 21:35 schrieb Hans Dedecker:
> > Hi,
> >
> > On Fri, Jun 14, 2019 at 1:10 PM André Valentin  
> > wrote:
> >>
> >> -switch to module autoprobe
> >> -exclude 4.9 kernel
> >>
> >> Signed-off-by: André Valentin 
> >> ---
> >>  package/kernel/linux/modules/netsupport.mk | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/package/kernel/linux/modules/netsupport.mk 
> >> b/package/kernel/linux/modules/netsupport.mk
> >> index 20616d9af6..9732ee0d73 100644
> >> --- a/package/kernel/linux/modules/netsupport.mk
> >> +++ b/package/kernel/linux/modules/netsupport.mk
> >> @@ -386,10 +386,10 @@ $(eval $(call KernelPackage,ip6-vti))
> >>  define KernelPackage/xfrm-interface
> >>SUBMENU:=$(NETWORK_SUPPORT_MENU)
> >>TITLE:=IPsec XFRM Interface
> >> -  DEPENDS:=+kmod-ipsec4 +kmod-ipsec6 @!LINUX_4_14
> >> +  DEPENDS:=+kmod-ipsec4 +kmod-ipsec6 @!LINUX_4_14 @!LINUX_4_9
> > Is there a reason why you want to exclude kernel version 4.9 as in
> > master all targets will be switched to 4.19 and afaik no targets will
> > use 4.9
>
>
> It was Hauke Mehrtens wish, so I'm a bit in between.
Fine; I will check with Hauke

Hans
>
> Kind regards,
>
> André
>

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/3] netsupport: improve xfrm module support

2019-06-15 Thread Hans Dedecker
Hi,

On Fri, Jun 14, 2019 at 1:10 PM André Valentin  wrote:
>
> -switch to module autoprobe
> -exclude 4.9 kernel
>
> Signed-off-by: André Valentin 
> ---
>  package/kernel/linux/modules/netsupport.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/kernel/linux/modules/netsupport.mk 
> b/package/kernel/linux/modules/netsupport.mk
> index 20616d9af6..9732ee0d73 100644
> --- a/package/kernel/linux/modules/netsupport.mk
> +++ b/package/kernel/linux/modules/netsupport.mk
> @@ -386,10 +386,10 @@ $(eval $(call KernelPackage,ip6-vti))
>  define KernelPackage/xfrm-interface
>SUBMENU:=$(NETWORK_SUPPORT_MENU)
>TITLE:=IPsec XFRM Interface
> -  DEPENDS:=+kmod-ipsec4 +kmod-ipsec6 @!LINUX_4_14
> +  DEPENDS:=+kmod-ipsec4 +kmod-ipsec6 @!LINUX_4_14 @!LINUX_4_9
Is there a reason why you want to exclude kernel version 4.9 as in
master all targets will be switched to 4.19 and afaik no targets will
use 4.9

Hans
>KCONFIG:=CONFIG_XFRM_INTERFACE
>FILES:=$(LINUX_DIR)/net/xfrm/xfrm_interface.ko
> -  AUTOLOAD:=$(call AutoLoad,33,xfrm_interface)
> +  AUTOLOAD:=$(call AutoProbe,xfrm_interface)
>  endef
>
>  define KernelPackage/xfrm-interface/description
> --
> 2.11.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/3] netifd: fix xfrm interface deletion and standardize netlink call

2019-06-15 Thread Hans Dedecker
On Fri, Jun 14, 2019 at 1:10 PM André Valentin  wrote:
>
> -xfrm interfaces were deleted before
> -use standard parameters for xfrm interface created
>
> Signed-off-by: André Valentin 
Patch merged; thx

Hans
> ---
>  system-linux.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/system-linux.c b/system-linux.c
> index 6e5ca28..f63aeb2 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -2883,7 +2883,7 @@ static int system_add_xfrm_tunnel(const char *name, 
> const char *kind,
> struct blob_attr *cur;
> int ret = 0;
>
> -   nlm = nlmsg_alloc_simple(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_ACK | 
> NLM_F_CREATE | NLM_F_EXCL);
> +   nlm = nlmsg_alloc_simple(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_REPLACE | 
> NLM_F_CREATE);
> if (!nlm)
> return -1;
>
> @@ -3216,7 +3216,8 @@ static int __system_del_ip_tunnel(const char *name, 
> struct blob_attr **tb)
> if (!strcmp(str, "greip") || !strcmp(str, "gretapip") ||
> !strcmp(str, "greip6") || !strcmp(str, "gretapip6") ||
> !strcmp(str, "vtiip") || !strcmp(str, "vtiip6") ||
> -   !strcmp(str, "vxlan") || !strcmp(str, "vxlan6"))
> +   !strcmp(str, "vxlan") || !strcmp(str, "vxlan6") ||
> +   !strcmp(str, "xfrm"))
> return system_link_del(name);
> else
> return tunnel_ioctl(name, SIOCDELTUNNEL, NULL);
> --
> 2.11.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/3] network/config/xfrm: add host-dependency for xfrm interface parent

2019-06-15 Thread Hans Dedecker
On Fri, Jun 14, 2019 at 1:10 PM André Valentin  wrote:
>
> Add proto_add_host_dependency to add a dependency to the tunlink interface
>
> Signed-off-by: André Valentin 
Patch pushed to master; thx

Hans
> ---
>  package/network/config/xfrm/files/xfrm.sh | 19 +++
>  1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/package/network/config/xfrm/files/xfrm.sh 
> b/package/network/config/xfrm/files/xfrm.sh
> index df28d38613..4711bf2f55 100755
> --- a/package/network/config/xfrm/files/xfrm.sh
> +++ b/package/network/config/xfrm/files/xfrm.sh
> @@ -14,24 +14,27 @@ proto_xfrm_setup() {
> local tunlink ifid mtu zone
> json_get_vars tunlink ifid mtu zone
>
> -   proto_init_update "$cfg" 1
> -
> -   proto_add_tunnel
> -   json_add_string mode "$mode"
> -   json_add_int mtu "${mtu:-1280}"
> -
> [ -z "$tunlink" ] && {
> proto_notify_error "$cfg" NO_TUNLINK
> proto_block_restart "$cfg"
> exit
> }
> -   json_add_string link "$tunlink"
> -
> [ -z "$ifid" ] && {
> proto_notify_error "$cfg" NO_IFID
> proto_block_restart "$cfg"
> exit
> }
> +
> +   ( proto_add_host_dependency "$cfg" '' "$tunlink" )
> +
> +   proto_init_update "$cfg" 1
> +
> +   proto_add_tunnel
> +   json_add_string mode "$mode"
> +   json_add_int mtu "${mtu:-1280}"
> +
> +   json_add_string link "$tunlink"
> +
> json_add_object 'data'
> [ -n "$ifid" ] && json_add_int ifid "$ifid"
> json_close_object
> --
> 2.11.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v3 2/3] network/config: add xfrm interface support scripts

2019-06-13 Thread Hans Dedecker
On Thu, Jun 13, 2019 at 9:18 AM Andre Valentin  wrote:
>
> Hi!
>
> On 13.06.19 08:44, Hans Dedecker wrote:
> > Hi,
> >
> > On Wed, Jun 12, 2019 at 8:28 PM Andre Valentin  
> > wrote:
> >>
> >> Hi Hans!!
> >> Am 11.06.19 um 22:16 schrieb Hans Dedecker:
> >>> Hi,
> >>>
> >>> On Mon, Jun 10, 2019 at 8:10 PM Andre Valentin  
> >>> wrote:
> >>>>
> >>>> Hi Hans,
> >>>>
> >>>> after testing xfrm tunnels a bit I found to big differences compared to 
> >>>> other convential tunnels.
> >>>> 1) xfrm tunnel interfaces cannot be replaced with netlink
> >>>> 2) xfrm tunnel interfaces DO NOT vanish if parent is deleted
> >>>>
> >>>> This leads to some errors and a loop in interface creation. With the 
> >>>> changes below,
> >>>> it works smoothly when not bound to ppp interfaces (using lan instead), 
> >>>> see:
> >>>> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14255): Command 
> >>>> failed: Unknown error
> >>>> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is now 
> >>>> down
> >>>> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is 
> >>>> setting up now
> >>>> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14281): Command 
> >>>> failed: Unknown error
> >>>> and so on
> >>>>>> What do you think?
> >>> The description is a bit cryptic to me; could you explain what works
> >>> and what does not work and why ?
> >> Sorry for being cryptic, I tend to that;-) Okay, I do the following:
> >> # ifup xfrm0
> >> ... use it
> >> # ifdown xfrm0
> >> The interface still exists (checked with ip link)
> >>
> >> Now I'll do ifup again and this happens endlessly:
> >>>> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14255): Command 
> >>>> failed: Unknown error
> >>>> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is now 
> >>>> down
> >>>> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is 
> >>>> setting up now
> >>>> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14281): Command 
> >>>> failed: Unknown error
> >>
> >> In netifd the xfrm0 interface is created with the REPLACE flag, but that 
> >> does not seem to work, it cannot be recreated and fails.
> >> The result is the upper error repeating.
> >> That's why I think about the call to "ip link delete xfrm0" before 
> >> proto_init_update call and in the teardown call.
> > Adding the ip link calls does not make sense to me as netifd should
> > take care of deleting the xfrm interfaces
> > Are you sure the xfrm interfaces can be deleted by the ioctl call
> > SIOCDELTUNNEL as is the case now ?
> > For the other tunnel interfaces like vti/gre deletion is done via the
> > netlink interface.
>
> Good point, I will check that.
> >
> > Next to that I noticed a tunlink is specified in xfrm.sh but no
> > proto_add_host_dependency is added; is this on purpose ?
> Yes, that is on purpose. The tunlink specified is a must, but is noted
> used for decrypting and encrypting packets. It works on every interface.
>
> Also the XFRM interface has no IP endpoint, so there no possibility to
> add this to the interface, it would be only cosmetical.
You can install a proto_add_host_dependency on an interface (tunlink
in this case); so it's not required to have an IP endpoint.

Hans
>
> Thanks,
>
> André

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v3 2/3] network/config: add xfrm interface support scripts

2019-06-12 Thread Hans Dedecker
Hi,

On Wed, Jun 12, 2019 at 8:28 PM Andre Valentin  wrote:
>
> Hi Hans!!
> Am 11.06.19 um 22:16 schrieb Hans Dedecker:
> > Hi,
> >
> > On Mon, Jun 10, 2019 at 8:10 PM Andre Valentin  
> > wrote:
> >>
> >> Hi Hans,
> >>
> >> after testing xfrm tunnels a bit I found to big differences compared to 
> >> other convential tunnels.
> >> 1) xfrm tunnel interfaces cannot be replaced with netlink
> >> 2) xfrm tunnel interfaces DO NOT vanish if parent is deleted
> >>
> >> This leads to some errors and a loop in interface creation. With the 
> >> changes below,
> >> it works smoothly when not bound to ppp interfaces (using lan instead), 
> >> see:
> >> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14255): Command 
> >> failed: Unknown error
> >> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is now 
> >> down
> >> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is 
> >> setting up now
> >> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14281): Command 
> >> failed: Unknown error
> >> and so on
> >>>> What do you think?
> > The description is a bit cryptic to me; could you explain what works
> > and what does not work and why ?
> Sorry for being cryptic, I tend to that;-) Okay, I do the following:
> # ifup xfrm0
> ... use it
> # ifdown xfrm0
> The interface still exists (checked with ip link)
>
> Now I'll do ifup again and this happens endlessly:
> >> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14255): Command 
> >> failed: Unknown error
> >> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is now 
> >> down
> >> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is 
> >> setting up now
> >> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14281): Command 
> >> failed: Unknown error
>
> In netifd the xfrm0 interface is created with the REPLACE flag, but that does 
> not seem to work, it cannot be recreated and fails.
> The result is the upper error repeating.
> That's why I think about the call to "ip link delete xfrm0" before 
> proto_init_update call and in the teardown call.
Adding the ip link calls does not make sense to me as netifd should
take care of deleting the xfrm interfaces
Are you sure the xfrm interfaces can be deleted by the ioctl call
SIOCDELTUNNEL as is the case now ?
For the other tunnel interfaces like vti/gre deletion is done via the
netlink interface.

Next to that I noticed a tunlink is specified in xfrm.sh but no
proto_add_host_dependency is added; is this on purpose ?

Hans
>
> André
>
>
> >
> > Hans
> >>
> >> Kind regards,
> >>
> >> André
> >>
> >>
> >> Am 09.06.19 um 21:27 schrieb Hans Dedecker:
> >>> On Sat, Jun 8, 2019 at 1:48 PM André Valentin  
> >>> wrote:
> >>>>
> >>>> This package adds scripts for xfrm interfaces support.
> >>>> Example configuration via /etc/config/network:
> >>>>
> >>>> config interface 'xfrm0'
> >>>> option proto 'xfrm'
> >>>> option mtu '1300'
> >>>> option zone 'VPN'
> >>>> option tunlink 'wan'
> >>>> option ifid 30
> >>>>
> >>>> config interface 'xfrm0_static'
> >>>> option proto 'static'
> >>>> option ifname '@xfrm0'
> >>>> option ip6addr 'fe80::1/64'
> >>>> option ipaddr '10.0.0.1/30'
> >>>>
> >>>> Now set in strongswan IPsec policy:
> >>>> if_id_in = 30
> >>>> if_id_out = 30
> >>>> ---
> >>>>  package/network/config/xfrm/Makefile  | 38 ++
> >>>>  package/network/config/xfrm/files/xfrm.sh | 65 
> >>>> +++
> >>>>  2 files changed, 103 insertions(+)
> >>>>  create mode 100644 package/network/config/xfrm/Makefile
> >>>>  create mode 100755 package/network/config/xfrm/files/xfrm.sh
> >>>>
> >>>> diff --git a/package/network/config/xfrm/Makefile 
> >>>> b/package/network/config/xfrm/Makefile
> >>>> new file mode 100644
> >>>> index 

Re: [OpenWrt-Devel] [PATCH v3 2/3] network/config: add xfrm interface support scripts

2019-06-11 Thread Hans Dedecker
Hi,

On Mon, Jun 10, 2019 at 8:10 PM Andre Valentin  wrote:
>
> Hi Hans,
>
> after testing xfrm tunnels a bit I found to big differences compared to other 
> convential tunnels.
> 1) xfrm tunnel interfaces cannot be replaced with netlink
> 2) xfrm tunnel interfaces DO NOT vanish if parent is deleted
>
> This leads to some errors and a loop in interface creation. With the changes 
> below,
> it works smoothly when not bound to ppp interfaces (using lan instead), see:
> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14255): Command failed: 
> Unknown error
> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is now down
> Mon Jun 10 11:42:06 2019 daemon.notice netifd: Interface 'xfrm0' is setting 
> up now
> Mon Jun 10 11:42:06 2019 daemon.notice netifd: xfrm0 (14281): Command failed: 
> Unknown error
> and so on
>
> What do you think?
The description is a bit cryptic to me; could you explain what works
and what does not work and why ?

Hans
>
> Kind regards,
>
> André
>
>
> Am 09.06.19 um 21:27 schrieb Hans Dedecker:
> > On Sat, Jun 8, 2019 at 1:48 PM André Valentin  wrote:
> >>
> >> This package adds scripts for xfrm interfaces support.
> >> Example configuration via /etc/config/network:
> >>
> >> config interface 'xfrm0'
> >> option proto 'xfrm'
> >> option mtu '1300'
> >> option zone 'VPN'
> >> option tunlink 'wan'
> >> option ifid 30
> >>
> >> config interface 'xfrm0_static'
> >> option proto 'static'
> >> option ifname '@xfrm0'
> >> option ip6addr 'fe80::1/64'
> >> option ipaddr '10.0.0.1/30'
> >>
> >> Now set in strongswan IPsec policy:
> >> if_id_in = 30
> >> if_id_out = 30
> >> ---
> >>  package/network/config/xfrm/Makefile  | 38 ++
> >>  package/network/config/xfrm/files/xfrm.sh | 65 
> >> +++
> >>  2 files changed, 103 insertions(+)
> >>  create mode 100644 package/network/config/xfrm/Makefile
> >>  create mode 100755 package/network/config/xfrm/files/xfrm.sh
> >>
> >> diff --git a/package/network/config/xfrm/Makefile 
> >> b/package/network/config/xfrm/Makefile
> >> new file mode 100644
> >> index 00..efc90cf318
> >> --- /dev/null
> >> +++ b/package/network/config/xfrm/Makefile
> >> @@ -0,0 +1,38 @@
> >> +
> >> +include $(TOPDIR)/rules.mk
> >> +
> >> +PKG_NAME:=xfrm
> >> +PKG_VERSION:=1
> >> +PKG_RELEASE:=1
> >> +PKG_LICENSE:=GPL-2.0
> >> +
> >> +include $(INCLUDE_DIR)/package.mk
> >> +
> >> +define Package/xfrm/Default
> >> +  SECTION:=net
> >> +  CATEGORY:=Network
> >> +  MAINTAINER:=Andre Valentin 
> >> +endef
> >> +
> >> +define Package/xfrm
> >> +$(call Package/xfrm/Default)
> >> +  TITLE:=XFRM IPsec Tunnel Interface config support
> >> +  DEPENDS:=+kmod-xfrm-interface
> >> +endef
> >> +
> >> +define Package/xfrm/description
> >> + XFRM IPsec Tunnel Interface config support (IPv4 and IPv6) in 
> >> /etc/config/network.
> >> +endef
> >> +
> >> +define Build/Compile
> >> +endef
> >> +
> >> +define Build/Configure
> >> +endef
> >> +
> >> +define Package/xfrm/install
> >> +   $(INSTALL_DIR) $(1)/lib/netifd/proto
> >> +   $(INSTALL_BIN) ./files/xfrm.sh $(1)/lib/netifd/proto/xfrm.sh
> >> +endef
> >> +
> >> +$(eval $(call BuildPackage,xfrm))
> >> diff --git a/package/network/config/xfrm/files/xfrm.sh 
> >> b/package/network/config/xfrm/files/xfrm.sh
> >> new file mode 100755
> >> index 00..df28d38613
> >> --- /dev/null
> >> +++ b/package/network/config/xfrm/files/xfrm.sh
> >> @@ -0,0 +1,65 @@
> >> +#!/bin/sh
> >> +
> >> +[ -n "$INCLUDE_ONLY" ] || {
> >> +   . /lib/functions.sh
> >> +   . /lib/functions/network.sh
> >> +   . ../netifd-proto.sh
> >> +   init_proto "$@"
> >> +}
> >> +
> >> +proto_xfrm_setup() {
> >> +   local cfg="$1"
> >> +   local mode="xfrm"
> >> +
> >> +   local tunlink ifid mtu 

Re: [OpenWrt-Devel] [PATCH v3 2/3] network/config: add xfrm interface support scripts

2019-06-09 Thread Hans Dedecker
On Sat, Jun 8, 2019 at 1:48 PM André Valentin  wrote:
>
> This package adds scripts for xfrm interfaces support.
> Example configuration via /etc/config/network:
>
> config interface 'xfrm0'
> option proto 'xfrm'
> option mtu '1300'
> option zone 'VPN'
> option tunlink 'wan'
> option ifid 30
>
> config interface 'xfrm0_static'
> option proto 'static'
> option ifname '@xfrm0'
> option ip6addr 'fe80::1/64'
> option ipaddr '10.0.0.1/30'
>
> Now set in strongswan IPsec policy:
> if_id_in = 30
> if_id_out = 30
> ---
>  package/network/config/xfrm/Makefile  | 38 ++
>  package/network/config/xfrm/files/xfrm.sh | 65 
> +++
>  2 files changed, 103 insertions(+)
>  create mode 100644 package/network/config/xfrm/Makefile
>  create mode 100755 package/network/config/xfrm/files/xfrm.sh
>
> diff --git a/package/network/config/xfrm/Makefile 
> b/package/network/config/xfrm/Makefile
> new file mode 100644
> index 00..efc90cf318
> --- /dev/null
> +++ b/package/network/config/xfrm/Makefile
> @@ -0,0 +1,38 @@
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=xfrm
> +PKG_VERSION:=1
> +PKG_RELEASE:=1
> +PKG_LICENSE:=GPL-2.0
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/xfrm/Default
> +  SECTION:=net
> +  CATEGORY:=Network
> +  MAINTAINER:=Andre Valentin 
> +endef
> +
> +define Package/xfrm
> +$(call Package/xfrm/Default)
> +  TITLE:=XFRM IPsec Tunnel Interface config support
> +  DEPENDS:=+kmod-xfrm-interface
> +endef
> +
> +define Package/xfrm/description
> + XFRM IPsec Tunnel Interface config support (IPv4 and IPv6) in 
> /etc/config/network.
> +endef
> +
> +define Build/Compile
> +endef
> +
> +define Build/Configure
> +endef
> +
> +define Package/xfrm/install
> +   $(INSTALL_DIR) $(1)/lib/netifd/proto
> +   $(INSTALL_BIN) ./files/xfrm.sh $(1)/lib/netifd/proto/xfrm.sh
> +endef
> +
> +$(eval $(call BuildPackage,xfrm))
> diff --git a/package/network/config/xfrm/files/xfrm.sh 
> b/package/network/config/xfrm/files/xfrm.sh
> new file mode 100755
> index 00..df28d38613
> --- /dev/null
> +++ b/package/network/config/xfrm/files/xfrm.sh
> @@ -0,0 +1,65 @@
> +#!/bin/sh
> +
> +[ -n "$INCLUDE_ONLY" ] || {
> +   . /lib/functions.sh
> +   . /lib/functions/network.sh
> +   . ../netifd-proto.sh
> +   init_proto "$@"
> +}
> +
> +proto_xfrm_setup() {
> +   local cfg="$1"
> +   local mode="xfrm"
> +
> +   local tunlink ifid mtu zone
> +   json_get_vars tunlink ifid mtu zone
> +
> +   proto_init_update "$cfg" 1
> +
> +   proto_add_tunnel
> +   json_add_string mode "$mode"
> +   json_add_int mtu "${mtu:-1280}"
> +
> +   [ -z "$tunlink" ] && {
> +   proto_notify_error "$cfg" NO_TUNLINK
> +   proto_block_restart "$cfg"
> +   exit
> +   }
> +   json_add_string link "$tunlink"
> +
> +   [ -z "$ifid" ] && {
> +   proto_notify_error "$cfg" NO_IFID
> +   proto_block_restart "$cfg"
> +   exit
> +   }
> +   json_add_object 'data'
> +   [ -n "$ifid" ] && json_add_int ifid "$ifid"
> +   json_close_object
> +
> +   proto_close_tunnel
> +
> +   proto_add_data
> +   [ -n "$zone" ] && json_add_string zone "$zone"
> +   proto_close_data
> +
> +   proto_send_update "$cfg"
> +}
> +
> +proto_xfrm_teardown() {
> +   local cfg="$1"
> +}
> +
> +proto_xfrm_init_config() {
> +   no_device=1
> +   available=1
> +
> +   proto_config_add_int "mtu"
> +   proto_config_add_string "tunlink"
> +   proto_config_add_string "zone"
> +   proto_config_add_int "ifid"
> +}
> +
> +
> +[ -n "$INCLUDE_ONLY" ] || {
> +   [ -f /lib/modules/$(uname -r)/xfrm_interface.ko -o -d 
> /sys/module/xfrm_interface ] && add_protocol xfrm
I missed the check for /sys/module/xfrm_interface in my initial
review; is there any specific reason for this additional check beside
the xfrm_interface.ko check ?

Hans
> +}
> --
> 2.11.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2 1/3] kernel/netsupport: add xfrmi interface support

2019-06-08 Thread Hans Dedecker
On Fri, Jun 7, 2019 at 12:46 AM André Valentin  wrote:
>
> Add support for xfrm interfaces in kernel. XFRM interfaces are used by
> the IPsec stack for tunneling.
> XFRM interfaces are available since linux 4.19.
>
> ---
>  package/kernel/linux/modules/netsupport.mk | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/package/kernel/linux/modules/netsupport.mk 
> b/package/kernel/linux/modules/netsupport.mk
> index 1b6247643f..385c1c65ec 100644
> --- a/package/kernel/linux/modules/netsupport.mk
> +++ b/package/kernel/linux/modules/netsupport.mk
> @@ -380,6 +380,22 @@ endef
>
>  $(eval $(call KernelPackage,ip6-vti))
>
> +
> +define KernelPackage/xfrm-interface
> +  SUBMENU:=$(NETWORK_SUPPORT_MENU)
> +  TITLE:=IPsec XFRM Interface
> +  DEPENDS:=+kmod-ipsec4 +kmod-ipsec6 @LINUX_4_19
As you mention this is supported since 4.19; it's more future proof
using @!LINUX_4_14

Hans
> +  KCONFIG:=CONFIG_XFRM_INTERFACE
> +  FILES:=$(LINUX_DIR)/net/xfrm/xfrm_interface.ko
> +  AUTOLOAD:=$(call AutoLoad,33,xfrm_interface)
> +endef
> +
> +define KernelPackage/xfrm-interface/description
> + Kernel module for XFRM interface support
> +endef
> +
> +$(eval $(call KernelPackage,xfrm-interface))
> +
>
>  define KernelPackage/iptunnel4
>SUBMENU:=$(NETWORK_SUPPORT_MENU)
> --
> 2.11.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/3] netifd: add xfrm interface support scripts

2019-06-06 Thread Hans Dedecker
Hi,

Comments inline

Hans

On Thu, Jun 6, 2019 at 3:52 PM André Valentin  wrote:
>
> This package adds scripts for xfrm interfaces support.
> Example configuration via /etc/config/network:
>
> config interface 'xfrm0'
> option proto 'xfrm'
> option mtu '1300'
> option zone 'VPN'
> option tunlink 'wan'
> option ifid 30
>
> config interface 'xfrm0_static'
> option proto 'static'
> option ifname '@xfrm0'
> option ip6addr 'fe80::1/64'
> option ipaddr '10.0.0.1/30'
>
>
> ---
>  package/network/config/xfrm/Makefile  | 44 +
>  package/network/config/xfrm/files/xfrm.sh | 54 
> +++
>  2 files changed, 98 insertions(+)
>  create mode 100644 package/network/config/xfrm/Makefile
>  create mode 100755 package/network/config/xfrm/files/xfrm.sh
>
> diff --git a/package/network/config/xfrm/Makefile 
> b/package/network/config/xfrm/Makefile
> new file mode 100644
> index 00..943a4ba326
> --- /dev/null
> +++ b/package/network/config/xfrm/Makefile
> @@ -0,0 +1,44 @@
> +#
> +# Copyright (C) 2014 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
Please leave the Copyright header out as I don't think you have any
contractual agreement with OpenWrt
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=xfrm
> +PKG_VERSION:=1
> +PKG_RELEASE:=3
Why is PKG_RELEASE set to 3 ?
> +PKG_LICENSE:=GPL-2.0
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/xfrm/Default
> +  SECTION:=net
> +  CATEGORY:=Network
> +  MAINTAINER:=Andre Valentin 
> +endef
> +
> +define Package/xfrm
> +$(call Package/xfrm/Default)
> +  TITLE:=XFRM IPsec Tunnel Interface config support
> +  DEPENDS:=+kmod-xfrm-interface
> +endef
> +
> +define Package/xfrm/description
> + XFRM IPsec Tunnel Interface config support (IPv4 and IPv6) in 
> /etc/config/network.
> +endef
> +
> +define Build/Compile
> +endef
> +
> +define Build/Configure
> +endef
> +
> +define Package/xfrm/install
> +   $(INSTALL_DIR) $(1)/lib/netifd/proto
> +   $(INSTALL_BIN) ./files/xfrm.sh $(1)/lib/netifd/proto/xfrm.sh
> +endef
> +
> +$(eval $(call BuildPackage,xfrm))
> diff --git a/package/network/config/xfrm/files/xfrm.sh 
> b/package/network/config/xfrm/files/xfrm.sh
> new file mode 100755
> index 00..b93e090e90
> --- /dev/null
> +++ b/package/network/config/xfrm/files/xfrm.sh
> @@ -0,0 +1,54 @@
> +#!/bin/sh
> +
> +[ -n "$INCLUDE_ONLY" ] || {
> +   . /lib/functions.sh
> +   . /lib/functions/network.sh
> +   . ../netifd-proto.sh
> +   init_proto "$@"
> +}
> +
> +proto_xfrm_setup() {
> +   local cfg="$1"
> +   local mode="xfrm"
> +
> +   local df tunlink ifid mtu zone
> +   json_get_vars df tunlink ifid mtu zone
> +
> +   proto_init_update "$cfg" 1
> +
> +   proto_add_tunnel
> +   json_add_string mode "$mode"
> +   json_add_int mtu "${mtu:-1280}"
> +   [ -n "$tunlink" ] && json_add_string link "$tunlink"
> +
> +   json_add_object 'data'
> +   [ -n "$ifid" ] && json_add_int ifid "$ifid"
> +   json_close_object
> +
> +   proto_close_tunnel
> +
> +   proto_add_data
> +   [ -n "$zone" ] && json_add_string zone "$zone"
> +   proto_close_data
> +
> +   proto_send_update "$cfg"
> +}
> +
> +proto_xfrm_teardown() {
> +   local cfg="$1"
> +}
> +
> +proto_xfrm_init_config() {
> +   no_device=1
> +   available=1
> +
> +   proto_config_add_int "mtu"
> +   proto_config_add_string "tunlink"
> +   proto_config_add_string "zone"
> +   proto_config_add_int "ifid"
> +}
> +
> +
> +[ -n "$INCLUDE_ONLY" ] || {
> +   [ -f /lib/modules/$(uname -r)/xfrm_interface.ko -o -d 
> /sys/module/xfrm_interface ] && add_protocol xfrm
> +}
> --
> 2.11.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] wireguard: bump to 0.0.20190531

2019-05-31 Thread Hans Dedecker
On Fri, May 31, 2019 at 6:50 PM Jason A. Donenfeld  wrote:
>
> * tools: add wincompat layer to wg(8)
>
> Consistent with a lot of the Windows work we've been doing this last cycle,
> wg(8) now supports the WireGuard for Windows app by talking through a named
> pipe. You can compile this as `PLATFORM=windows make -C src/tools` with mingw.
> Because programming things for Windows is pretty ugly, we've done this via a
> separate standalone wincompat layer, so that we don't pollute our pretty *nix
> utility.
>
> * compat: udp_tunnel: force cast sk_data_ready
>
> This is a hack to work around broken Android kernel wrapper scripts.
>
> * wg-quick: freebsd: workaround SIOCGIFSTATUS race in FreeBSD kernel
>
> FreeBSD had a number of kernel race conditions, some of which we can vaguely
> work around. These are in the process of being fixed upstream, but probably
> people won't update for a while.
>
> * wg-quick: make darwin and freebsd path search strict like linux
>
> Correctness.
>
> * socket: set ignore_df=1 on xmit
>
> This was intended from early on but didn't work on IPv6 without the ignore_df
> flag. It allows sending fragments over IPv6.
>
> * qemu: use newer iproute2 and kernel
> * qemu: build iproute2 with libmnl support
> * qemu: do not check for alignment with ubsan
>
> The QEMU build system has been improved to compile newer versions. Linking
> against libmnl gives us better error messages. As well, enabling the alignment
> check on x86 UBSAN isn't realistic.
>
> * wg-quick: look up existing routes properly
> * wg-quick: specify protocol to ip(8), because of inconsistencies
>
> The route inclusion check was wrong prior, and Linux 5.1 made it break
> entirely. This makes a better invocation of `ip route show match`.
>
> * netlink: use new strict length types in policy for 5.2
> * kbuild: account for recent upstream changes
> * zinc: arm64: use cpu_get_elf_hwcap accessor for 5.2
>
> The usual churn of changes required for the upcoming 5.2.
>
> * timers: add jitter on ack failure reinitiation
>
> Correctness tweak in the timer system.
>
> * blake2s,chacha: latency tweak
> * blake2s: shorten ssse3 loop
>
> In every odd-numbered round, instead of operating over the state
> x00 x01 x02 x03
> x05 x06 x07 x04
> x10 x11 x08 x09
> x15 x12 x13 x14
> we operate over the rotated state
> x03 x00 x01 x02
> x04 x05 x06 x07
> x09 x10 x11 x08
> x14 x15 x12 x13
> The advantage here is that this requires no changes to the 'x04 x05 x06 x07'
> row, which is in the critical path. This results in a noticeable latency
> improvement of roughly R cycles, for R diagonal rounds in the primitive. As
> well, the blake2s AVX implementation is now SSSE3 and considerably shorter.
>
> * tools: allow setting WG_ENDPOINT_RESOLUTION_RETRIES
>
> System integrators can now specify things like
> WG_ENDPOINT_RESOLUTION_RETRIES=infinity when building wg(8)-based init
> scripts and services, or 0, or any other integer.
>
> Signed-off-by: Jason A. Donenfeld 
Patch applied to master; thx

Hans
> ---
>  package/network/services/wireguard/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/services/wireguard/Makefile 
> b/package/network/services/wireguard/Makefile
> index c04762b..e3471d0 100644
> --- a/package/network/services/wireguard/Makefile
> +++ b/package/network/services/wireguard/Makefile
> @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
>
>  PKG_NAME:=wireguard
>
> -PKG_VERSION:=0.0.20190406
> +PKG_VERSION:=0.0.20190531
>  PKG_RELEASE:=1
>
>  PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
> -PKG_HASH:=2f06f3adf70b95e74a7736a22dcf6e9ef623b311a15b7d55b5474e57c3d0415b
> +PKG_HASH:=8b0280322ec4c46fd1a786af4db0c4d0c600053542c4563582baac478e4127b1
>
>  PKG_LICENSE:=GPL-2.0 Apache-2.0
>  PKG_LICENSE_FILES:=COPYING
> --
> 2.21.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] ppp: add config options to tune discovery timeout and attempts

2019-05-29 Thread Hans Dedecker
Upstream PPP project has added in commit 8e77984 options to tune discovery
timeout and attempts in the rp-pppoe plugin.

Expose these options in the uci datamodel for pppoe:
padi_attempts: Number of discovery attempts
padi_timeout: Initial timeout for discovery packets in seconds

Signed-off-by: Hans Dedecker 
---
 package/network/services/ppp/Makefile | 2 +-
 package/network/services/ppp/files/ppp.sh | 7 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/package/network/services/ppp/Makefile 
b/package/network/services/ppp/Makefile
index 3b36444289..c8016dc619 100644
--- a/package/network/services/ppp/Makefile
+++ b/package/network/services/ppp/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ppp
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
diff --git a/package/network/services/ppp/files/ppp.sh 
b/package/network/services/ppp/files/ppp.sh
index 2d9ca6d284..b553effd88 100755
--- a/package/network/services/ppp/files/ppp.sh
+++ b/package/network/services/ppp/files/ppp.sh
@@ -210,6 +210,9 @@ proto_pppoe_init_config() {
proto_config_add_string "ac"
proto_config_add_string "service"
proto_config_add_string "host_uniq"
+   proto_config_add_int "padi_attempts"
+   proto_config_add_int "padi_timeout"
+
lasterror=1
 }
 
@@ -227,12 +230,16 @@ proto_pppoe_setup() {
json_get_var ac ac
json_get_var service service
json_get_var host_uniq host_uniq
+   json_get_var padi_attempts padi_attempts
+   json_get_var padi_timeout padi_timeout
 
ppp_generic_setup "$config" \
plugin rp-pppoe.so \
${ac:+rp_pppoe_ac "$ac"} \
${service:+rp_pppoe_service "$service"} \
${host_uniq:+host-uniq "$host_uniq"} \
+   ${padi_attempts:+pppoe-padi-attempts $padi_attempts} \
+   ${padi_timeout:+pppoe-padi-timeout $padi_timeout} \
"nic-$iface"
 }
 
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] ppp: update to version 2.4.7.git-2019-05-25

2019-05-29 Thread Hans Dedecker
8e77984 rp-pppoe plugin: Add options to tune discovery timeout and number of 
attempts

Signed-off-by: Hans Dedecker 
---
 package/network/services/ppp/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/services/ppp/Makefile 
b/package/network/services/ppp/Makefile
index d10f8f4832..3b36444289 100644
--- a/package/network/services/ppp/Makefile
+++ b/package/network/services/ppp/Makefile
@@ -13,9 +13,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
-PKG_SOURCE_DATE:=2019-05-18
-PKG_SOURCE_VERSION:=c9d9dbfb8459b528ab56bd1cf0c41460801bbfdf
-PKG_MIRROR_HASH:=9bd92ae9d32c6cee79e5fa55fd26e41c8c889461e3934e4b7519e3acdb91b2f1
+PKG_SOURCE_DATE:=2019-05-25
+PKG_SOURCE_VERSION:=8e77984ac5d7acbe68b2b2f590abd17564c9730d
+PKG_MIRROR_HASH:=7e7e74f0261db2c45770d79c6114e768382e85bfeb3f5a83179f270d6c15006d
 PKG_MAINTAINER:=Felix Fietkau 
 PKG_LICENSE:=BSD-4-Clause
 PKG_CPE_ID:=cpe:/a:samba:ppp
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] gre: introduce 'nohostroute' option

2019-05-26 Thread Hans Dedecker
Hi,
On Sun, May 26, 2019 at 12:19 PM Fabian Bläse via openwrt-devel
 wrote:
>
> The sender domain has a DMARC Reject/Quarantine policy which disallows
> sending mailing list messages using the original "From" header.
>
> To mitigate this problem, the original message has been wrapped
> automatically by the mailing list software.
>
>
> -- Forwarded message --
> From: "Fabian Bläse" 
> To: openwrt-devel@lists.openwrt.org
> Cc: "Fabian Bläse" 
> Bcc:
> Date: Sun, 26 May 2019 12:19:05 +0200
> Subject: [PATCH] gre: introduce 'nohostroute' option
> It is not always necessary to add a host route for the gre peer address.
>
> This introduces a new config option 'nohostroute' (similar to the
> option introduced for wireguard in d8e2e19) to allow to disable
> the creation of those routes explicitely.
>
> Signed-off-by: Fabian Bläse 
Trying to apply the patch I get :

git am 1105538.patch
Patch is empty.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Please use git send-email to deliver the patch

Hans
> ---
>  package/network/config/gre/files/gre.sh | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/package/network/config/gre/files/gre.sh 
> b/package/network/config/gre/files/gre.sh
> index 2bb1010b76..3414ed3047 100755
> --- a/package/network/config/gre/files/gre.sh
> +++ b/package/network/config/gre/files/gre.sh
> @@ -56,7 +56,7 @@ gre_setup() {
> local remoteip
>
> local ipaddr peeraddr
> -   json_get_vars df ipaddr peeraddr tunlink
> +   json_get_vars df ipaddr peeraddr tunlink nohostroute
>
> [ -z "$peeraddr" ] && {
> proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
> @@ -76,7 +76,9 @@ gre_setup() {
> break
> done
>
> -   ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
> +   if [ "${nohostroute}" != "1" ]; then
> +   ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
> +   fi
>
> [ -z "$ipaddr" ] && {
> local wanif="$tunlink"
> @@ -133,7 +135,7 @@ grev6_setup() {
> local remoteip6
>
> local ip6addr peer6addr weakif
> -   json_get_vars ip6addr peer6addr tunlink weakif encaplimit
> +   json_get_vars ip6addr peer6addr tunlink weakif encaplimit nohostroute
>
> [ -z "$peer6addr" ] && {
> proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
> @@ -153,7 +155,9 @@ grev6_setup() {
> break
> done
>
> -   ( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
> +   if [ "${nohostroute}" != "1" ]; then
> +   ( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
> +   fi
>
> [ -z "$ip6addr" ] && {
> local wanif="$tunlink"
> @@ -262,6 +266,7 @@ proto_gre_init_config() {
> proto_config_add_string "ipaddr"
> proto_config_add_string "peeraddr"
> proto_config_add_boolean "df"
> +   proto_config_add_boolean "nohostroute"
>  }
>
>  proto_gretap_init_config() {
> @@ -275,6 +280,7 @@ proto_grev6_init_config() {
> proto_config_add_string "peer6addr"
> proto_config_add_string "weakif"
> proto_config_add_string "encaplimit"
> +   proto_config_add_boolean "nohostroute"
>  }
>
>  proto_grev6tap_init_config() {
> --
> 2.21.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] uci: fix options list of section after type change

2019-05-23 Thread Hans Dedecker
On Fri, May 17, 2019 at 2:30 PM Sven Eckelmann  wrote:
>
> A section can store its name in the same memory region as the section
> (after the actual section object). The object is then reallocated when the
> type is later changed via an uci_set. But the original address of the
> section is (indirectly) stored in the section list, the object and the
> object list (HEAD) of this section.
>
> But only the section list was fixed in commit 4fb6a564b8ee ("clean up
> uci_set") after the realloc finished. Traversing the object list or
> accessing the section pointer caused heap-use-after-free errors.
>
> Reported-by: Charlemagne Lasse 
> Fixes: 4fb6a564b8ee ("clean up uci_set")
> Signed-off-by: Sven Eckelmann 
Patch applied; thx

Hans
> ---
> v2:
>  - drop unnecessary include of stdbool.h in cli.c
>
>  list.c | 31 +++
>  1 file changed, 31 insertions(+)
>
> diff --git a/list.c b/list.c
> index 25aec56..78efbaf 100644
> --- a/list.c
> +++ b/list.c
> @@ -182,6 +182,32 @@ static void uci_fixup_section(struct uci_context *ctx, 
> struct uci_section *s)
> s->e.name = uci_strdup(ctx, buf);
>  }
>
> +/* fix up option list HEAD pointers and pointer to section in options */
> +static void uci_section_fixup_options(struct uci_section *s, bool no_options)
> +{
> +   struct uci_element *e;
> +
> +   if (no_options) {
> +   /*
> +* enforce empty list pointer state (s->next == s) when 
> original
> +* section had no options in the first place
> +*/
> +   uci_list_init(&s->options);
> +   return;
> +   }
> +
> +   /* fix pointers to HEAD at end/beginning of list */
> +   uci_list_fixup(&s->options);
> +
> +   /* fix back pointer to section in options */
> +   uci_foreach_element(&s->options, e) {
> +   struct uci_option *o;
> +
> +   o = uci_to_option(e);
> +   o->section = s;
> +   }
> +}
> +
>  static struct uci_section *
>  uci_alloc_section(struct uci_package *p, const char *type, const char *name)
>  {
> @@ -713,10 +739,15 @@ int uci_set(struct uci_context *ctx, struct uci_ptr 
> *ptr)
> char *s = uci_strdup(ctx, ptr->value);
>
> if (ptr->s->type == uci_dataptr(ptr->s)) {
> +   /* drop the in-section storage of type name */
> +   bool no_options;
> +
> +   no_options = uci_list_empty(&ptr->s->options);
> ptr->last = NULL;
> ptr->last = uci_realloc(ctx, ptr->s, sizeof(struct 
> uci_section));
> ptr->s = uci_to_section(ptr->last);
> uci_list_fixup(&ptr->s->e.list);
> +   uci_section_fixup_options(ptr->s, no_options);
> } else {
> free(ptr->s->type);
> }
> --
> 2.20.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] interface-ip: fix find locally addressable target for p2p

2019-05-17 Thread Hans Dedecker
Hi,

On Fri, May 17, 2019 at 7:27 PM Tan Xiaofan  wrote:
>
> Hi
>
> > Can you share the network config which requires this patch ?
> >
> > Hans
>
> config interface 'wan'
> option ifname 'eth0'
> option proto 'dhcp'
>
> config interface 'iptun'
> option proto 'l2tp'
> option defaultroute '0'
> option server '192.168.100.1'   # l2tp server
>
> config interface 'veth'
> option proto 'gretap'
> option ipaddr '10.255.255.100'  # iptun ipaddr
> option peeraddr '10.255.255.1'  # iptun peeraddr
> # option tunlink 'iptun'
Thx for sharing the network config.
I've slightly reworked the patch
(https://git.openwrt.org/?p=project/netifd.git;a=commit;h=22e8e589fd6ab5d19dc1d3c9d1bcf2bfabf1fafb);
can you give it a try ?

Hans

> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] interface-ip: fix find locally addressable target for p2p

2019-05-17 Thread Hans Dedecker
On Fri, May 17, 2019 at 7:27 PM Tan Xiaofan  wrote:
>
> Hi
>
> > Can you share the network config which requires this patch ?
> >
> > Hans
>
> config interface 'wan'
> option ifname 'eth0'
> option proto 'dhcp'
>
> config interface 'iptun'
> option proto 'l2tp'
> option defaultroute '0'
> option server '192.168.100.1'   # l2tp server
>
> config interface 'veth'
> option proto 'gretap'
> option ipaddr '10.255.255.100'  # iptun ipaddr
> option peeraddr '10.255.255.1'  # iptun peeraddr
> # option tunlink 'iptun'
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] interface-ip: fix find locally addressable target for p2p

2019-05-17 Thread Hans Dedecker
Hi,

On Thu, May 16, 2019 at 8:00 PM Tan Xiaofan  wrote:
>
> Hi, the email replace TAB with SPACE, so apply failed.
> So, I put the patch file in my server
>
> 
> http://167.88.124.64/0001-interface-ip-fix-find-locally-addressable-target-for.patch
Can you share the network config which requires this patch ?

Hans
>
> >
> > Hi
> >
> > On Thu, May 16, 2019 at 5:09 PM Tan Xiaofan  wrote:
> > >
> > > Hi, I add some explanation to the patch
> > >
> > > From 57007eef77f266e40640a2c76aabd56fd37553f7 Mon Sep 17 00:00:00 2001
> > > From: xiaofan 
> > > Date: Thu, 16 May 2019 21:12:47 +0800
> > > Subject: [PATCH] interface-ip: fix find locally addressable target for p2p
> > >
> > > In case of tunnel over PPP(such as gretap over l2tp): tunnel interface
> > > use PPP's peer address as remote address, netifd script will call
> > > proto_add_host_dependency function, then netifd will search which device
> > > can reach to the remote address. Before the patch, netifd don't consider
> > > the PPP interface can reach to the remote address, so netifd will select
> > > default route to remote address, it will lead to remote address 
> > > unreachable.
> > The patch fails to apply with the updated commit description; please
> > resend after you've created the patch via git format-patch with the
> > updated git commit description
> >
> > Hans
> > >
> > > Signed-off-by: xiaofan 
> > > ---
> > >  interface-ip.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/interface-ip.c b/interface-ip.c
> > > index 6900cd7..8d5587c 100644
> > > --- a/interface-ip.c
> > > +++ b/interface-ip.c
> > > @@ -196,6 +196,9 @@ __find_ip_addr_target(struct interface_ip_settings 
> > > *ip, union if_addr *a, bool v
> > > if (v6 != ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6))
> > >  continue;
> > >
> > > +  if (!v6 && addr->point_to_point && a->in.s_addr == 
> > > addr->point_to_point)
> > > +   return true;
> > > +
> > > /* Handle offlink addresses correctly */
> > > unsigned int mask = addr->mask;
> > > if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6 &&
> > > --
> > > 2.17.1
> > >
> > >
> > >
> > >

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] interface-ip: fix find locally addressable target for p2p

2019-05-16 Thread Hans Dedecker
Hi

On Thu, May 16, 2019 at 5:09 PM Tan Xiaofan  wrote:
>
> Hi, I add some explanation to the patch
>
> From 57007eef77f266e40640a2c76aabd56fd37553f7 Mon Sep 17 00:00:00 2001
> From: xiaofan 
> Date: Thu, 16 May 2019 21:12:47 +0800
> Subject: [PATCH] interface-ip: fix find locally addressable target for p2p
>
> In case of tunnel over PPP(such as gretap over l2tp): tunnel interface
> use PPP's peer address as remote address, netifd script will call
> proto_add_host_dependency function, then netifd will search which device
> can reach to the remote address. Before the patch, netifd don't consider
> the PPP interface can reach to the remote address, so netifd will select
> default route to remote address, it will lead to remote address unreachable.
The patch fails to apply with the updated commit description; please
resend after you've created the patch via git format-patch with the
updated git commit description

Hans
>
> Signed-off-by: xiaofan 
> ---
>  interface-ip.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/interface-ip.c b/interface-ip.c
> index 6900cd7..8d5587c 100644
> --- a/interface-ip.c
> +++ b/interface-ip.c
> @@ -196,6 +196,9 @@ __find_ip_addr_target(struct interface_ip_settings *ip, 
> union if_addr *a, bool v
>if (v6 != ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6))
> continue;
>
> +  if (!v6 && addr->point_to_point && a->in.s_addr == addr->point_to_point)
> +   return true;
> +
>/* Handle offlink addresses correctly */
>unsigned int mask = addr->mask;
>if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6 &&
> --
> 2.17.1
>
>
>
>
> >
> > Hi,
> >
> > On Thu, May 16, 2019 at 4:01 PM Tan Xiaofan  wrote:
> > >
> > > From d0e1cb81b45ec825199d499cda9c8daef94e13a5 Mon Sep 17 00:00:00 2001
> > > From: xiaofan 
> > > Date: Thu, 16 May 2019 21:12:47 +0800
> > > Subject: [PATCH] interface-ip: fix find locally addressable target for p2p
> > The patch fails to explain why this change is required and what
> > usecase/problem it fixes.
> >
> > Hans
> > >
> > > Signed-off-by: xiaofan 
> > > ---
> > >  interface-ip.c | 4 
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/interface-ip.c b/interface-ip.c
> > > index 6900cd7..7ab8643 100644
> > > --- a/interface-ip.c
> > > +++ b/interface-ip.c
> > > @@ -196,6 +196,10 @@ __find_ip_addr_target(struct interface_ip_settings 
> > > *ip, union if_addr *a, bool v
> > >if (v6 != ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6))
> > > continue;
> > >
> > > +  if (!v6 && addr->point_to_point && a->in.s_addr == 
> > > addr->point_to_point) {
> > > +   return true;
> > > +  }
> > > +
> > >/* Handle offlink addresses correctly */
> > >unsigned int mask = addr->mask;
> > >if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6 &&
> > > --
> > > 2.17.1
> > >
> > >
> > > ___
> > > openwrt-devel mailing list
> > > openwrt-devel@lists.openwrt.org
> > > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> >

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] interface-ip: fix find locally addressable target for p2p

2019-05-16 Thread Hans Dedecker
Hi,

On Thu, May 16, 2019 at 4:01 PM Tan Xiaofan  wrote:
>
> From d0e1cb81b45ec825199d499cda9c8daef94e13a5 Mon Sep 17 00:00:00 2001
> From: xiaofan 
> Date: Thu, 16 May 2019 21:12:47 +0800
> Subject: [PATCH] interface-ip: fix find locally addressable target for p2p
The patch fails to explain why this change is required and what
usecase/problem it fixes.

Hans
>
> Signed-off-by: xiaofan 
> ---
>  interface-ip.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/interface-ip.c b/interface-ip.c
> index 6900cd7..7ab8643 100644
> --- a/interface-ip.c
> +++ b/interface-ip.c
> @@ -196,6 +196,10 @@ __find_ip_addr_target(struct interface_ip_settings *ip, 
> union if_addr *a, bool v
>if (v6 != ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6))
> continue;
>
> +  if (!v6 && addr->point_to_point && a->in.s_addr == addr->point_to_point) {
> +   return true;
> +  }
> +
>/* Handle offlink addresses correctly */
>unsigned int mask = addr->mask;
>if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6 &&
> --
> 2.17.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] procd: detect lxc container and behave accordingly

2019-05-05 Thread Hans Dedecker
On Sat, May 4, 2019 at 10:30 PM Paul Spooren  wrote:
>
> meaning to not mount some specific parts witch cause trouble.
>
> The patch is based on previous work of @mikma to combine OpenWrt with
> lxd[0]. This patch however adds a detection copied from *virt-what* to
> check /proc/1/environment for the string "container".
>
> Thanks to @dangowrt for the cleanup.
>
> [0]: 
> https://github.com/containercraft/openwrt-lxd/blob/master/patches/procd-openwrt-18.06/001_lxd_no_mounts.patch
>
> Signed-off-by: Paul Spooren 
> ---
>  container.h | 22 ++
>  initd/early.c   | 20 
>  initd/zram.c| 11 +++
>  plug/coldplug.c | 14 +-
>  4 files changed, 50 insertions(+), 17 deletions(-)
>  create mode 100644 container.h
>
> diff --git a/container.h b/container.h
> new file mode 100644
> index 000..c9b5e46
> --- /dev/null
> +++ b/container.h
> @@ -0,0 +1,22 @@
> +/*
> + * Copyright (C) 2019 Paul Spooren 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License version 2.1
> + * 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.
> + */
> +
> +#ifndef __CONTAINER_H
> +#define __CONTAINER_H
> +#include 
> +
> +static inline unsigned short int is_container() {
Let this function return a bool

Hans
> +   return !!getenv("container");
> +}
> +
> +#endif
> diff --git a/initd/early.c b/initd/early.c
> index 2e15112..7b281b2 100644
> --- a/initd/early.c
> +++ b/initd/early.c
> @@ -25,6 +25,7 @@
>  #include "../utils/utils.h"
>  #include "init.h"
>  #include "../libc-compat.h"
> +#include "../container.h"
>
>  static void
>  early_dev(void)
> @@ -56,14 +57,17 @@ early_mounts(void)
>  {
> unsigned int oldumask = umask(0);
>
> -   mount("proc", "/proc", "proc", MS_NOATIME | MS_NODEV | MS_NOEXEC | 
> MS_NOSUID, 0);
> -   mount("sysfs", "/sys", "sysfs", MS_NOATIME | MS_NODEV | MS_NOEXEC | 
> MS_NOSUID, 0);
> -   mount("cgroup", "/sys/fs/cgroup", "cgroup",  MS_NODEV | MS_NOEXEC | 
> MS_NOSUID, 0);
> -   mount("tmpfs", "/dev", "tmpfs", MS_NOATIME | MS_NOSUID, 
> "mode=0755,size=512K");
> -   ignore(symlink("/tmp/shm", "/dev/shm"));
> -   mkdir("/dev/pts", 0755);
> -   mount("devpts", "/dev/pts", "devpts", MS_NOATIME | MS_NOEXEC | 
> MS_NOSUID, "mode=600");
> -   early_dev();
> +   if (!is_container()) {
> +   mount("proc", "/proc", "proc", MS_NOATIME | MS_NODEV | 
> MS_NOEXEC | MS_NOSUID, 0);
> +   mount("sysfs", "/sys", "sysfs", MS_NOATIME | MS_NODEV | 
> MS_NOEXEC | MS_NOSUID, 0);
> +   mount("cgroup", "/sys/fs/cgroup", "cgroup",  MS_NODEV | 
> MS_NOEXEC | MS_NOSUID, 0);
> +   mount("tmpfs", "/dev", "tmpfs", MS_NOATIME | MS_NOSUID, 
> "mode=0755,size=512K");
> +   ignore(symlink("/tmp/shm", "/dev/shm"));
> +   mkdir("/dev/pts", 0755);
> +   mount("devpts", "/dev/pts", "devpts", MS_NOATIME | MS_NOEXEC 
> | MS_NOSUID, "mode=600");
> +
> +   early_dev();
> +   }
>
> early_console("/dev/console");
> if (mount_zram_on_tmp()) {
> diff --git a/initd/zram.c b/initd/zram.c
> index b41bfd9..487d3d6 100644
> --- a/initd/zram.c
> +++ b/initd/zram.c
> @@ -12,6 +12,7 @@
>  #include 
>
>  #include "../log.h"
> +#include "../container.h"
>
>  #include "init.h"
>
> @@ -116,10 +117,12 @@ mount_zram_on_tmp(void)
> waitpid(pid, NULL, 0);
> }
>
> -   ret = mount("/dev/zram0", "/tmp", "ext4", MS_NOSUID | MS_NODEV | 
> MS_NOATIME, "errors=continue,noquota");
> -   if (ret < 0) {
> -   ERROR("Can't mount /dev/zram0 on /tmp: %m\n");
> -   return errno;
> +   if (!is_container()) {
> +   ret = mount("/dev/zram0", "/tmp", "ext4", MS_NOSUID | 
> MS_NODEV | MS_NOATIME, "errors=continue,noquota");
> +   if (ret < 0) {
> +   ERROR("Can't mount /dev/zram0 on /tmp: %m\n");
> +   return errno;
> +   }
> }
>
> LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize);
> diff --git a/plug/coldplug.c b/plug/coldplug.c
> index c6a89c3..12df421 100644
> --- a/plug/coldplug.c
> +++ b/plug/coldplug.c
> @@ -22,6 +22,7 @@
>  #include "../libc-compat.h"
>
>  #include "hotplug.h"
> +#include "../container.h"
>
>  static struct uloop_process udevtrigger;
>
> @@ -43,13 +44,16 @@ void procd_coldplug(void)
> char *argv[] = { "udevtrigger", NULL };
> unsigned int oldumask = umask(0);
>
> -   umount2("/dev/pts", MNT_DETACH);
> -   umount2("/dev/", MNT_DETACH);
> -   mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755,size=512K"

Re: [OpenWrt-Devel] [PATCH v2 1/2] scripts/qemustart: no network by default and enable with -n

2019-04-25 Thread Hans Dedecker
On Thu, Apr 25, 2019 at 6:19 PM Yousong Zhou  wrote:
>
> This should make it easier to setup and possibly provide a "work out of
> the box" experience for most test usage.  With typical wan&lan
> networking setup being only two characters argument away.
>
> Cc: Petr Štetiar 
> Signed-off-by: Yousong Zhou 
Acked-by: Hans Dedecker 
> ---
> v2 <- v1
>
>  - Rebase on current master branch
>  - Fix logic invert in check_setup() of v1
>  - Reword commit message
>
>  scripts/qemustart | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/qemustart b/scripts/qemustart
> index 076d4bbcfe..8daeac69a8 100755
> --- a/scripts/qemustart
> +++ b/scripts/qemustart
> @@ -74,7 +74,7 @@ check_setup_() {
>  }
>
>  check_setup() {
> -   [ -z "$o_nonetwork" ] || return 0
> +   [ -n "$o_network" ] || return 0
> check_setup_ || {
> __errmsg "please check the script content to see the 
> environment requirement"
> return 1
> @@ -90,6 +90,7 @@ Usage: $SELF [-h|--help]
>   [--kernel ]
>   [--rootfs ]
>   [--machine ]
> + [-n|--network]
>
>   will default to "generic" and must be specified if
>   are present
> @@ -120,13 +121,14 @@ rand_mac() {
>  }
>
>  parse_args() {
> +   o_network=
> o_qemu_extra=()
> while [ "$#" -gt 0 ]; do
> case "$1" in
> -   --no-network|-n) o_nonetwork=1; shift ;;
> --kernel) o_kernel="$2"; shift 2 ;;
> --rootfs) o_rootfs="$2"; shift 2 ;;
> --machine|-machine|-M) o_mach="$2"; shift 2 ;;
> +   --network|-n) o_network=1; shift ;;
> --help|-h)
> usage
> exit 0
> @@ -187,7 +189,7 @@ start_qemu_armvirt() {
> )
> }
>
> -   [ -n "$o_nonetwork" ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
> "-device" 
> "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
> @@ -229,7 +231,7 @@ start_qemu_malta() {
> # NOTE: order of wan, lan -device arguments matters as it will affect 
> which
> # one will be actually used as the wan, lan network interface inside 
> the
> # guest machine
> -   [ -n "$o_nonetwork" ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
> "-device" \
> 
> "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
> @@ -276,7 +278,7 @@ start_qemu_x86() {
> )
> }
>
> -   [ -n "$o_nonetwork" ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
> "-device" 
> "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/2] scripts/qemustart: no-network by default and enable with -n

2019-04-25 Thread Hans Dedecker
On Thu, Apr 25, 2019 at 5:40 PM Yousong Zhou  wrote:
>
> On Thu, 25 Apr 2019 at 23:05, Hans Dedecker  wrote:
> >
> > Hi Yousong,
> >
> > On Thu, Apr 25, 2019 at 4:29 PM Yousong Zhou  wrote:
> > >
> > > Before this change, we have no way to have network on as both bash and
> > > zsh have zero exit status for "[ -n ]" and "[ -z ]"
> > >
> > > By running qemu without network by default we make common usage of and
> > > first encounter with qemustart script more comfortable.  With networking
> > > only two characters argument away.
> > >
> > > Cc: Petr Štetiar 
> > > Signed-off-by: Yousong Zhou 
> > > ---
> > >  scripts/qemustart | 12 +++-
> > >  1 file changed, 7 insertions(+), 5 deletions(-)
>
> ...
>
> > >
> > I pushed a patch
> > (https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=9424b6f998917e2926c0b7afb8d7a968590da335)
> > yesterday which fixes the [ -n ] and [ -z ] issues
> >
> > Hans
>
> I missed that one ;)  But I would still like to propose that we make
> "no network" the default.  I assume that would be easier to set up and
> works for most cases.  What do you think?
For ease of use that's fine for me

Hans
>
> yousong

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/2] scripts/qemustart: no-network by default and enable with -n

2019-04-25 Thread Hans Dedecker
Hi Yousong,

On Thu, Apr 25, 2019 at 4:29 PM Yousong Zhou  wrote:
>
> Before this change, we have no way to have network on as both bash and
> zsh have zero exit status for "[ -n ]" and "[ -z ]"
>
> By running qemu without network by default we make common usage of and
> first encounter with qemustart script more comfortable.  With networking
> only two characters argument away.
>
> Cc: Petr Štetiar 
> Signed-off-by: Yousong Zhou 
> ---
>  scripts/qemustart | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/qemustart b/scripts/qemustart
> index 951f225272..f0ffc64734 100755
> --- a/scripts/qemustart
> +++ b/scripts/qemustart
> @@ -74,7 +74,7 @@ check_setup_() {
>  }
>
>  check_setup() {
> -   [ -z $o_nonetwork ] || return 0
> +   [ -z "$o_network" ] || return 0
> check_setup_ || {
> __errmsg "please check the script content to see the 
> environment requirement"
> return 1
> @@ -90,6 +90,7 @@ Usage: $SELF [-h|--help]
>   [--kernel ]
>   [--rootfs ]
>   [--machine ]
> + [-n|--network]
>
>   will default to "generic" and must be specified if
>   are present
> @@ -120,13 +121,14 @@ rand_mac() {
>  }
>
>  parse_args() {
> +   o_network=
> o_qemu_extra=()
> while [ "$#" -gt 0 ]; do
> case "$1" in
> -   --no-network|-n) o_nonetwork=1; shift ;;
> --kernel) o_kernel="$2"; shift 2 ;;
> --rootfs) o_rootfs="$2"; shift 2 ;;
> --machine|-machine|-M) o_mach="$2"; shift 2 ;;
> +   --network|-n) o_network=1; shift ;;
> --help|-h)
> usage
> exit 0
> @@ -187,7 +189,7 @@ start_qemu_armvirt() {
> )
> }
>
> -   [ -n $o_nonetwork ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
> "-device" 
> "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
> @@ -229,7 +231,7 @@ start_qemu_malta() {
> # NOTE: order of wan, lan -device arguments matters as it will affect 
> which
> # one will be actually used as the wan, lan network interface inside 
> the
> # guest machine
> -   [ -n $o_nonetwork ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
> "-device" \
> 
> "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
> @@ -276,7 +278,7 @@ start_qemu_x86() {
> )
> }
>
> -   [ -n $o_nonetwork ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
> "-device" 
> "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
>
I pushed a patch
(https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=9424b6f998917e2926c0b7afb8d7a968590da335)
yesterday which fixes the [ -n ] and [ -z ] issues

Hans
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


  1   2   3   4   5   >