Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions board/common/rootfs/etc/bash.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ log()
less +G -r "$fn"
}

follow()
follow ()
{
local fn="/var/log/syslog"
[ -n "$1" ] && fn="/var/log/$1"
less +F -r "$fn"

tail -F -n +1 "$fn"
}

_logfile_completions()
Expand Down
2 changes: 1 addition & 1 deletion board/common/rootfs/etc/default/zebra
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# --log-level debug
ZEBRA_ARGS="-A 127.0.0.1 -u frr -g frr --log syslog "
ZEBRA_ARGS="-A 127.0.0.1 -u frr -g frr --log syslog --log-level err"
2 changes: 1 addition & 1 deletion board/common/rootfs/etc/finit.d/available/restconf.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
service name:rousette notify:none log <pid/confd> env:/etc/default/confd \
service name:rousette notify:none log:console <pid/confd> env:/etc/default/confd \
[12345] rousette --syslog -t $CONFD_TIMEOUT \
-- RESTCONF server
6 changes: 2 additions & 4 deletions board/common/rootfs/etc/finit.d/available/wifi@.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
service name:wpa_supplicant :%i \
[2345] wpa_supplicant -s -i %i -c /etc/wpa_supplicant-%i.conf -P/var/run/wpa_supplicant-%i.pid \
-- Wi-Fi Station @%i

task name:wifi-scanner :%i [2345] <pid/wpa_supplicant:%i> /usr/libexec/infix/wifi-scanner %i -- Start scanning for SSID @%i
[2345] wpa_supplicant -s -i %i -c /etc/wpa_supplicant-%i.conf -P/var/run/wpa_supplicant-%i.pid \
-- Wi-Fi Station @%i
12 changes: 10 additions & 2 deletions board/common/rootfs/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ http {

include /etc/nginx/enabled/*.conf;

access_log syslog:server=unix:/dev/log,nohostname,facility=local7,severity=info;
error_log syslog:server=unix:/dev/log,nohostname,facility=local7 info;
# Skip 2xx and 3xx
# Skip 400 (e.g., rrousette syntax errors)
map $status $loggable {
~^[23] 0;
400 0;
default 1;
}

access_log syslog:server=unix:/dev/log,nohostname,facility=local7,severity=warn combined if=$loggable;
error_log syslog:server=unix:/dev/log,nohostname,facility=local7 warn;
}
16 changes: 0 additions & 16 deletions board/common/rootfs/usr/libexec/infix/wifi-scanner

This file was deleted.

3 changes: 2 additions & 1 deletion configs/aarch64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ BR2_PACKAGE_MARVELL_CN9130_CRB=y
BR2_PACKAGE_MARVELL_ESPRESSOBIN=y
BR2_PACKAGE_RASPBERRYPI_RPI64=y
BR2_PACKAGE_STYX_DCP_SC_28P=y
BR2_PACKAGE_FEATURE_WIFI_DONGLE_REALTEK=y
BR2_PACKAGE_FEATURE_WIFI_MEDIATEK=y
BR2_PACKAGE_FEATURE_WIFI_REALTEK=y
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_CURIOS_HTTPD=y
Expand Down
143 changes: 91 additions & 52 deletions doc/scripting-restconf.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,77 +18,116 @@ To simplify RESTCONF operations, create a `curl.sh` wrapper script:
#!/bin/sh
# RESTCONF CLI wrapper for curl

# Show usage and exit
HOST=${HOST:-infix.local}
DATASTORE=running
AUTH=admin:admin

usage()
{
cat <<-EOF >&2
Usage: $0 [-h HOST] [-d DATASTORE] [-u USER:PASS] METHOD PATH [CURL_ARGS...]

Options:
-h HOST Target host (default: infix.local)
-d DS Datastore: running, operational, startup (default: running)
-u CREDS Credentials as user:pass (default: admin:admin)

Methods: GET, POST, PUT, PATCH, DELETE
EOF
exit "$1"
cat <<EOF >&2
Usage: $0 [-v] [-h HOST] [-d DATASTORE] [-u USER:PASS] METHOD XPATH [CURL_ARGS...]

Options:
-h HOST Target host (default: infix.local)
-d DS Datastore: running, operational, startup (default: running)
-u CREDS Credentials as user:pass (default: admin:admin)
-v Verbose mode, use it to display variables and curl command

Methods: GET, POST, PUT, PATCH, DELETE
EOF
exit "$1"
}

# Default values
HOST=${HOST:-infix.local}
DATASTORE=running
AUTH=admin:admin
check()
{
hint="Note: URL may be missing a module prefix (e.g., ietf-system:system)"
resp="$1"
url="$2"

if ! command -v jq >/dev/null 2>&1; then
printf "%s\n" "$resp"
return
fi

case "$resp" in
*"Syntax error"*)
path_only="${url#*//}"

# Check for common URL error(s), e.g., missing module prefix
case "$path_only" in
*":"*)
printf "%s\n" "$resp" | jq .
;;
*)
printf "%s\n" "$resp" | jq --arg hint "$hint" \
'.["ietf-restconf:errors"].error[] |= . + {comment: $hint}'
;;
esac
;;
*)
printf "%s\n" "$resp" | jq .
;;
esac
}

# Parse options
while getopts "h:d:u:" opt; do
case $opt in
h) HOST="$OPTARG" ;;
d) DATASTORE="$OPTARG" ;;
u) AUTH="$OPTARG" ;;
*) usage 1 ;;
esac
while getopts "h:d:u:v" opt; do
case $opt in
h) HOST="$OPTARG" ;;
d) DATASTORE="$OPTARG" ;;
u) AUTH="$OPTARG" ;;
v) VERBOSE=1 ;;
*) usage 1 ;;
esac
done
shift $((OPTIND - 1))

# Validate required arguments
if [ $# -lt 2 ]; then
echo "Error: METHOD and PATH are required" >&2
usage 1
echo "Error: METHOD and XPATH are required" >&2
usage 1
fi

METHOD=$1
PATH=$2
XPATH=$2
shift 2

# Ensure PATH starts with /
case "$PATH" in
/*) ;;
*) PATH="/$PATH" ;;
# Ensure XPATH starts with /
case "$XPATH" in
/*) ;;
*) XPATH="/$XPATH" ;;
esac

# Build URL based on datastore
case "$DATASTORE" in
running|startup)
URL="https://${HOST}/restconf/data${PATH}"
;;
operational)
URL="https://${HOST}/restconf/data${PATH}"
;;
*)
echo "Error: Invalid datastore '$DATASTORE'. Use: running, operational, or startup" >&2
exit 1
;;
running|startup)
URL="https://${HOST}/restconf/data${XPATH}"
;;
operational)
URL="https://${HOST}/restconf/data${XPATH}"
;;
*)
echo "Error: Invalid datastore '$DATASTORE'. Use: running, operational, or startup" >&2
exit 1
;;
esac

# Execute curl with all remaining arguments passed through
exec /usr/bin/curl \
--insecure \
--user "${AUTH}" \
--request "${METHOD}" \
--header "Content-Type: application/yang-data+json" \
--header "Accept: application/yang-data+json" \
"$@" \
"${URL}"
if [ "$VERBOSE" ]; then
echo "DS : $DATASTORE"
echo "OP : $METHOD"
echo "XPATH : $XPATH"
echo "AUTH : $AUTH"
echo "=> URL : $URL"
set -x
fi

RESP=$(/usr/bin/curl --silent \
--insecure \
--user "${AUTH}" \
--request "${METHOD}" \
--header "Content-Type: application/yang-data+json" \
--header "Accept: application/yang-data+json" \
"$@" \
"${URL}")

check "$RESP" "$URL"
```

Make it executable:
Expand Down
19 changes: 16 additions & 3 deletions package/feature-wifi/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,25 @@ config BR2_PACKAGE_FEATURE_WIFI
help
Enables WiFi in Infix. Enables all requried applications.

config BR2_PACKAGE_FEATURE_WIFI_DONGLE_REALTEK
bool "Realtek USB WiFi Dongles"
config BR2_PACKAGE_FEATURE_WIFI_MEDIATEK
bool "Mediatek WiFi Devices"
depends on BR2_PACKAGE_FEATURE_WIFI
select BR2_PACKAGE_LINUX_FIRMWARE
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7610E
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT76X2E
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7921
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7922
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7925
help
Enables support for various Mediatek WiFi devices.

config BR2_PACKAGE_FEATURE_WIFI_REALTEK
bool "Realtek WiFi Devices"
depends on BR2_PACKAGE_FEATURE_WIFI
select BR2_PACKAGE_LINUX_FIRMWARE
select BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX
select BR2_PACKAGE_LINUX_FIRMWARE_RTL_RTW88
select BR2_PACKAGE_LINUX_FIRMWARE_RTL_RTW89
help
Enables Support for RTW88 and RTW89 USB dongles.
Enables support for RTL81xx, RTW88, and RTW89 WiFi devices.
20 changes: 18 additions & 2 deletions package/feature-wifi/feature-wifi.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,24 @@ define FEATURE_WIFI_LINUX_CONFIG_FIXUPS
$(call KCONFIG_SET_OPT,CONFIG_MAC80211,m)
$(call KCONFIG_SET_OPT,CONFIG_CFG80211,m)

$(if $(filter y,$(BR2_PACKAGE_FEATURE_WIFI_DONGLE_REALTEK)),
$(if $(filter y,$(BR2_PACKAGE_FEATURE_WIFI_MEDIATEK)),
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7601U)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT76x0U)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT76x0E)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT76x2E)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT76x2U)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7603E)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7615E)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7663U)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7915E)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT798X_WMAC)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7921E)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7921U)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7996E)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7925E)
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7925U)
)
$(if $(filter y,$(BR2_PACKAGE_FEATURE_WIFI_REALTEK)),
$(call KCONFIG_ENABLE_OPT,CONFIG_WLAN_VENDOR_REALTEK)
$(call KCONFIG_ENABLE_OPT,CONFIG_RTL8XXXU)
$(call KCONFIG_ENABLE_OPT,CONFIG_RTL8XXXU_UNTESTED)
Expand Down Expand Up @@ -47,5 +64,4 @@ define FEATURE_WIFI_LINUX_CONFIG_FIXUPS
)
endef


$(eval $(generic-package))
5 changes: 4 additions & 1 deletion src/confd/src/dhcp-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ static void infer_options_v4(sr_session_ctx_t *session, const char *xpath)
"broadcast",
"router",
"domain",
"hostname", /* server may use this to register our current name */
"dns-server",
"ntp-server" /* will not be activated unless ietf-system also is */
};
Expand All @@ -203,6 +202,10 @@ static void infer_options_v4(sr_session_ctx_t *session, const char *xpath)
for (i = 0; i < NELEMS(opt); i++)
srx_set_item(session, NULL, 0, "%s/option[id='%s']", xpath, opt[i]);

/* server may use this to register our current name */
val.data.string_val = "auto";
srx_set_item(session, &val, 0, "%s/option[id='hostname']/value", xpath);

product_name = json_object_get(confd.root, "product-name");
if (product_name) {
val.data.string_val = (char *)json_string_value(product_name);
Expand Down
Loading