[sdwalker/sdwalker.github.io] 76c4e6: This week's update, fix 22.03 links

2023-03-19 Thread Stephen Walker via openwrt-devel
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.--- Begin Message ---
  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 76c4e602c6682d2abdf3606b8a2ae99131f5bc60
  
https://github.com/sdwalker/sdwalker.github.io/commit/76c4e602c6682d2abdf3606b8a2ae99131f5bc60
  Author: Stephen Walker 
  Date:   2023-03-19 (Sun, 19 Mar 2023)

  Changed paths:
M uscan/index-21.02.html
M uscan/index-22.03.html
M uscan/index.html

  Log Message:
  ---
  This week's update, fix 22.03 links



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


Re: [libnl-tiny PATCH] attr: add NLA_S8

2023-03-19 Thread Hauke Mehrtens

On 3/15/23 14:37, Nick Hainke wrote:

NLA_S8 is used by newer hostapd versions.

Signed-off-by: Nick Hainke 
---
  attr.c |  1 +
  include/netlink/attr.h | 35 +++
  2 files changed, 36 insertions(+)

diff --git a/attr.c b/attr.c
index eae91e5..abde67f 100644
--- a/attr.c
+++ b/attr.c
@@ -437,6 +437,7 @@ static uint16_t nla_attr_minlen[NLA_TYPE_MAX+1] = {
[NLA_U32]   = sizeof(uint32_t),
[NLA_U64]   = sizeof(uint64_t),
[NLA_STRING]= 1,
+   [NLA_S8]= sizeof(int8_t),
  };
  
  static int validate_nla(struct nlattr *nla, int maxtype,

diff --git a/include/netlink/attr.h b/include/netlink/attr.h
index 3e3047f..3a5d53d 100644
--- a/include/netlink/attr.h
+++ b/include/netlink/attr.h
@@ -45,6 +45,7 @@ enum {
NLA_FLAG,   /**< Flag */
NLA_MSECS,  /**< Micro seconds (64bit) */
NLA_NESTED, /**< Nested attributes */
+   NLA_S8,
__NLA_TYPE_MAX,
  };


I think this has to match the kernel definitions of the same enum.
https://elixir.bootlin.com/linux/v6.1.20/source/include/net/netlink.h#L178

Please add the other definitions added in this commit too:
https://github.com/thom311/libnl/commit/6263a11bfcd033a88583faa719d3911850f0c4f5

I think you should also add all the nla_put_s* and nla_get_s* 
definitions for s8, s16, s32 and s64. libnl-tiny adds them to the header 
only so they do not make the binary bigger when they are not used.


Hauke

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


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

2023-03-19 Thread Christian Marangi
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(, 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


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

2023-03-19 Thread Christian Marangi
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 = >addr6[i];
+
+   if (!addr->tentative) {
+   iface->have_link_local = true;
+   break;
+   }
+   }
+
len = netlink_get_interface_addrs(iface->ifindex,
false, >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(_info.addr, nla[IFA_ADDRESS], 
sizeof(event_info.addr));
 
-   if (IN6_IS_ADDR_LINKLOCAL(_info.addr) || 
IN6_IS_ADDR_MULTICAST(_info.addr))
+   if (IN6_IS_ADDR_MULTICAST(_info.addr))
return NL_SKIP;
 
inet_ntop(AF_INET6, _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(_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_local;
uint8_t pio_filter_length;
struct in6_addr pio_filter_addr;
int default_router;
diff --git a/src/router.c b/src/router.c
index 7e66e3c..eca0bf7 100644
--- a/src/router.c
+++ b/src/router.c
@@ -621,6 +621,11 @@ static int send_router_advert(struct interface *iface, 
const struct in6_addr *fr