Re: [PATCH 0/4] import libcap from packages feed

2021-03-11 Thread Bjørn Mork
Stijn Tintel  writes:

> I suspect some people might counter this by saying lldpd belongs in the
> packages feed; I strongly disagree as imo LLDP is an essential service
> for any network device, and especially switches. Even the cheapest
> managed switches support LLDP for more than 5 years already.

Yes, and we should really look into doing the 802.3at and bt stuff
properly for the switches wich such hardware.  This requires lldp.


Bjørn

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


[PATCH 1/4] libcap: import from packages feed

2021-03-11 Thread Stijn Tintel
Having libcap in OpenWrt base allows us to enable libcap support in
other packages in base.

In lldpd, this would allow the monitor process to drop its privileges
instead of running as root, improving security. It will also allow us to
drop our patch to disable libcap.

Signed-off-by: Stijn Tintel 
---
 package/libs/libcap/Makefile  | 116 ++
 .../libcap/patches/300-disable-tests.patch|  10 ++
 2 files changed, 126 insertions(+)
 create mode 100644 package/libs/libcap/Makefile
 create mode 100644 package/libs/libcap/patches/300-disable-tests.patch

diff --git a/package/libs/libcap/Makefile b/package/libs/libcap/Makefile
new file mode 100644
index 00..0206bd9d1d
--- /dev/null
+++ b/package/libs/libcap/Makefile
@@ -0,0 +1,116 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libcap
+PKG_VERSION:=2.43
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2
+PKG_HASH:=512a0e5fc4c1e06d472a20da26aa96a9b9bf2a26b23f094f77f1b8da56cc427f
+
+PKG_MAINTAINER:=Paul Wassi 
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=License
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/libcap/Default
+  TITLE:=Linux capabilities library
+  SECTION:=libs
+  CATEGORY:=Libraries
+  URL:=https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/
+endef
+
+define Package/libcap/description/Default
+  Linux capabilities
+endef
+
+define Package/libcap
+  $(call Package/libcap/Default)
+  TITLE += library
+endef
+
+define Package/libcap-bin
+  $(call Package/libcap/Default)
+  TITLE += binaries
+  DEPENDS += libcap
+endef
+
+define Package/libcap-bin/description
+  $(call Package/libcap/description/Default)
+  .
+  This package contains the libcap utilities.
+endef
+
+define Package/libcap-bin/config
+  if PACKAGE_libcap-bin
+  config PACKAGE_libcap-bin-capsh-shell
+string "capsh shell"
+help
+  Set the capsh shell.
+default "/bin/sh"
+  endif
+endef
+
+MAKE_FLAGS += \
+BUILD_CC="$(CC)" \
+BUILD_CFLAGS="$(FPIC) -I$(PKG_BUILD_DIR)/libcap/include" \
+CFLAGS="$(TARGET_CFLAGS)" \
+LD="$(TARGET_CC) -Wl,-x -shared" \
+LDFLAGS="$(TARGET_LDFLAGS)" \
+INDENT="| true" \
+GOLANG="no" \
+PAM_CAP="no" \
+RAISE_SETFCAP="no" \
+DYNAMIC="yes" \
+lib="lib"
+
+ifneq ($(CONFIG_PACKAGE_libcap-bin-capsh-shell),)
+TARGET_CFLAGS += -DSHELL='\"$(CONFIG_PACKAGE_libcap-bin-capsh-shell)\"'
+endif
+
+TARGET_CFLAGS += $(if $(CONFIG_USE_MUSL),-Dpthread_yield=sched_yield)
+
+define Build/InstallDev
+   $(INSTALL_DIR) $(1)/usr/include/sys
+   $(CP) $(PKG_INSTALL_DIR)/usr/include/sys/*.h $(1)/usr/include/sys/
+   $(INSTALL_DIR) $(1)/usr/lib
+   $(CP) $(PKG_INSTALL_DIR)/lib/libcap.{so*,a} $(1)/usr/lib/
+   $(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/libpsx.a $(1)/usr/lib/
+   $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+   $(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/pkgconfig/libcap.pc 
$(1)/usr/lib/pkgconfig/
+   $(SED) 's,exec_prefix=,exec_prefix=/usr,g' 
$(1)/usr/lib/pkgconfig/libcap.pc
+   $(SED) 's,/lib,{exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libcap.pc
+   $(SED) 's,/usr/include,{prefix}/include,g' 
$(1)/usr/lib/pkgconfig/libcap.pc
+   $(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/pkgconfig/libpsx.pc 
$(1)/usr/lib/pkgconfig/
+   $(SED) 's,exec_prefix=,exec_prefix=/usr,g' 
$(1)/usr/lib/pkgconfig/libpsx.pc
+   $(SED) 's,/lib,{exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libpsx.pc
+   $(SED) 's,/usr/include,{prefix}/include,g' 
$(1)/usr/lib/pkgconfig/libpsx.pc
+endef
+
+define Package/libcap/install
+   $(INSTALL_DIR) $(1)/usr/lib
+   $(CP) $(PKG_INSTALL_DIR)/lib/libcap.so* $(1)/usr/lib/
+endef
+
+define Package/libcap-bin/install
+   $(INSTALL_DIR) $(1)/usr/sbin
+   $(CP) $(PKG_INSTALL_DIR)/sbin/capsh $(1)/usr/sbin/
+   $(CP) $(PKG_INSTALL_DIR)/sbin/getcap$(1)/usr/sbin/
+   $(CP) $(PKG_INSTALL_DIR)/sbin/getpcaps  $(1)/usr/sbin/
+   $(CP) $(PKG_INSTALL_DIR)/sbin/setcap$(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,libcap))
+$(eval $(call BuildPackage,libcap-bin))
diff --git a/package/libs/libcap/patches/300-disable-tests.patch 
b/package/libs/libcap/patches/300-disable-tests.patch
new file mode 100644
index 00..c1779e28ec
--- /dev/null
+++ b/package/libs/libcap/patches/300-disable-tests.patch
@@ -0,0 +1,10 @@
+--- a/Makefile
 b/Makefile
+@@ -17,7 +17,6 @@ ifeq ($(GOLANG),yes)
+   $(MAKE) -C go $@
+   rm -f cap/go.sum
+ endif
+-  $(MAKE) -C tests $@
+   $(MAKE) -C progs $@
+   $(MAKE) -C doc $@
+   $(MAKE) -C kdebug $@
-- 
2.26.2


___
openwrt-devel mailing list

[PATCH 4/4] lldpd: add libcap dependency

2021-03-11 Thread Stijn Tintel
Now that libcap is in OpenWrt base, we can drop our custom patch to
disable libcap support and have lldpd depend on it instead. This will
allow the monitor process to drop its privileges instead of running as
root, improving security.

Signed-off-by: Stijn Tintel 
---
 package/network/services/lldpd/Makefile |  4 ++--
 .../lldpd/patches/001-disable_libcap.patch  | 17 -
 2 files changed, 2 insertions(+), 19 deletions(-)
 delete mode 100644 
package/network/services/lldpd/patches/001-disable_libcap.patch

diff --git a/package/network/services/lldpd/Makefile 
b/package/network/services/lldpd/Makefile
index 74d6791091..1329abe874 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.7
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd
@@ -30,7 +30,7 @@ define Package/lldpd
   SUBMENU:=Routing and Redirection
   TITLE:=Link Layer Discovery Protocol daemon
   URL:=https://vincentbernat.github.io/lldpd/
-  DEPENDS:=+libevent2 +USE_GLIBC:libbsd +LLDPD_WITH_JSON:libjson-c 
+LLDPD_WITH_SNMP:libnetsnmp
+  DEPENDS:=+libcap +libevent2 +USE_GLIBC:libbsd +LLDPD_WITH_JSON:libjson-c 
+LLDPD_WITH_SNMP:libnetsnmp
   USERID:=lldp=121:lldp=129
   MENU:=1
 endef
diff --git a/package/network/services/lldpd/patches/001-disable_libcap.patch 
b/package/network/services/lldpd/patches/001-disable_libcap.patch
deleted file mode 100644
index 96cf00a653..00
--- a/package/network/services/lldpd/patches/001-disable_libcap.patch
+++ /dev/null
@@ -1,17 +0,0 @@
 a/configure.ac
-+++ b/configure.ac
-@@ -246,7 +246,13 @@ PKG_CHECK_MODULES([check], [check >= 0.9
- 
- # Third-party libraries
- lldp_CHECK_LIBEVENT
--lldp_CHECK_LIBCAP
-+
-+#libcap is not a core package so disable this capability
-+#lldp_CHECK_LIBCAP
-+libcap_LIBS=
-+libcap_CFLAGS=
-+AC_SUBST([libcap_LIBS])
-+AC_SUBST([libcap_CFLAGS])
- 
- # Compatibility with pkg.m4 < 0.27
- m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
-- 
2.26.2


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


[PATCH 3/4] libcap: bump to 2.48

2021-03-11 Thread Stijn Tintel
Signed-off-by: Stijn Tintel 
---
 package/libs/libcap/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/libs/libcap/Makefile b/package/libs/libcap/Makefile
index 29ff75c5cd..b8e45a52c7 100644
--- a/package/libs/libcap/Makefile
+++ b/package/libs/libcap/Makefile
@@ -6,12 +6,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libcap
-PKG_VERSION:=2.43
+PKG_VERSION:=2.48
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2
-PKG_HASH:=512a0e5fc4c1e06d472a20da26aa96a9b9bf2a26b23f094f77f1b8da56cc427f
+PKG_HASH:=4de9590ee09a87c282d558737ffb5b6175ccbfd26d580add10df44d0f047f6c2
 
 PKG_MAINTAINER:=Paul Wassi 
 PKG_LICENSE:=GPL-2.0-only
-- 
2.26.2


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


[PATCH 2/4] libcap: drop invalid copyright header

2021-03-11 Thread Stijn Tintel
Signed-off-by: Stijn Tintel 
---
 package/libs/libcap/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/package/libs/libcap/Makefile b/package/libs/libcap/Makefile
index 0206bd9d1d..29ff75c5cd 100644
--- a/package/libs/libcap/Makefile
+++ b/package/libs/libcap/Makefile
@@ -1,6 +1,4 @@
 #
-# Copyright (C) 2011 OpenWrt.org
-#
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-- 
2.26.2


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


[PATCH 0/4] import libcap from packages feed

2021-03-11 Thread Stijn Tintel
Having libcap in OpenWrt base allows us to enable libcap support in
other packages in base.

In lldpd, this would allow the monitor process to drop its privileges
instead of running as root, improving security. It will also allow us to
drop our patch to disable libcap.

I suspect some people might counter this by saying lldpd belongs in the
packages feed; I strongly disagree as imo LLDP is an essential service
for any network device, and especially switches. Even the cheapest
managed switches support LLDP for more than 5 years already.

Also see: https://github.com/openwrt/openwrt/pull/3823#issuecomment-795174537
I'll bump lldpd to the latest version after this series is merged, and
debug the problem reported by John on the realtek target.

Stijn Tintel (4):
  libcap: import from packages feed
  libcap: drop invalid copyright header
  libcap: bump to 2.48
  lldpd: add libcap dependency

 package/libs/libcap/Makefile  | 114 ++
 .../libcap/patches/300-disable-tests.patch|  10 ++
 package/network/services/lldpd/Makefile   |   4 +-
 .../lldpd/patches/001-disable_libcap.patch|  17 ---
 4 files changed, 126 insertions(+), 19 deletions(-)
 create mode 100644 package/libs/libcap/Makefile
 create mode 100644 package/libs/libcap/patches/300-disable-tests.patch
 delete mode 100644 
package/network/services/lldpd/patches/001-disable_libcap.patch

-- 
2.26.2


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


Re: [PATCH v2] realtek: drop ethtool log noise

2021-03-11 Thread Stijn Tintel
On 11/03/2021 14:35, Bjørn Mork wrote:
> Demote a number of debugging printk's to pr_debug to avoid log
> nosie.  Several of these functions are called as a result of
> userspace activity.  This can cause a lot of log noise when
> userspace does periodic polling.
>
> Most of this could probably be removed completely, but let's
> keep it for now since these drivers are still in development.
>
Merged, thanks!

Stijn


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


[PATCH] gmp: compile with -DPIC to use correct asm code

2021-03-11 Thread Eneas U de Queiroz
The library is always compiled with $(FPIC) (-fPIC or -fpic), even for
the static library.

There are some assembly sources that decide whether or not to enable
PIC code by checking if PIC is defined.  It counts on libtool to define
it, but libtool does it only when producing code for the dynamic
library, while we need it for both.

Ensure it is defined by adding it to CFLAGS next to $(FPIC).

It avoids linking errors with strongswan on x86_64:

ld: libgmp.a(bdiv_q_1.o): relocation R_X86_64_PC32 against symbol
`__gmp_binvert_limb_table' can not be used when making a shared object;
recompile with -fPIC

Cc: Stijn Tintel 
Signed-off-by: Eneas U de Queiroz 
---

There's an error on one architecture, and all others work fine without
this, so I'm uneasy changing this and then breaking stuff that was
working fine otherwise.  However, it feels wrong to me to generate PIC
code from C files, but not use it in asm sources, which is essentially
what I am changing here.

I've looked at asm sources for different chitectures, and there are
checks for PIC in: arm64, arm, x86_64, x86, and ppc asm sources, but the
error only appears on x86_64.

For most CPUs, ifdef(`PIC'), is just used to do different definitions of
LEA (Load Effective Address).  However, both x86 and x86_64 have many
other checks.

I've looked at bdiv_q_1.asm for different CPUs, and they all do some
form of LEA(binvert_limb_table), except for x86, where it will do it
only when PIC is defined.  That may explain why x86_64 is affected, and
x86 is not.

I have not investigated further details.

Alternatively, we can define it only for x86_64, which is where we know
there's a build failure with the linker asking to recompile with -fPIC.


 package/libs/gmp/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/libs/gmp/Makefile b/package/libs/gmp/Makefile
index eb7d808139..d59e8fe947 100644
--- a/package/libs/gmp/Makefile
+++ b/package/libs/gmp/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gmp
 PKG_VERSION:=6.2.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)$(PKG_REVISION).tar.xz
 PKG_SOURCE_URL:=@GNU/gmp/
@@ -38,7 +38,7 @@ define Package/libgmp/description
signed integers, rational numbers, and floating point numbers.
 endef
 
-TARGET_CFLAGS += $(FPIC)
+TARGET_CFLAGS += -DPIC $(FPIC)
 CONFIGURE_VARS += CC="$(TARGET_CROSS)gcc"
 CONFIGURE_ARGS += \
--enable-shared \

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


Re: [PATCH] x86/64: Add CONFIG_DEVMEM=y for targets/x86/64

2021-03-11 Thread Supriya Shekhar Mane
Petr Štetiar  writes:

Dear Maintainers,

> Unless there is a good reason to have this enabled, it should stay
> disabled in official builds and "but Debian has it enabled" is not
> valid argument either.

Now that it's being decided that macro
CONFIG_DEVMEM shall not be enabled by default, why can't bug ID FS#3461
be closed?

Regards,
Supriya Mane


On Thu, Mar 11, 2021 at 6:24 PM Supriya Shekhar Mane
 wrote:
>
> Hi Petr,
>
> As CONFIG_DEVMEM shall not be enabled by default, then this ticket can be 
> moved to closure.
> Please suggest the closing procedure.
>
> Regards,
> Supriya Mane
>
> On Sun, Feb 14, 2021 at 8:39 PM Petr Štetiar  wrote:
>>
>> Bjørn Mork  [2021-02-14 10:33:15]:
>>
>> Hi,
>>
>> > And it's already enabled for the ipq807x and rockchip targets, so you can't
>> > really claim that it's not available in OpenWrt either.
>>
>> thanks to bringing this to my attention, but I tend to believe, that this is
>> not intentional.
>>
>> > I do hope you don't think OpenWrt is somehow more secure than a current
>> > Debian installation because you arbitrarily remove kernel features like
>> > this one?
>>
>> Unless there is a good reason to have this enabled, it should stay disabled 
>> in
>> official builds and "but Debian has it enabled" is not valid argument either.
>>
>> > The security issues in OpenWrt are caused by almost every process running 
>> > as
>> > root.
>>
>> Thanks to Daniel, this is getting reduced like dnsmasq, logd, ntp, ubus to
>> name a few.
>>
>> Cheers,
>>
>> Petr
>>
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

-- 
Disclaimer:This message is intended only for the designated recipient(s). 
It may contain confidential or proprietary information and may be subject 
to other confidentiality protections. If you are not a designated 
recipient, you may not review, copy or distribute this message. Please 
notify the sender by e-mail and delete this message. GlobalEdge does not 
accept any liability for virus infected mails.


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


[PATCH] x86/64: Add CONFIG_DEVMEM=y for targets/x86/64

2021-03-11 Thread supriya Mane
Petr Štetiar  writes:

Dear Maintainers,

> Unless there is a good reason to have this enabled, it should stay
> disabled in official builds and "but Debian has it enabled" is not
> valid argument either.

Now that it's being decided that macro
CONFIG_DEVMEM shall not be enabled by default, why can't bug ID FS#3461
be closed? 

Regards, 
Supriya Mane

-- 
Disclaimer:This message is intended only for the designated recipient(s). 
It may contain confidential or proprietary information and may be subject 
to other confidentiality protections. If you are not a designated 
recipient, you may not review, copy or distribute this message. Please 
notify the sender by e-mail and delete this message. GlobalEdge does not 
accept any liability for virus infected mails.


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


[PATCH] uclient-http: set eof mark when content-length is 0

2021-03-11 Thread Youfu Zhang
or uclient-fetch will stall until timeout for 2XX (except 204) response
with content-length of 0

Signed-off-by: Youfu Zhang 
---
 uclient-http.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/uclient-http.c b/uclient-http.c
index 349e69c..c2bba6b 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -655,7 +655,8 @@ static void uclient_http_headers_complete(struct 
uclient_http *uh)
if (uh->eof || seq != uh->uc.seq)
return;
 
-   if (uh->req_type == REQ_HEAD || uh->uc.status_code == 204) {
+   if (uh->req_type == REQ_HEAD || uh->uc.status_code == 204 ||
+   uh->content_length == 0) {
uh->eof = true;
uclient_notify_eof(uh);
}
-- 
2.30.2


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


netifd: Send permission denied for syslog after proto misconfiguration

2021-03-11 Thread Florian Eckert

Hello Hans,

I have had the problem for a long time that I see the following message 
in the syslog.


Tue Apr  2 10:50:23 2019 daemon.notice netifd: wwan (11146): Command 
failed: Permission denied


This message in the syslog is written when the interface makes a 
teardown after a misconfiguration.

According to my researches, it must be related to this commit [1].

In the proto handler uqmi [2] and I think also in umbim [3] these are 
the function calls that generate this message in the log.


It's not bad but it's not clean.
How can we stop this message to get written to the syslog?
Is it enough to send it to /dev/null?

I also wonder why we need this call at all.
The proto is cleaned up by the calls to uqmi and umbim binaries.

I'm missing the connections, can you help me?

Or does this have something to do with the dhcp?

Kind regards

Florian

[1] 
https://git.openwrt.org/?p=project/netifd.git;a=commit;h=99cfef35370b274352934c2f85a9de83ac537036
[2] 
https://github.com/openwrt/openwrt/blob/master/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh#L449
[3] 
https://github.com/openwrt/openwrt/blob/master/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh#L177


PS:

Can you please also look at this patch.
https://patchwork.ozlabs.org/project/openwrt/patch/20201124071800.9080-1...@dev.tdt.de/


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


[PATCH v2] realtek: drop ethtool log noise

2021-03-11 Thread Bjørn Mork
Demote a number of debugging printk's to pr_debug to avoid log
nosie.  Several of these functions are called as a result of
userspace activity.  This can cause a lot of log noise when
userspace does periodic polling.

Most of this could probably be removed completely, but let's
keep it for now since these drivers are still in development.

Signed-off-by: Bjørn Mork 
---
 .../files-5.4/drivers/net/dsa/rtl83xx/dsa.c   |  2 +-
 .../drivers/net/ethernet/rtl838x_eth.c| 28 +--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c 
b/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c
index f7b9aca7a7c0..987b47dc8fc6 100644
--- a/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c
@@ -311,7 +311,7 @@ static int rtl83xx_phylink_mac_link_state(struct dsa_switch 
*ds, int port,
link = priv->r->get_port_reg_le(priv->r->mac_link_sts);
if (link & BIT_ULL(port))
state->link = 1;
-   pr_info("%s: link state: %llx\n", __func__, link & BIT_ULL(port));
+   pr_debug("%s: link state: %llx\n", __func__, link & BIT_ULL(port));
 
state->duplex = 0;
if (priv->r->get_port_reg_le(priv->r->mac_link_dup_sts) & BIT_ULL(port))
diff --git a/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c 
b/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c
index 7931daff07cf..2f678b738490 100644
--- a/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c
@@ -855,7 +855,7 @@ static int rtl838x_eth_open(struct net_device *ndev)
struct ring_b *ring = priv->membase;
int i, err;
 
-   pr_info("%s called: RX rings %d(length %d), TX rings %d(length %d)\n",
+   pr_debug("%s called: RX rings %d(length %d), TX rings %d(length %d)\n",
__func__, priv->rxrings, priv->rxringlen, TXRINGS, TXRINGLEN);
 
spin_lock_irqsave(>lock, flags);
@@ -1342,7 +1342,7 @@ static void rtl838x_validate(struct phylink_config 
*config,
 {
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 
-   pr_info("In %s\n", __func__);
+   pr_debug("In %s\n", __func__);
 
if (!phy_interface_mode_is_rgmii(state->interface) &&
state->interface != PHY_INTERFACE_MODE_1000BASEX &&
@@ -1404,7 +1404,7 @@ static void rtl838x_mac_an_restart(struct phylink_config 
*config)
if (priv->family_id != RTL8380_FAMILY_ID)
return;
 
-   pr_info("In %s\n", __func__);
+   pr_debug("In %s\n", __func__);
/* Restart by disabling and re-enabling link */
sw_w32(0x6192D, priv->r->mac_force_mode_ctrl + priv->cpu_port * 4);
mdelay(20);
@@ -1419,7 +1419,7 @@ static int rtl838x_mac_pcs_get_state(struct 
phylink_config *config,
struct rtl838x_eth_priv *priv = netdev_priv(dev);
int port = priv->cpu_port;
 
-   pr_info("In %s\n", __func__);
+   pr_debug("In %s\n", __func__);
 
state->link = priv->r->get_mac_link_sts(port) ? 1 : 0;
state->duplex = priv->r->get_mac_link_dup_sts(port) ? 1 : 0;
@@ -1456,7 +1456,7 @@ static void rtl838x_mac_link_down(struct phylink_config 
*config,
struct net_device *dev = container_of(config->dev, struct net_device, 
dev);
struct rtl838x_eth_priv *priv = netdev_priv(dev);
 
-   pr_info("In %s\n", __func__);
+   pr_debug("In %s\n", __func__);
/* Stop TX/RX to port */
sw_w32_mask(0x03, 0, priv->r->mac_port_ctrl(priv->cpu_port));
 }
@@ -1468,7 +1468,7 @@ static void rtl838x_mac_link_up(struct phylink_config 
*config, unsigned int mode
struct net_device *dev = container_of(config->dev, struct net_device, 
dev);
struct rtl838x_eth_priv *priv = netdev_priv(dev);
 
-   pr_info("In %s\n", __func__);
+   pr_debug("In %s\n", __func__);
/* Restart TX/RX to port */
sw_w32_mask(0, 0x03, priv->r->mac_port_ctrl(priv->cpu_port));
 }
@@ -1479,7 +1479,7 @@ static void rtl838x_set_mac_hw(struct net_device *dev, u8 
*mac)
unsigned long flags;
 
spin_lock_irqsave(>lock, flags);
-   pr_info("In %s\n", __func__);
+   pr_debug("In %s\n", __func__);
sw_w32((mac[0] << 8) | mac[1], priv->r->mac);
sw_w32((mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) | mac[5], 
priv->r->mac + 4);
 
@@ -1547,7 +1547,7 @@ static int rtl838x_get_link_ksettings(struct net_device 
*ndev,
 {
struct rtl838x_eth_priv *priv = netdev_priv(ndev);
 
-   pr_info("%s called\n", __func__);
+   pr_debug("%s called\n", __func__);
return phylink_ethtool_ksettings_get(priv->phylink, cmd);
 }
 
@@ -1556,7 +1556,7 @@ static int rtl838x_set_link_ksettings(struct net_device 
*ndev,
 {
struct rtl838x_eth_priv *priv = netdev_priv(ndev);
 
-   pr_info("%s called\n", __func__);
+   

Re: [PATCH] rtl83xx-poe: add package

2021-03-11 Thread Stijn Segers

Working brilliantly for weeks here as well.

Tested-by: Stijn Segers 



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


Re: iproute2 fails to build setting LIBBPF_DYNAMIC unless LIBBPF_DIR is defined.

2021-03-11 Thread Rui Salvaterra
Hi, guys!

On Thu, 11 Mar 2021 at 09:25,  wrote:
>
> The issue with limits.h was exactly one of those intermittent, 
> hard-to-reproduce problems recently reported (by Rui Salvaterra), with 
> similar patches being shared. As in your case, having builds by buildbots and 
> others routinely succeed raises doubts about the root problem. See for 
> example: 
> https://freenode.irclog.whitequark.org/openwrt-devel/2021-03-08#29320461. I 
> also believe doing a "make dirclean" was only one of the things Rui tried 
> before before his builds started succeeding, but I'll let him comment 
> further. And as I noted on IRC, I'd still like to see a patch upstreamed.

In my situation, make dirclean doesn't help, only patching the
relevant files to include limits.h. However, my reluctance to send an
upstream patch comes from the fact that I didn't have any problems
building the iproute2 tools manually (cloning
git://git.kernel.org/pub/scm/network/iproute2/iproute2.git and running
make all).

Cheers,
Rui

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


Re: [PATCH v2 1/1] ltq-vdsl-app: add line_state number and power_state number

2021-03-11 Thread Florian Eckert

Hello Andre


We already talked about it, but once again for the list:


Here are my thoughts on why I would like to have this for the 
mailinglist.



I skipped both of these numeric state values when porting this to
ubus/C, because those are internal and lantiq implementation specific.
I'd like to avoid exposing those if possible.


So far we only have the lantiq DSL implementation.
The only thing I can think of is that Broadcom also has DSL.
But they have a strange licensing policy and are therefore negligible.
I have also not yet seen a target that has this DSL frontend from 
broadcom.


With the old implementation, we also exported the numbers via the UBUS.
I already used this data for the collectd to also record the line_state 
and the power_state over time.
There is already a pullrequest pending to integrate this into collectd 
[0] with some other datas



I've only seen very few of all of those actually happening.


That's right, I've only seen a handful so far too
But I can't tell which ones are important or negligible.


Can we not expose new metrics instead of these internal numbers?


We can do that.
The only question is which data we want to export.
I definitely can not save strings in an RRD database.


Like there's already "up":
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);

If you care e.g. about showtime you could just add:
m_bool("showtime", out.data.nLineState ==
DSL_LINESTATE_SHOWTIME_NO_SYNC || out.data.nLineState ==
DSL_LINESTATE_SHOWTIME_TC_SYNC);


That would be a possibility.
The collectd db type would be a bool.
From my point of view, the following values would be important.
I am currently evaluating this.
All other values are saved as unknown and so -1 in ma rrd database


0 -> Not initialized
1 -> Exception
256 -> Idle
512 -> Silent
768 -> Handshake
896 -> Full init
1280 -> Training
2048 -> Showtime without TC-Layer sync
2049 -> Showtime without TC-Layer sync
3328 -> Resync

What is also added is the power_state. However, these are not many 
values.



Kind regards

Florian

[0] https://github.com/openwrt/packages/pull/12175

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