Re: [PATCH] base-files: reduce IPv6 ULA prefix generation to a single call

2024-04-02 Thread Elliott Mitchell
On Wed, Apr 03, 2024 at 12:50:50AM +0200, Paul D wrote:
> On 2024-04-02 23:00, Elliott Mitchell wrote:
> > Second, appears the ${parameter:offset:length} may not be POSIX.  I
> > dislike this, but do not object since OpenWRT's shell is built with this
> > functionality enabled.
> 
> 
> UUOC! Ha. Yes, there are a few non POSIXy things in openwrt ash. A number of 
> other scripts already take advantage of them so it's OK, if it avoids several 
> external calls to e.g. cut or td.
> 

Yes, which is why even though I disliked it, I wouldn't be able to reject
merely for that.

> How about POSIX native array IFS split?
> 
> 
> IFS=' ' set -- $(hexdump -vn 5 -e '5/1 "%02x "' /dev/urandom)
> 
> uci -q batch <<-EOF >/dev/null
>   set network.globals.ula_prefix=fd$1:$2$3:$4$5::/48
>   commit network
> EOF

That is certainly better than the solution I came up with.  More
importantly, it addresses concern #1.  Now just need a better commit
message and hopefully the committers would find it acceptable.


-- 
(\___(\___(\__  --=> 8-) EHM <=--  __/)___/)___/)
 \BS (| ehem+sig...@m5p.com  PGP 87145445 |)   /
  \_CS\   |  _  -O #include  O-   _  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445



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


Re: Conclusions from CVE-2024-3094 (libxz disaster)

2024-04-02 Thread Daniel Golle
On Mon, Apr 01, 2024 at 02:49:46PM +0200, Petr Štetiar wrote:
> Daniel Golle  [2024-03-30 15:30:49]:
> 
> Hi,
> 
> > In many ways, we are already better
> 
> I would probably avoid such bold statements and would be more humble, since
> you never know why OpenWrt wasn't directly targeted.

We are not "better" but "better off". You cut my sentence in a quite
significant place here. Mind that little word "off" here which makes
all the difference. I assume you misread my statement, no offence,
of course.

It did not at all intend to be a bold statement regarding OpenWrt's
security practises what-so-ever.

Again:
"In many ways, we are already better off than most Linux distros out
there -- not because of deliberate decisions with security in mind,
but because of our tendency to minimalism and avoiding bloat due to
resource limitations on the target devices, and having a reduced
attack surface is just an indirect consequence of that."

Maybe I should have added ", at best." at the end of the sentence.

> 
> > I believe that the current tendency to use tarballs rather than
> > (reproducible!) git checkouts is also problematic to begin with.
> 
> Git checkouts are currently problematic as well, IIRC the build is going to
> happily use whatever Git is happy with. I mean, if the hash of the downloaded
> tarball source code doesn't match, then the tarball is removed and Git clone
> is performed, new source code tarball is produced, but the tarball hash is not
> going to be checked again.
> 
> Perhaps this package source code integrity checks should be mandatory, not
> optional?

I agree, especially also as PKG_SOURCE_VERSION isn't necessarily a
hash, but can also be a reference to a git tag -- and that can be
replaced by a malicious maintainer or git hoster (though it would be
kinda stupid, as everyone with a downstream copy of the repo would
most likely notice that).

Never the less: A git tag does not really replace an integrity check,
especially as we also don't very signed git tags at all.

> 
> > So why not **always** use that instead of potentially shady and hard to
> > verify tarballs?
> 
> In this case, they were targeting specific audience and this attack vector was
> cheapest/fastest, so the source code origin doesn't really matter.

I tend to slightly disagree, because an attacker will always chose
what ever means are necessary or sufficient. Using tarballs instead of
checkouts increases the attack surface in the sense that validating
the tarball content is extra work for package maintainers.

> 
> > Why do we need to rely one proprietary hacks such as Gibhub codeload
> > just to safe a few megabytes of traffic and a few seconds of build
> > time?
> 
> Ok, I don't like GH either, but I find this irrelevant, origin of the source
> code is not a problem, the content is the problem.

... and that crazy m4 script had to be noticed. As a diff one would ask:
Why was that change necessary?

Maybe we can learn a bit from Android's build system here:
They unpack the release tarballs into a git repo, so that makes the diff
more visible and obvious again for maintainers. That would get the best
of both worlds (at a significant resource pricetag, though...)

> 
> > There are even too many problems to reproduce even those supposedly
> > automated Github-generated tarballs. Nobody actually checks that.
> 
> FYI we do on the CI 
> https://github.com/openwrt/actions-shared-workflows/blob/main/.github/workflows/reusable_build.yml#L224

Nice one. Wasn't aware of that.

> 
> > 9bd7d8b, c7c2257, 77368ec, 86994e1, 954142f, 4c5d910, 21f713d, ...
> > Probably all of those have trivial causes and there isn't anything
> > malicious going on there.
> 
> I agree, I guess, that in some cases it might point to a subtle bug somewhere
> in the source code tarball packaging path (host kernel, tools, container?),
> maybe another backdoor in the works/testing? :P

0_o

> 
> Anyway, we should perhaps consider treating this situations in supply chain
> more seriously, so perhaps in this cases of package hash failures, we need to
> document it better, with more details in the commit message and maybe even
> better, gather always more evidence in a separate GH issue, so its possible to
> reconstruct the complete picture if we really find out 2 years later, that it
> was something malicious going on somewhere? Whatever it might be.

+1

> 
> > Always using git checkouts instead of tarballs would also makes it
> > much easier for maintainers to at least have a quick look at the
> > changes made in an upstream project between versions (a quick scroll
> > over  'git diff oldtag..newtag' or even just 'git log --stat
> > oldtag..newtag' doesn't take much more time than manually validating a
> 
> Although I mostly (always?) doing that Git diff/log, during bumps/reviews, I'm
> sorry, but I'm not able to spot such masked backdoors :-)

Honestly, I believe in this case it would have at least rised on of my
eyebrows. Not the binaries for the test-cases 

Re: [PATCH 6/7] lldpd: make management address advertisement controllable

2024-04-02 Thread Jo-Philipp Wich

Hi,

comment below.

Am 4/2/24 um 15:02 schrieb Paul Donald:

Defaults to off.

Available from >= 0.7.15

These are sent in TLV

Signed-off-by: Paul Donald 
---
  package/network/services/lldpd/files/lldpd.init | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 3e804cd033..72baf19cc5 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -128,6 +128,10 @@ write_lldpd_conf()
local lldp_capadv
config_get_bool lldp_capadv 'config' 'lldp_capadv' 0
  
+	# Broadcast management address in lldpd >= 0.7.15

+   local lldp_maddradv
+   config_get_bool lldp_maddradv 'config' 'lldp_maddradv' 0


Same remark as for the previous patch, please spell out those option names. 
Nobody will be able to guess what a "maddradv" is. It is not a widely used 
acronym and it is not similar to the native 
"management-addresses-advertisements" setting name.


Also there's an existing option "lldp_mgmt_ip" and I guess this new option 
controls whether it is advertised in TLVs or not, so it should follow its 
naming, something like "lldp_mgmt_ip_advertisement" or similar.


~ Jo

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


Re: [PATCH 6/7] lldpd: make management address advertisement controllable

2024-04-02 Thread Jo-Philipp Wich

Hi,

comment below.

Am 4/2/24 um 15:02 schrieb Paul Donald:

Defaults to off.

Available from >= 0.7.15

These are sent in TLV

Signed-off-by: Paul Donald 
---
  package/network/services/lldpd/files/lldpd.init | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 3e804cd033..72baf19cc5 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -128,6 +128,10 @@ write_lldpd_conf()
local lldp_capadv
config_get_bool lldp_capadv 'config' 'lldp_capadv' 0
  
+	# Broadcast management address in lldpd >= 0.7.15

+   local lldp_maddradv
+   config_get_bool lldp_maddradv 'config' 'lldp_maddradv' 0


Same remark as for the previous patch, please spell out those option names. 
Nobody will be able to guess what a "maddradv" is. It is not a widely used 
acronym and it is not similar to the native 
"management-addresses-advertisements" setting name.


Also there's an existing option "lldp_mgmt_ip" and I guess this new option 
controls whether it is advertised in TLVs or not, so it should follow its 
naming, something like "lldp_mgmt_ip_advertisement" or similar.


~ Jo

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


Re: [PATCH 5/7] lldpd: make capabilities advertisement controllable

2024-04-02 Thread Jo-Philipp Wich

Hi,

comment below.

Am 4/2/24 um 15:02 schrieb Paul Donald:

Defaults to off.

Only available from >= 1.0.15

These capabilities are sent in TLV.

Signed-off-by: Paul Donald 
---
  package/network/services/lldpd/files/lldpd.init | 7 +++
  1 file changed, 7 insertions(+)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 284c37c2ef..3e804cd033 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -124,6 +124,10 @@ write_lldpd_conf()
local lldp_syscapabilities
config_get lldp_syscapabilities 'config' 'lldp_syscapabilities'
  
+	# Configurable capabilities in lldpd >= v1.0.15

+   local lldp_capadv
+   config_get_bool lldp_capadv 'config' 'lldp_capadv' 0


Can we at least try to aim for some consistency here? Most preexisting options 
are spelled out, even the other capability related option right next does not 
abbreviate "capabilities", so this new option should likely be called 
"lldp_advcapabilities". Also "adv" is ambiguous, could be interpreted as 
"advanced" instead of "advertise" without further context, so consider naming 
it "lldp_capability_advertisement" or similar.


~ Jo

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


Re: [PATCH 4/7] lldpd: note about capabilities

2024-04-02 Thread Jo-Philipp Wich

Hi,

What's the purpose of this isolated comment? Either we're shipping version >= 
v1.0.15 so this code is guaranteed to work or we don't, in which case the code 
should not be there. We're not putting such comments next to all other option 
handling code either.


~ Jo

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


Re: [PATCH 3/7] lldpd: fix restart

2024-04-02 Thread Jo-Philipp Wich

Hi,


redirection broke in 5364fe0f01ca11b47c55d78f756d3176748dd0c2


why did this slip through in the first place? Seems that neither the submitter 
(you) nor the comitter actually runtime tested those changes described as " No 
functionality/behaviour changes; code is synonymous".


~ Jo

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


Re: [PATCH 1/7] lldpd: fixed interface(s) parsing

2024-04-02 Thread Jo-Philipp Wich

Hi,


For interface type parameters, the man page documents patterns:
```
*,!eth*,!!eth1

uses all interfaces, except interfaces starting with "eth",
but including "eth1".
```


at some point, uci configuration was meant to provide a somewhat sane config 
abstraction over various damon specific native configurations, now I see the 
recurring trend to expose every last native config idiosyncrasy as-is in uci.


Is there really a need to support these weird micro formats in uci? The uci 
config for lldpd should deal with logical interface names and translate them 
into layer 2 ones as needed. People requiring complex, hand-tuned settings 
probably want to bypass uci entirly and simply start lldpd with a static 
native config file.


~ Jo

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


Re: [PATCH] base-files: reduce IPv6 ULA prefix generation to a single call

2024-04-02 Thread Paul D
On 2024-04-02 23:00, Elliott Mitchell wrote:
> Second, appears the ${parameter:offset:length} may not be POSIX.  I
> dislike this, but do not object since OpenWRT's shell is built with this
> functionality enabled.


UUOC! Ha. Yes, there are a few non POSIXy things in openwrt ash. A number of 
other scripts already take advantage of them so it's OK, if it avoids several 
external calls to e.g. cut or td.

How about POSIX native array IFS split?


IFS=' ' set -- $(hexdump -vn 5 -e '5/1 "%02x "' /dev/urandom)

uci -q batch <<-EOF >/dev/null
set network.globals.ula_prefix=fd$1:$2$3:$4$5::/48
commit network
EOF

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


Re: [PATCH] base-files: reduce IPv6 ULA prefix generation to a single call

2024-04-02 Thread Elliott Mitchell
On Tue, Apr 02, 2024 at 02:36:36PM +0200, Paul Donald wrote:
> Tested on: 23.05.3
> 
> Signed-off-by: Paul Donald 
> ---
>  .../files/etc/uci-defaults/12_network-generate-ula  | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git 
> a/package/base-files/files/etc/uci-defaults/12_network-generate-ula 
> b/package/base-files/files/etc/uci-defaults/12_network-generate-ula
> index 19d7ed7f2e..20b3237ec7 100644
> --- a/package/base-files/files/etc/uci-defaults/12_network-generate-ula
> +++ b/package/base-files/files/etc/uci-defaults/12_network-generate-ula
> @@ -1,11 +1,9 @@
>  [ "$(uci -q get network.globals.ula_prefix)" != "auto" ] && exit 0
>  
> -r1=$(dd if=/dev/urandom bs=1 count=1 |hexdump -e '1/1 "%02x"')
> -r2=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"')
> -r3=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"')
> +r1=$(hexdump -vn 5 -e '5/1 "%02x"' /dev/urandom)
>  
>  uci -q batch <<-EOF >/dev/null
> - set network.globals.ula_prefix=fd$r1:$r2:$r3::/48
> + set network.globals.ula_prefix=fd${r1:0:2}:${r1:2:4}:${r1:6:4}::/48
>   commit network
>  EOF
>  
> -- 

First, since you got rid of "r2" and "r3", "r1" now seems a bad name.
I would suggest switching to simply "r".

Second, appears the ${parameter:offset:length} may not be POSIX.  I
dislike this, but do not object since OpenWRT's shell is built with this
functionality enabled.

Third, you need a better commit message.  Perhaps type something about
how this improves things.

Overall, I like the idea.  This isn't a UUOC, but is pretty close.
Cleanup is always valuable.  Only #1 and #3 need to be addressed.


-- 
(\___(\___(\__  --=> 8-) EHM <=--  __/)___/)___/)
 \BS (| ehem+sig...@m5p.com  PGP 87145445 |)   /
  \_CS\   |  _  -O #include  O-   _  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445



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


Re: Status of snapshot builds for omap target

2024-04-02 Thread Alexander 'lynxis' Couzens
Hi Raylynn,

I've it on my list to test it again on the beagleboard black and re-enable it
if it works with the older ethernet driver which doesn't have the hardcoded 
VLAN tags.

Best,
lynxis

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


Re: padding of large 16-32GB images [Was: Re: [PATCH 2/5] build: image: Add pad-to and pad-rootfs-squashfs helpers]

2024-04-02 Thread Nishant Sharma

Hi Petr,

On 01/04/24 15:58, Petr Štetiar wrote:

dd: memory exhausted by input buffer of size 16642998272 bytes (16 GiB)


can you check 
https://patchwork.ozlabs.org/project/openwrt/patch/20240401102511.495791-1-yn...@true.cz/
 ? Thanks!


Thanks a lot for the fix.

I tested it by building a 16GB squashfs EFI image for x86_64 on a host 
with just 8GB of RAM and build was successful without any errors.


But, it takes a lot of time (around 20 minutes) writing this image to 
the device, which I suspect is due to padding. Earlier, it used to take 
less than 2 minutes.


Is it possible to get "CONFIG_TARGET_IMAGES_PAD" back or some other 
switch that can be flipped to disable padding for images?


Regards,
Nishant

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


[PATCH 5/5] dnsmasq: add handling of `dns-rr` to init script (add arbitrary resource records)

2024-04-02 Thread Paul Donald
Add support for handling of DNS RR (Resource Records) requests, which
are needed for the HTTPS Type 65 records, introduced to support the
DNS-based Service Discovery (DNS-SD) mechanism for HTTPS services and
defined in the RFC 9460 (9.1. Query Names for HTTPS RRs).

Ref: 
https://forum.openwrt.org/t/resolving-query-type-65-to-local-address-for-ios-clients-in-dnsmasq/179504/11


uci config usage:

config dns_rr
option rrname 'foo.example.com'
option rrnumber '65'
option hexdata '00'

hexdata is optional.

Available since dnsmasq 2.62 (for around 12 years at this point).

Tested on 22.03.5

Signed-off-by: Paul Donald 
---
 package/network/services/dnsmasq/Makefile |  2 +-
 .../services/dnsmasq/files/dnsmasq.init   | 23 +++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/package/network/services/dnsmasq/Makefile 
b/package/network/services/dnsmasq/Makefile
index 5224e996a4..0a597c03ce 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=dnsmasq
 PKG_UPSTREAM_VERSION:=2.90
 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION)))
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz
 PKG_SOURCE_URL:=https://thekelleys.org.uk/dnsmasq/
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index 0b1a71aee4..8936ae7f75 100755
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -788,6 +788,28 @@ dhcp_hostrecord_add() {
xappend "--host-record=$record"
 }
 
+dhcp_dnsrr_add() {
+   #This adds arbitrary resource record types (of IN class) whose optional 
data must be hex
+   local cfg="$1"
+   local rrname rrnumber hexdata
+
+   config_get rrname "$cfg" rrname
+   [ -n "$rrname" ] || return 0
+
+   config_get rrnumber "$cfg" rrnumber
+   [ -n "$rrnumber" ] && [ "$rrnumber" -gt 0 ] || return 0
+
+   config_get hexdata "$cfg" hexdata
+
+   # dnsmasq accepts colon XX:XX:.., space XX XX .., or contiguous .. 
hex forms or mixtures thereof
+   if [ -n "${hexdata//[0-9a-fA-F\:\ ]/}" ]; then
+   # is invalid hex literal
+   return 1
+   fi
+
+   xappend "--dns-rr=${rrname},${rrnumber}${hexdata:+,$hexdata}"
+}
+
 dhcp_relay_add() {
local cfg="$1"
local local_addr server_addr interface
@@ -1158,6 +1180,7 @@ dnsmasq_start()
config_foreach filter_dnsmasq match dhcp_match_add "$cfg"
config_foreach filter_dnsmasq domain dhcp_domain_add "$cfg"
config_foreach filter_dnsmasq hostrecord dhcp_hostrecord_add "$cfg"
+   config_foreach filter_dnsmasq dnsrr dhcp_dnsrr_add "$cfg"
[ -n "$BOOT" ] || config_foreach filter_dnsmasq relay dhcp_relay_add 
"$cfg"
 
echo >> "$CONFIGFILE_TMP"
-- 
2.44.0


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


[PATCH 1/5] dnsmasq: add handling of `filter-rr` to init script

2024-04-02 Thread Paul Donald
dnsmasq v2.90 introduced `--filter-rr=[,...]`.

uci config usage:

config dnsmasq
...
option filter_rr ',CNAME,NXDOMAIN,SRV,...'

The dnsmasq instance internally builds a linked list of RR to filter
from the individually supplied parameters, so it's harmless to provide
synonyms:

... --filter-A --filter-rr=A ...

See 
https://forum.openwrt.org/t/resolving-query-type-65-to-local-address-for-ios-clients-in-dnsmasq/179504/23

Tested on: 23.05.2

Signed-off-by: Paul Donald 
Tested-by: Vladimir Kochkovski 
---
 package/network/services/dnsmasq/files/dnsmasq.init | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index 138a913f87..15cf194673 100755
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -973,8 +973,10 @@ dnsmasq_start()
append_bool "$cfg" rapidcommit "--dhcp-rapid-commit"
append_bool "$cfg" scriptarp "--script-arp"
 
+   # deprecate or remove filter-X in favor of filter-rr?
append_bool "$cfg" filter_ "--filter-"
append_bool "$cfg" filter_a "--filter-A"
+   append_parm "$cfg" filter_rr "--filter-rr"
 
append_parm "$cfg" logfacility "--log-facility"
config_get logfacility "$cfg" "logfacility"
-- 
2.44.0


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


[PATCH 3/5] dnsmasq: add 'extraconftext' parameter

2024-04-02 Thread Paul Donald
Users can now freely add new dnsmasq parameters (i.e. a whole config)
via extraconf. This means users can add their own parameters without
changes to init or GUI.

Co-opted the default of confdir also to include the instance name.
This way each instance gets its own .d directory (and separate instances
do not all inherit the same 'extraconftext').

See 
https://forum.openwrt.org/t/add-dnsmasq-custom-options-field-in-luci-gui/193184

Tested on: 23.05.3, 22.03.6

Signed-off-by: Paul Donald 
---
 package/network/services/dnsmasq/files/dnsmasq.init | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index 9bb334f816..9b98bbb015 100755
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -12,6 +12,7 @@ ADD_WAN_FQDN=0
 ADD_LOCAL_FQDN=""
 
 BASECONFIGFILE="/var/etc/dnsmasq.conf"
+EXTRACONFFILE="extraconfig.conf"
 BASEHOSTFILE="/tmp/hosts/dhcp"
 TRUSTANCHORSFILE="/usr/share/dnsmasq/trust-anchors.conf"
 TIMEVALIDFILE="/var/state/dnsmasqsec"
@@ -1118,14 +1119,19 @@ dnsmasq_start()
xappend "--dhcp-broadcast=tag:needs-broadcast"
 
 
-   config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq.d"
+   # Create a dnsmasq.d dir for each instance
+   config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq${cfg:+.$cfg}.d"
xappend "--conf-dir=$dnsmasqconfdir"
dnsmasqconfdir="${dnsmasqconfdir%%,*}"
-   [ ! -d "$dnsmasqconfdir" ] && mkdir -p $dnsmasqconfdir
+   [ ! -d "$dnsmasqconfdir" ] && mkdir -p "$dnsmasqconfdir"
xappend "--user=dnsmasq"
xappend "--group=dnsmasq"
echo >> $CONFIGFILE_TMP
 
+   # EXTRACONFFILE allows new dnsmasq parameters before they are natively 
handled in this init file
+   config_get extraconftext "$cfg" extraconftext
+   echo -e "$extraconftext" > "$dnsmasqconfdir"/"$EXTRACONFFILE"
+
config_get_bool enable_tftp "$cfg" enable_tftp 0
[ "$enable_tftp" -gt 0 ] && {
config_get tftp_root "$cfg" tftp_root
-- 
2.44.0


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


[PATCH 4/5] dnsmasq: quoted path variables

2024-04-02 Thread Paul Donald
Prevents problems when variables contain spaces.

Tested on: 23.05.3

Signed-off-by: Paul Donald 
---
 .../services/dnsmasq/files/dnsmasq.init   | 32 +--
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index 9b98bbb015..0b1a71aee4 100755
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -69,7 +69,7 @@ xappend() {
local opt="${value%%=*}"
 
if ! dnsmasq_ignore_opt "$opt"; then
-   echo "$value" >>$CONFIGFILE_TMP
+   echo "$value" >>"$CONFIGFILE_TMP"
fi
 }
 
@@ -354,7 +354,7 @@ dhcp_host_add() {
 
config_get_bool dns "$cfg" dns 0
[ "$dns" = "1" ] && [ -n "$ip" ] && [ -n "$name" ] && {
-   echo "$ip $name${DOMAIN:+.$DOMAIN}" >> $HOSTFILE_TMP
+   echo "$ip $name${DOMAIN:+.$DOMAIN}" >> "$HOSTFILE_TMP"
}
 
config_get mac "$cfg" mac
@@ -714,7 +714,7 @@ dhcp_domain_add() {
record="${record:+$record }$name"
done
 
-   echo "$ip $record" >> $HOSTFILE_TMP
+   echo "$ip $record" >> "$HOSTFILE_TMP"
 }
 
 dhcp_srv_add() {
@@ -882,13 +882,13 @@ dnsmasq_start()
# before we can call xappend
umask u=rwx,g=rx,o=rx
mkdir -p /var/run/dnsmasq/
-   mkdir -p $(dirname $CONFIGFILE)
+   mkdir -p "$(dirname "$CONFIGFILE")"
mkdir -p "$HOSTFILE_DIR"
mkdir -p /var/lib/misc
chown dnsmasq:dnsmasq /var/run/dnsmasq
 
-   echo "# auto-generated config file from /etc/config/dhcp" > 
$CONFIGFILE_TMP
-   echo "# auto-generated config file from /etc/config/dhcp" > 
$HOSTFILE_TMP
+   echo "# auto-generated config file from /etc/config/dhcp" > 
"$CONFIGFILE_TMP"
+   echo "# auto-generated config file from /etc/config/dhcp" > 
"$HOSTFILE_TMP"
 
local dnsmasqconffile="/etc/dnsmasq.${cfg}.conf"
if [ ! -r "$dnsmasqconffile" ]; then
@@ -1126,7 +1126,7 @@ dnsmasq_start()
[ ! -d "$dnsmasqconfdir" ] && mkdir -p "$dnsmasqconfdir"
xappend "--user=dnsmasq"
xappend "--group=dnsmasq"
-   echo >> $CONFIGFILE_TMP
+   echo >> "$CONFIGFILE_TMP"
 
# EXTRACONFFILE allows new dnsmasq parameters before they are natively 
handled in this init file
config_get extraconftext "$cfg" extraconftext
@@ -1139,7 +1139,7 @@ dnsmasq_start()
}
 
config_foreach filter_dnsmasq host dhcp_host_add "$cfg"
-   echo >> $CONFIGFILE_TMP
+   echo >> "$CONFIGFILE_TMP"
 
config_get_bool dhcpbogushostname "$cfg" dhcpbogushostname 1
[ "$dhcpbogushostname" -gt 0 ] && {
@@ -1160,10 +1160,10 @@ dnsmasq_start()
config_foreach filter_dnsmasq hostrecord dhcp_hostrecord_add "$cfg"
[ -n "$BOOT" ] || config_foreach filter_dnsmasq relay dhcp_relay_add 
"$cfg"
 
-   echo >> $CONFIGFILE_TMP
+   echo >> "$CONFIGFILE_TMP"
config_foreach filter_dnsmasq srvhost dhcp_srv_add "$cfg"
config_foreach filter_dnsmasq mxhost dhcp_mx_add "$cfg"
-   echo >> $CONFIGFILE_TMP
+   echo >> "$CONFIGFILE_TMP"
 
config_get_bool boguspriv "$cfg" boguspriv 1
[ "$boguspriv" -gt 0 ] && {
@@ -1185,16 +1185,16 @@ dnsmasq_start()
fi
 
 
-   echo >> $CONFIGFILE_TMP
+   echo >> "$CONFIGFILE_TMP"
config_foreach filter_dnsmasq cname dhcp_cname_add "$cfg"
-   echo >> $CONFIGFILE_TMP
+   echo >> "$CONFIGFILE_TMP"
 
-   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
+   mv -f "$CONFIGFILE_TMP" "$CONFIGFILE"
+   mv -f "$HOSTFILE_TMP" "$HOSTFILE"
 
[ "$localuse" -gt 0 ] && {
rm -f /tmp/resolv.conf
-- 
2.44.0


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


[PATCH 2/5] dnsmasq: add handling of `cache-rr` to init script

2024-04-02 Thread Paul Donald
dnsmasq v2.90 introduced `--cache-rr=[,...]`.

uci config usage:

config dnsmasq
...
option cache_rr ',CNAME,NXDOMAIN,SRV,...'

The dnsmasq instance internally builds a linked list of RR to cache
from the individually supplied parameters, so it's allowed to provide
multiples:

... --cache-rr= --cache-rr=A ...

See 
https://forum.openwrt.org/t/resolving-query-type-65-to-local-address-for-ios-clients-in-dnsmasq/179504

Tested on: 23.05.2

Signed-off-by: Paul Donald 
---
 package/network/services/dnsmasq/files/dnsmasq.init | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index 15cf194673..9bb334f816 100755
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -977,6 +977,7 @@ dnsmasq_start()
append_bool "$cfg" filter_ "--filter-"
append_bool "$cfg" filter_a "--filter-A"
append_parm "$cfg" filter_rr "--filter-rr"
+   append_parm "$cfg" cache_rr "--cache-rr"
 
append_parm "$cfg" logfacility "--log-facility"
config_get logfacility "$cfg" "logfacility"
-- 
2.44.0


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


[PATCH 3/7] lldpd: fix restart

2024-04-02 Thread Paul Donald
redirection broke in 5364fe0f01ca11b47c55d78f756d3176748dd0c2

redirects to /dev/null shall be handled correctly (i.e. last).

This fixes these errors on `/etc/init.d/lldpd reload`:

2024-03-16T20:39:00 [WARN/lldpctl] unknown command from argument 1: `/dev/null`
2024-03-16T20:39:00 [WARN/lldpctl] unknown command from argument 1: `/dev/null`
2024-03-16T20:39:00 [WARN/lldpctl] unknown command from argument 1: `/dev/null`
2024-03-16T20:39:00 [WARN/lldpctl] unknown command from argument 1: `/dev/null`

Tested on: 22.03.6

Signed-off-by: Paul Donald 
---
 package/network/services/lldpd/files/lldpd.init | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 069c8fee80..0334156fee 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -363,7 +363,7 @@ reload_service() {
return 0
fi
 
-   $LLDPCLI -u "$LLDPSOCKET" 2>&1 /dev/null <<-EOF
+   $LLDPCLI -u "$LLDPSOCKET" >/dev/null 2>&1 <<-EOF
pause
unconfigure lldp custom-tlv
unconfigure system interface pattern
@@ -373,7 +373,7 @@ reload_service() {
unconfigure system platform
EOF
if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then
-   $LLDPCLI -u "$LLDPSOCKET" 2>&1 /dev/null <<-EOF
+   $LLDPCLI -u "$LLDPSOCKET" >/dev/null 2>&1 <<-EOF
unconfigure med fast-start
EOF
 
@@ -381,9 +381,9 @@ reload_service() {
# Rewrite lldpd.conf
# If something changed it should be included by the lldpcli call
write_lldpd_conf
-   $LLDPCLI -u "$LLDPSOCKET" -c "$LLDPD_CONF" -c "$LLDPD_CONFS_DIR" 2>&1 
/dev/null
+   $LLDPCLI -u "$LLDPSOCKET" -c "$LLDPD_CONF" -c "$LLDPD_CONFS_DIR" 
>/dev/null 2>&1 
# Broadcast update over the wire
-   $LLDPCLI -u "$LLDPSOCKET" 2>&1 /dev/null <<-EOF
+   $LLDPCLI -u "$LLDPSOCKET" >/dev/null 2>&1 <<-EOF
resume
update
EOF
@@ -391,6 +391,6 @@ reload_service() {
 }
 
 stop_service() {
-   rm -rf ${LLDPD_RUN} "$LLDPSOCKET" 2> /dev/null
+   rm -rf ${LLDPD_RUN} "$LLDPSOCKET" >/dev/null 2>&1
 }
 
-- 
2.44.0


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


[PATCH 6/7] lldpd: make management address advertisement controllable

2024-04-02 Thread Paul Donald
Defaults to off.

Available from >= 0.7.15

These are sent in TLV

Signed-off-by: Paul Donald 
---
 package/network/services/lldpd/files/lldpd.init | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 3e804cd033..72baf19cc5 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -128,6 +128,10 @@ write_lldpd_conf()
local lldp_capadv
config_get_bool lldp_capadv 'config' 'lldp_capadv' 0
 
+   # Broadcast management address in lldpd >= 0.7.15
+   local lldp_maddradv
+   config_get_bool lldp_maddradv 'config' 'lldp_maddradv' 0
+
if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then
local lldpmed_fast_start
config_get_bool lldpmed_fast_start 'config' 
'lldpmed_fast_start' 0
@@ -195,6 +199,7 @@ write_lldpd_conf()
[ -n "$lldp_tx_interval" ] && echo "configure lldp tx-interval 
$lldp_tx_interval" >> "$LLDPD_CONF"
[ "$lldp_tx_hold" -gt 0 ] && echo "configure lldp tx-hold 
$lldp_tx_hold" >> "$LLDPD_CONF"
[ "$lldp_capadv" -gt 0 ] && echo "configure lldp 
capabilities-advertisements" >> "$LLDPD_CONF"
+   [ "$lldp_maddradv" -gt 0 ] && echo "configure lldp 
management-addresses-advertisements" >> "$LLDPD_CONF"
 
# Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to 
/tmp/$LLDPD_CONFS_DIR
[ -e "$LLDPD_CONFS_DIR" ] || ln -s /etc/lldpd.d "$LLDPD_CONFS_DIR"
@@ -374,6 +379,7 @@ reload_service() {
pause
unconfigure lldp custom-tlv
unconfigure lldp capabilities-advertisements
+   unconfigure lldp management-addresses-advertisements
unconfigure system interface pattern
unconfigure system description
unconfigure system hostname
-- 
2.44.0


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


[PATCH 4/7] lldpd: note about capabilities

2024-04-02 Thread Paul Donald
only available from >= 1.0.15

Signed-off-by: Paul Donald 
---
 package/network/services/lldpd/files/lldpd.init | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 0334156fee..284c37c2ef 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -120,6 +120,7 @@ write_lldpd_conf()
local lldp_mgmt_ip
config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip'
 
+   # Configurable capabilities in lldpd >= v1.0.15
local lldp_syscapabilities
config_get lldp_syscapabilities 'config' 'lldp_syscapabilities'
 
-- 
2.44.0


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


[PATCH 5/7] lldpd: make capabilities advertisement controllable

2024-04-02 Thread Paul Donald
Defaults to off.

Only available from >= 1.0.15

These capabilities are sent in TLV.

Signed-off-by: Paul Donald 
---
 package/network/services/lldpd/files/lldpd.init | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 284c37c2ef..3e804cd033 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -124,6 +124,10 @@ write_lldpd_conf()
local lldp_syscapabilities
config_get lldp_syscapabilities 'config' 'lldp_syscapabilities'
 
+   # Configurable capabilities in lldpd >= v1.0.15
+   local lldp_capadv
+   config_get_bool lldp_capadv 'config' 'lldp_capadv' 0
+
if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then
local lldpmed_fast_start
config_get_bool lldpmed_fast_start 'config' 
'lldpmed_fast_start' 0
@@ -164,6 +168,7 @@ write_lldpd_conf()
[ -n "$lldp_hostname" ] && echo "configure system hostname" 
"\"$lldp_hostname\"" >> "$LLDPD_CONF"
[ -n "$lldp_mgmt_ip" ] && echo "configure system ip management pattern" 
"\"$lldp_mgmt_ip\"" >> "$LLDPD_CONF"
[ -n "$lldp_syscapabilities" ] && echo "configure system capabilities 
enabled $lldp_syscapabilities" >> "$LLDPD_CONF"
+
if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ] && [ "$lldpmed_fast_start" 
-gt 0 ]; then
if [ "$lldpmed_fast_start_tx_interval" -gt 0 ]; then
echo "configure med fast-start tx-interval 
$lldpmed_fast_start_tx_interval" >> "$LLDPD_CONF"
@@ -189,6 +194,7 @@ write_lldpd_conf()
[ -n "$lldp_platform" ] && echo "configure system platform" 
"\"$lldp_platform\"" >> "$LLDPD_CONF"
[ -n "$lldp_tx_interval" ] && echo "configure lldp tx-interval 
$lldp_tx_interval" >> "$LLDPD_CONF"
[ "$lldp_tx_hold" -gt 0 ] && echo "configure lldp tx-hold 
$lldp_tx_hold" >> "$LLDPD_CONF"
+   [ "$lldp_capadv" -gt 0 ] && echo "configure lldp 
capabilities-advertisements" >> "$LLDPD_CONF"
 
# Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to 
/tmp/$LLDPD_CONFS_DIR
[ -e "$LLDPD_CONFS_DIR" ] || ln -s /etc/lldpd.d "$LLDPD_CONFS_DIR"
@@ -367,6 +373,7 @@ reload_service() {
$LLDPCLI -u "$LLDPSOCKET" >/dev/null 2>&1 <<-EOF
pause
unconfigure lldp custom-tlv
+   unconfigure lldp capabilities-advertisements
unconfigure system interface pattern
unconfigure system description
unconfigure system hostname
-- 
2.44.0


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


[PATCH 7/7] lldpd: bump version

2024-04-02 Thread Paul Donald
3 -> 4

Signed-off-by: Paul Donald 
---
 package/network/services/lldpd/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/lldpd/Makefile 
b/package/network/services/lldpd/Makefile
index 18cdda33ce..5a9a9732d2 100644
--- a/package/network/services/lldpd/Makefile
+++ b/package/network/services/lldpd/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lldpd
 PKG_VERSION:=1.0.17
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 
PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/
-- 
2.44.0


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


[PATCH 1/7] lldpd: fixed interface(s) parsing

2024-04-02 Thread Paul Donald
For interface type parameters, the man page documents patterns:
```
*,!eth*,!!eth1

uses all interfaces, except interfaces starting with "eth",
but including "eth1".
```

While we must check that interfaces exist, first strip any prefixed "!"
then pass the original string (with `!` prefix) again, to command lines.

* Renamed `_ifname` to `_l3dev`.
* Glob pattern `*` is also valid - pass those verbatim.

The net result is that now interface 'names' including globs '*' and '!'
inversions now are included in the generated lldpd configs.

We must also `set -o noglob` and `set +o noglob` to disable and enable
globbing respectively, because when we pass `*` as an interface choice
everything goes to hell without them.

Tested extensively on: 22.03.6

Signed-off-by: Paul Donald 
---
 .../network/services/lldpd/files/lldpd.init   | 20 ---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 67ee011ae2..fc53520c5b 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -76,18 +76,32 @@ get_config_restart_hash() {
 }
 
 get_config_cid_ifaces() {
+   set -o noglob
local _ifaces
config_get _ifaces 'config' "$2"
 
local _iface _ifnames=""
for _iface in $_ifaces; do
-   local _ifname=""
-   if network_get_device _ifname "$_iface" || [ -e 
"/sys/class/net/$_iface" ]; then
-   append _ifnames "${_ifname:-$_iface}" ","
+   local _l3dev=""
+   # save any "!" or "!!" prefix from the interface name
+   _suffix=${_iface##*"!"}
+   _prefix=${_iface%%"$_suffix"}
+
+   if network_get_device _l3dev "$_suffix" || [ -e 
"/sys/class/net/$_suffix" ]; then
+   # prepend the stripped "!" or "!!" prefix here if we 
had one
+   append _ifnames "$_prefix${_l3dev:-$_suffix}" ","
+   else
+   case $_iface in 
+   *"*"*)
+   # Append any interface names including a glob 
'*' pattern
+   append _ifnames "$_iface" ","
+   ;;
+   esac
fi
done
 
export -n "${1}=$_ifnames"
+   set +o noglob
 }
 
 write_lldpd_conf()
-- 
2.44.0


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


[PATCH 2/7] lldpd: get_config_cid_ifaces() -> get_interface_csv_pattern()

2024-04-02 Thread Paul Donald
Make the function more generic. Can use it for not only 'config'.

Now it can be used to parse interfaces for additional lldpd settings

Tested on: 22.03.6

Signed-off-by: Paul Donald 
---
 package/network/services/lldpd/files/lldpd.init | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index fc53520c5b..069c8fee80 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -75,10 +75,10 @@ get_config_restart_hash() {
export -n "$var=$_hash"
 }
 
-get_config_cid_ifaces() {
+get_interface_csv_pattern() {
set -o noglob
local _ifaces
-   config_get _ifaces 'config' "$2"
+   config_get _ifaces "$2" "$3"
 
local _iface _ifnames=""
for _iface in $_ifaces; do
@@ -115,7 +115,7 @@ write_lldpd_conf()
config_get lldp_hostname 'config' 'lldp_hostname' "$(cat 
/proc/sys/kernel/hostname)"
 
local ifnames
-   get_config_cid_ifaces ifnames "interface"
+   get_interface_csv_pattern ifnames 'config' "interface"
 
local lldp_mgmt_ip
config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip'
@@ -327,7 +327,7 @@ start_service() {
 
 # ChassisID interfaces
local ifnames
-   get_config_cid_ifaces ifnames "cid_interface"
+   get_interface_csv_pattern ifnames 'config' "cid_interface"
 
[ -n "$ifnames" ] && procd_append_param command -C "$ifnames"
 
-- 
2.44.0


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


[PATCH] base-files: reduce IPv6 ULA prefix generation to a single call

2024-04-02 Thread Paul Donald
Tested on: 23.05.3

Signed-off-by: Paul Donald 
---
 .../files/etc/uci-defaults/12_network-generate-ula  | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/package/base-files/files/etc/uci-defaults/12_network-generate-ula 
b/package/base-files/files/etc/uci-defaults/12_network-generate-ula
index 19d7ed7f2e..20b3237ec7 100644
--- a/package/base-files/files/etc/uci-defaults/12_network-generate-ula
+++ b/package/base-files/files/etc/uci-defaults/12_network-generate-ula
@@ -1,11 +1,9 @@
 [ "$(uci -q get network.globals.ula_prefix)" != "auto" ] && exit 0
 
-r1=$(dd if=/dev/urandom bs=1 count=1 |hexdump -e '1/1 "%02x"')
-r2=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"')
-r3=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"')
+r1=$(hexdump -vn 5 -e '5/1 "%02x"' /dev/urandom)
 
 uci -q batch <<-EOF >/dev/null
-   set network.globals.ula_prefix=fd$r1:$r2:$r3::/48
+   set network.globals.ula_prefix=fd${r1:0:2}:${r1:2:4}:${r1:6:4}::/48
commit network
 EOF
 
-- 
2.44.0


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


Re: Definition for flash w25q128 is wrong

2024-04-02 Thread Robert Marko
On Mon, 1 Apr 2024 at 15:00, e9hack  wrote:
>
> Am 01.04.2024 um 11:54 schrieb Robert Marko:
> > On Mon, 1 Apr 2024 at 11:25, e9hack  wrote:
> >>
> >> Am 01.04.2024 um 11:06 schrieb Robert Marko:
> >>> On Mon, 1 Apr 2024 at 10:32, e9hack  wrote:
> 
>  Am 01.04.2024 um 10:14 schrieb Robert Marko:
> > On Mon, 1 Apr 2024 at 06:29, e9hack  wrote:
> >>
> >> Hi,
> >>
> >> I'm using a TP-LINK WDR3600 with a bigger flash. Since some time the 
> >> router hangs in an endless boot loop. I see the following message:
> >>
> >> ...
> >> [0.402716] spi-nor spi0.0: BFPT parsing failed. Please consider 
> >> using SPI_NOR_SKIP_SFDP when declaring the flash
> >> [0.413217] spi-nor: probe of spi0.0 failed with error -22
> >> ...
> >> [0.926180] /dev/root: Can't open blockdev
> >> [0.930427] VFS: Cannot open root device "(null)" or 
> >> unknown-block(0,0): error -6
> >> [0.938037] Please append a correct "root=" boot option; here are 
> >> the available partitions:
> >> [0.946520] Kernel panic - not syncing: VFS: Unable to mount root 
> >> fs on unknown-block(0,0)
> >> [0.954914] Rebooting in 1 seconds..
> >>
> >> It looks like the definition for the flash is wrong:
> >>
> >> --- a/drivers/mtd/spi-nor/winbond.c 2024-03-15 19:27:50.0 
> >> +0100
> >> +++ b/drivers/mtd/spi-nor/winbond.c 2024-04-01 05:59:17.166780732 
> >> +0200
> >> @@ -120,8 +120,8 @@ static const struct flash_info winbond_n
> >>NO_SFDP_FLAGS(SECT_4K) },
> >>{ "w25q80bl", INFO(0xef4014, 0, 64 * 1024,  16)
> >>NO_SFDP_FLAGS(SECT_4K) },
> >> -   { "w25q128", INFO(0xef4018, 0, 0, 0)
> >> -   PARSE_SFDP
> >> +   { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256)
> >> +   NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 
> >> SPI_NOR_QUAD_READ)
> >>FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) },
> >>{ "w25q256", INFO(0xef4019, 0, 64 * 1024, 512)
> >>NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 
> >> SPI_NOR_QUAD_READ)
> >>
> >> With these changes, the flash will be detected properly.
> >
> > Yeah, I am not so sure this is correct as all w25q128 versions have
> > SFDP table so skipping SFDP parsing
> > isn't really correct.
> > Can you check what is the exact model you have?
> 
>  The chip (SOIC8) is marked with:
> 
>  winbond
>  25Q128FVSG
>  1327
> >>>
> >>> If it is Genuine Winbond then it has an SFDP table according to the 
> >>> datasheet:
> >>> https://www.winbond.com/hq/support/documentation/downloadV2022.jsp?__locale=en=/support/resources/.content/item/DA00-W25Q128FV.html=1
> >>>
> >>> AFAIK, all Winbond NOR with datecode 1124 and onwards have SFDP tables.
> >>>
> >>> Has this happened with kernel 6.1 or been going on for a while?
> >>
> >> My build from October is using kernel 5.15.133. I assume it is an issue of 
> >> kernel 6.1.
> >>
> >> It looks like a driver issue. A SOIC8 housing doesn't support dual/quad 
> >> SPI. The flash will be detect, if I change
> >>
> >> PARSE_SFDP to NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ).
> >
> > Hm, it really looks like your revision has broken SFDP but since
> > Winbond in their ultimate wisdom decided
> > that it was best to share the same JEDEC ID with other revisions SFDP
> > was enabled via:
> > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/mtd/spi-nor/winbond.c?h=v6.1.83=7c6ba20a0b9aeb82a6c097c74ccbecdda8e9fc25
> >
> > So you really need to report this to the linux-mtd crowd.
> > Can you check if SFDP table can be dumped on your NOR, cause there
> > should be one but most likely one of the tables is broken?
>
> The flash does not have a SFDP. I use another TP-LINK router. This is an 
> Archer C7 v2. It has the same flash chip with date code 1528. This flash has 
> a SFDP.

Then it would be best to send a revert upstream.

Regards,
Robert
>
> Regards,
> Hartmut
> >
> > Regards,
> > Robert
> >>
> >> Regards,
> >> Hartmut
> >>
> >>>
> >>> Regards,
> >>> Robert
> >>>
> 
> >
> > Regards,
> > Robert
> >>
> >> Regards,
> >> Hartmut
> >>
> >> ___
> >> 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


Faktoring

2024-04-02 Thread Urszula Wasiak 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 ---
Dzień dobry,

rozważali Państwo wybór finansowania, które spełni potrzeby firmy, zapewniając 
natychmiastowy dostęp do gotówki, bez zbędnych przestojów? 

Przygotowaliśmy rozwiązania faktoringowe dopasowane do Państwa branży i 
wielkości firmy, dzięki którym, nie muszą Państwo martwić się o niewypłacalność 
kontrahentów, ponieważ transakcje są zabezpieczone i posiadają gwarancję 
spłaty. 

Chcą Państwo przeanalizować dostępne opcje?


Z pozdrowieniami
Urszula Wasiak

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


Re: Status of snapshot builds for omap target

2024-04-02 Thread INAGAKI Hiroshi

Hi Raylynn,

omap target was disabled due to the VLAN issue on using cpsw-switch driver.

see details: https://github.com/openwrt/openwrt/issues/11953

On 2024/04/02 13:52, Raylynn Knight 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.

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


Best,
Hiroshi

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