[netifd] interface-ip:fix memory corruption bug when setting resolv.conf path
From: Junnan XU The value of the resolv_conf variable can be specified by input parameters when netifd is started.So when the length of the resolv_conf variable value is less than "/tmp/resolv.conf-%s.d/resolv.conf.auto", the memory out-of-bounds operation will occur in interface_write_resolv_conf function. Signed-off-by: Junnan XU --- interface-ip.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface-ip.c b/interface-ip.c index 7b63ef9..2934575 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -1545,7 +1545,10 @@ __interface_write_dns_entries(FILE *f, const char *jail) void interface_write_resolv_conf(const char *jail) { - size_t plen = (jail ? strlen(jail) + 1 : 0 ) + strlen(resolv_conf) + 1; + size_t resolv_conf_len = strlen(resolv_conf); + size_t tmp_resolve_conf_len = strlen("/tmp/resolv.conf-.d/resolv.conf.auto"); + size_t plen = (jail ? strlen(jail) + 1 : 0) + (resolv_conf_len > tmp_resolve_conf_len ? + resolv_conf_len : tmp_resolve_conf_len) + 1; char *path = alloca(plen); char *dpath = alloca(plen); char *tmppath = alloca(plen + 4); -- 2.25.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
802.11v: hostapd: time_zone
I tried enabling the wifi settings for 2.4 and 5Ghz.: == time_advertisement == Result: OK. Time appears in beacon frames. e.g. Tag: Time Advertisement Tag Number: Time Advertisement (69) Tag length: 17 Timing capabilities: UTC time at which the TSF timer is 0 (2) Time Value: e5070c07022b2400: current time=2021-12-07 02:44:10 Time Error: 00 Time Update Counter: 0 == time_zone == (set as CET-1CEST,M3.5.0,M10.5.0/3) Result: NOK. Time Zone never appears in beacon frames. Has there been a regression in hostapd, or... was time_zone functionality ever implemented there? Can anyone else confirm? Documentation says it should be there and working. 21.02.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
hostapd: proxy ARP (802.11v)
Could this be picked to 21.02 branch, please? https://github.com/openwrt/openwrt/commit/e309b57619b9c073b9b8857858d9456183f27d7d ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [PATCH] netifd: system-linux: add dev_type info for ubus network.device status
Hi, imho these types are not that useful in practice (e.g. tap devices etc. are all reported as "ethernet". Maybe expose /sys/class/net/$devname/uevent DEVTYP= instead. ~ Jo signature.asc Description: OpenPGP digital signature ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: coreutils
On 2021-12-06 14:33, Paul Spooren wrote: On 6. Dec 2021, at 13:37, Paul D wrote: Could coreutils in rust be interesting for this project? (memory safety, at least at a later date) I think long term rust routers would be of interest, did you already do some rather research? From a first looks it seem to miss a shell which is included in busybox (ash). Did you check the binary size? They use MIT license, however. It's still young and many components are not yet done. Just the idea seems interesting, however. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: coreutils
> On 6. Dec 2021, at 13:37, Paul D wrote: > > Could coreutils in rust be interesting for this project? (memory safety, at > least at a later date) I think long term rust routers would be of interest, did you already do some rather research? From a first looks it seem to miss a shell which is included in busybox (ash). Did you check the binary size? > > > They use MIT license, however. > > ___ > 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: coreutils
They use MIT license, however. https://github.com/uutils/coreutils ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
coreutils
Could coreutils in rust be interesting for this project? (memory safety, at least at a later date) They use MIT license, however. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH v2] netifd: system-linux: add dev_type info for ubus network.device status
Every network device has a type. This is stored in the sysfs under '/sys/class/net//type' as a number and can be queried. This commit adds this information as a string to the ubus. 'ubus call network.device status' { ... "eth0": { "dev_type": "ETHER", ... } Signed-off-by: Florian Eckert --- v2: remove debug log output system-linux.c | 20 system.h | 36 2 files changed, 56 insertions(+) diff --git a/system-linux.c b/system-linux.c index e768853..a1728ab 100644 --- a/system-linux.c +++ b/system-linux.c @@ -2395,6 +2395,17 @@ system_if_force_external(const char *ifname) return stat(dev_sysfs_path(ifname, "phy80211"), ) == 0; } +static inline unsigned short netdev_type_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; +} + int system_if_dump_info(struct device *dev, struct blob_buf *b) { @@ -2402,6 +2413,9 @@ system_if_dump_info(struct device *dev, struct blob_buf *b) struct ifreq ifr; char *s; void *c; + unsigned short dev_type = 0; + int i; + char buf[10]; memset(, 0, sizeof(ecmd)); memset(, 0, sizeof(ifr)); @@ -2430,6 +2444,12 @@ system_if_dump_info(struct device *dev, struct blob_buf *b) blobmsg_add_u8(b, "autoneg", !!ecmd.autoneg); } + if (!system_get_dev_sysfs("type", dev->ifname, buf, sizeof(buf))) { + dev_type = strtoul(buf, NULL, 0); + i = netdev_type_pos(dev_type); + blobmsg_add_string(b, "dev_type", netdev_type_name[i]); + } + return 0; } diff --git a/system.h b/system.h index 1f7037d..fdd8a64 100644 --- 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", "ETHER", "EETHER", "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", "IEEE80211_PRISM", + "IEEE80211_RADIOTAP", "PHONET", "PHONET_PIPE", + "IEEE802154", "VOID", "NONE" +}; + enum tunnel_param { TUNNEL_ATTR_TYPE, TUNNEL_ATTR_REMOTE, -- 2.20.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH] netifd: system-linux: add dev_type info for ubus network.device status
Every network device has a type. This is stored in the sysfs under '/sys/class/net//type' as a number and can be queried. This commit adds this information as a string to the ubus. 'ubus call network.device status' { ... "eth0": { "dev_type": "ETHER", ... } Signed-off-by: Florian Eckert --- system-linux.c | 21 + system.h | 36 2 files changed, 57 insertions(+) diff --git a/system-linux.c b/system-linux.c index e768853..4ac34cc 100644 --- a/system-linux.c +++ b/system-linux.c @@ -2395,6 +2395,17 @@ system_if_force_external(const char *ifname) return stat(dev_sysfs_path(ifname, "phy80211"), ) == 0; } +static inline unsigned short netdev_type_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; +} + int system_if_dump_info(struct device *dev, struct blob_buf *b) { @@ -2402,6 +2413,9 @@ system_if_dump_info(struct device *dev, struct blob_buf *b) struct ifreq ifr; char *s; void *c; + unsigned short dev_type = 0; + int i; + char buf[10]; memset(, 0, sizeof(ecmd)); memset(, 0, sizeof(ifr)); @@ -2430,6 +2444,13 @@ system_if_dump_info(struct device *dev, struct blob_buf *b) blobmsg_add_u8(b, "autoneg", !!ecmd.autoneg); } + if (!system_get_dev_sysfs("type", dev->ifname, buf, sizeof(buf))) { + dev_type = strtoul(buf, NULL, 0); + i = netdev_type_pos(dev_type); + blobmsg_add_string(b, "dev_type", netdev_type_name[i]); + netifd_log_message(L_CRIT, "Interface type %s detected\n", netdev_type_name[i]); + } + return 0; } diff --git a/system.h b/system.h index 1f7037d..fdd8a64 100644 --- 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", "ETHER", "EETHER", "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", "IEEE80211_PRISM", + "IEEE80211_RADIOTAP", "PHONET", "PHONET_PIPE", + "IEEE802154", "VOID", "NONE" +}; + enum tunnel_param { TUNNEL_ATTR_TYPE, TUNNEL_ATTR_REMOTE, -- 2.20.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel