mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-31 08:38:49 +08:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af41f9d6d1 | ||
|
|
ff7ec89ede | ||
|
|
b66ee7f63d | ||
|
|
5fa44e8d7d | ||
|
|
bf90a6cd94 | ||
|
|
25bba31fba | ||
|
|
75fb63a021 | ||
|
|
e9f811f1ad | ||
|
|
abc771fa3e | ||
|
|
ccbd61c01e | ||
|
|
aae3025278 | ||
|
|
413817fc9d | ||
|
|
f565ac8144 | ||
|
|
8273a96de8 | ||
|
|
2c4376abee | ||
|
|
c7928d3a6d | ||
|
|
07ab330524 | ||
|
|
0fcc3f8612 | ||
|
|
01c1b0d832 | ||
|
|
75ebeb9012 | ||
|
|
c22ff2c6bc | ||
|
|
4ab2f04b73 | ||
|
|
9477208611 | ||
|
|
98cbdf50fc | ||
|
|
210cf3cab6 | ||
|
|
e4be368914 | ||
|
|
d9c30a8e87 | ||
|
|
d2f5a51510 | ||
|
|
8944abb486 | ||
|
|
d5e6639aa2 | ||
|
|
3b84a3c547 | ||
|
|
a0a88c5265 |
@@ -13,7 +13,8 @@ function genconfig {
|
||||
target_script="./scripts/gen_config.py"
|
||||
|
||||
# First convert all to lowercase
|
||||
args=$(to_lowercase "$@")
|
||||
#args=$(to_lowercase "$@")
|
||||
args="$@"
|
||||
|
||||
# Check if an option is provided
|
||||
if [[ ${args[0]} == -* ]]; then
|
||||
@@ -24,6 +25,10 @@ function genconfig {
|
||||
fi
|
||||
|
||||
${target_script} ${args[@]}
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Testing ./feeds/customerprofiles"
|
||||
PROFILES="./feeds/customerprofiles,profiles" ${target_script} ${args[@]}
|
||||
fi
|
||||
}
|
||||
|
||||
register_command "genconfig" "Generate configuration for board and customer"
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From be00aa9bd064d1defd94e78835249d0ca04c0440 Mon Sep 17 00:00:00 2001
|
||||
From: Markus Gothe <markus.gothe@genexis.eu>
|
||||
Date: Sun, 21 Apr 2024 15:30:18 +0200
|
||||
Subject: [PATCH] econet: Handle unbound HSGMII LAN interfaces.
|
||||
|
||||
---
|
||||
econet/ecnt_prvt.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/econet/ecnt_prvt.c b/econet/ecnt_prvt.c
|
||||
index 12c537f..a37fb49 100644
|
||||
--- a/econet/ecnt_prvt.c
|
||||
+++ b/econet/ecnt_prvt.c
|
||||
@@ -212,6 +212,7 @@ int hsgmii_lan_prvt_get_port_statistics(char *ifname, struct eth_stats *stats, s
|
||||
if (!strncmp(driver_name, DRIVER_NAME, DRIVER_NAME_LEN)) {
|
||||
int i = 0, hsgmii_index = -1;
|
||||
const char *hsgmii_iftype;
|
||||
+ char cmdbuf[512] = {0};
|
||||
|
||||
for (; i < ARRAY_SIZE(hsgmii_lookup_tbl); i++) {
|
||||
int j = 0;
|
||||
@@ -235,6 +236,11 @@ int hsgmii_lan_prvt_get_port_statistics(char *ifname, struct eth_stats *stats, s
|
||||
memset(&tx_stats, 0, sizeof(ECNT_FEMGR_GDMA2_TX_STATISTICS));
|
||||
memset(&rx_stats, 0, sizeof(ECNT_FEMGR_GDMA2_RX_STATISTICS));
|
||||
|
||||
+ /* Handle unbound interface statistics */
|
||||
+ chrCmd(cmdbuf, sizeof(cmdbuf), "cat /proc/tc3162/%s_rebind | awk '{ print $3 }'", ifname);
|
||||
+ if (cmdbuf[0] != '\0' && strtoul(cmdbuf, NULL, 0) == 1)
|
||||
+ return 0;
|
||||
+
|
||||
if (!fe_lib_get_hsgmii_tx_statistics(&tx_stats, hsgmii_index)) {
|
||||
fill_stats_tx_from_gdma(stats, rstats, &tx_stats);
|
||||
}
|
||||
--
|
||||
2.43.2
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
From 6e7216e657dfb59e869e393ef58e6b4593c16fc7 Mon Sep 17 00:00:00 2001
|
||||
From: Markus Gothe <markus.gothe@genexis.eu>
|
||||
Date: Thu, 22 Aug 2024 22:00:25 +0200
|
||||
Subject: [PATCH] libethernet: Improve counter logic for Airoha.
|
||||
|
||||
Improve the counter logic to support 64-bit counters
|
||||
for internal switch and different MACs for 'ae_wan'.
|
||||
|
||||
Also add support for represeting TX/RX bytes and errors.
|
||||
Fix calculation of unicast packets.
|
||||
---
|
||||
econet/ecnt_prvt.c | 76 +++++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 51 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/econet/ecnt_prvt.c b/econet/ecnt_prvt.c
|
||||
index a37fb49..2c42a03 100644
|
||||
--- a/econet/ecnt_prvt.c
|
||||
+++ b/econet/ecnt_prvt.c
|
||||
@@ -143,10 +143,10 @@ static void fill_stats_tx_from_gdma(struct eth_stats *stats, struct eth_rmon_sta
|
||||
return;
|
||||
|
||||
if (stats != NULL) {
|
||||
- stats->tx_bytes = 0;
|
||||
+ stats->tx_bytes = tx_stats->frame_len;
|
||||
stats->tx_packets = tx_stats->frame_cnt;
|
||||
stats->tx_errors = 0;
|
||||
- stats->tx_ucast_packets = 0;
|
||||
+ stats->tx_ucast_packets = tx_stats->frame_cnt - (tx_stats->broadcast + tx_stats->multicast);
|
||||
stats->tx_mcast_packets = tx_stats->broadcast;
|
||||
stats->tx_bcast_packets = tx_stats->multicast;
|
||||
stats->tx_discard_packets = tx_stats->drop_cnt;
|
||||
@@ -154,7 +154,7 @@ static void fill_stats_tx_from_gdma(struct eth_stats *stats, struct eth_rmon_sta
|
||||
|
||||
if (rstats != NULL) {
|
||||
rstats->tx.packets = tx_stats->frame_cnt;
|
||||
- rstats->tx.bytes = 0;
|
||||
+ rstats->tx.bytes = tx_stats->frame_len;
|
||||
rstats->tx.bcast_packets = tx_stats->broadcast;
|
||||
rstats->tx.mcast_packets = tx_stats->multicast;
|
||||
rstats->tx.crc_err_packets = 0;
|
||||
@@ -175,10 +175,10 @@ static void fill_stats_rx_from_gdma(struct eth_stats *stats, struct eth_rmon_sta
|
||||
return;
|
||||
|
||||
if (stats != NULL) {
|
||||
- stats->rx_bytes = 0;
|
||||
+ stats->rx_bytes = rx_stats->frame_len;
|
||||
stats->rx_packets = rx_stats->frame_cnt;
|
||||
- stats->rx_errors = 0;
|
||||
- stats->rx_ucast_packets = 0;
|
||||
+ stats->rx_errors = rx_stats->crc + rx_stats->jabber + rx_stats->fragment + rx_stats->undersize + rx_stats->oversize;
|
||||
+ stats->rx_ucast_packets = rx_stats->frame_cnt - (rx_stats->broadcast + rx_stats->multicast);
|
||||
stats->rx_mcast_packets = rx_stats->broadcast;
|
||||
stats->rx_bcast_packets = rx_stats->multicast;
|
||||
stats->rx_discard_packets = rx_stats->drop_cnt;
|
||||
@@ -187,12 +187,12 @@ static void fill_stats_rx_from_gdma(struct eth_stats *stats, struct eth_rmon_sta
|
||||
|
||||
if (rstats != NULL) {
|
||||
rstats->rx.packets = rx_stats->frame_cnt;
|
||||
- rstats->rx.bytes = 0;
|
||||
+ rstats->rx.bytes = rx_stats->frame_len;
|
||||
rstats->rx.bcast_packets = rx_stats->broadcast;
|
||||
rstats->rx.mcast_packets = rx_stats->multicast;
|
||||
- rstats->rx.crc_err_packets = 0;
|
||||
- rstats->rx.under_sz_packets = 0;
|
||||
- rstats->rx.over_sz_packets = 0;
|
||||
+ rstats->rx.crc_err_packets = rx_stats->crc;
|
||||
+ rstats->rx.under_sz_packets = rx_stats->undersize;
|
||||
+ rstats->rx.over_sz_packets = rx_stats->oversize;
|
||||
rstats->rx.packets_64bytes = rx_stats->eq_64;
|
||||
rstats->rx.packets_65to127bytes = rx_stats->from_65_to_127;
|
||||
rstats->rx.packets_256to511bytes = rx_stats->from_256_to_511;
|
||||
@@ -259,23 +259,50 @@ int hsgmii_lan_prvt_get_port_statistics(char *ifname, struct eth_stats *stats, s
|
||||
}
|
||||
|
||||
int ae_wan_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_stats *rstats) {
|
||||
+ char cmdbuf[512] = {0};
|
||||
ECNT_FEMGR_GDMA2_TX_STATISTICS tx_stats;
|
||||
ECNT_FEMGR_GDMA2_RX_STATISTICS rx_stats;
|
||||
|
||||
memset(&tx_stats, 0, sizeof(ECNT_FEMGR_GDMA2_TX_STATISTICS));
|
||||
memset(&rx_stats, 0, sizeof(ECNT_FEMGR_GDMA2_RX_STATISTICS));
|
||||
|
||||
- if (!fe_lib_get_gdma2_tx_statistics(&tx_stats)) {
|
||||
- fill_stats_tx_from_gdma(stats, rstats, &tx_stats);
|
||||
- }
|
||||
+ chrCmd(cmdbuf, sizeof(cmdbuf), "cat /proc/tc3162/ae_wan_switch_hsgmii_lan");
|
||||
+ if (cmdbuf[0] != '\0' && strcmp(cmdbuf, "pon") != 0) {
|
||||
+ int i = 0, hsgmii_index = -1;
|
||||
+ for (; i < ARRAY_SIZE(hsgmii_lookup_tbl); i++) {
|
||||
+ if (!strcmp(cmdbuf, hsgmii_lookup_tbl[i].iftype)) {
|
||||
+ hsgmii_index = hsgmii_lookup_tbl[i].idx;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (!fe_lib_get_gdma2_rx_statistics(&rx_stats)) {
|
||||
- fill_stats_rx_from_gdma(stats, rstats, &rx_stats);
|
||||
- }
|
||||
+ if (hsgmii_index == -1)
|
||||
+ return -1;
|
||||
|
||||
- if (rstats != NULL) {
|
||||
- get_pause_stats_from_proc("", "ae_wan", &rstats->rx.pause_packets,
|
||||
- &rstats->tx.pause_packets);
|
||||
+ if (!fe_lib_get_hsgmii_tx_statistics(&tx_stats, hsgmii_index)) {
|
||||
+ fill_stats_tx_from_gdma(stats, rstats, &tx_stats);
|
||||
+ }
|
||||
+ if (!fe_lib_get_hsgmii_rx_statistics(&rx_stats, hsgmii_index)) {
|
||||
+ fill_stats_rx_from_gdma(stats, rstats, &rx_stats);
|
||||
+ }
|
||||
+
|
||||
+ if (rstats != NULL) {
|
||||
+ get_pause_stats_from_proc("hsgmii_", cmdbuf, &rstats->rx.pause_packets,
|
||||
+ &rstats->tx.pause_packets);
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (!fe_lib_get_gdma2_tx_statistics(&tx_stats)) {
|
||||
+ fill_stats_tx_from_gdma(stats, rstats, &tx_stats);
|
||||
+ }
|
||||
+
|
||||
+ if (!fe_lib_get_gdma2_rx_statistics(&rx_stats)) {
|
||||
+ fill_stats_rx_from_gdma(stats, rstats, &rx_stats);
|
||||
+ }
|
||||
+
|
||||
+ if (rstats != NULL) {
|
||||
+ get_pause_stats_from_proc("", "ae_wan", &rstats->rx.pause_packets,
|
||||
+ &rstats->tx.pause_packets);
|
||||
+ }
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -305,14 +332,12 @@ int ecnt_prvt_get_port_statistics(uint32_t port,
|
||||
}
|
||||
|
||||
if (stats != NULL) {
|
||||
- stats->tx_bytes =
|
||||
- portcnt.TxBytesCnt_Lo;
|
||||
- stats->rx_bytes =
|
||||
- portcnt.RxBytesCnt_Lo;
|
||||
+ stats->tx_bytes = (((uint64_t)portcnt.TxBytesCnt_Hi) << 32) + portcnt.TxBytesCnt_Lo;
|
||||
+ stats->rx_bytes = (((uint64_t)portcnt.RxBytesCnt_Hi) << 32) + portcnt.RxBytesCnt_Lo;
|
||||
stats->tx_packets = portcnt.TxPktsCnt;
|
||||
stats->rx_packets = portcnt.RxPktsCnt;
|
||||
stats->tx_errors = 0;
|
||||
- stats->rx_errors = 0;
|
||||
+ stats->rx_errors = portcnt.RxAlignmentErrorCnt + portcnt.RxCRCFramesCnt + portcnt.RxUnderSizePktsCnt + portcnt.RxFragmentErrorCnt + portcnt.RxOverSizePktsCnt;
|
||||
stats->tx_ucast_packets = portcnt.TxUniPktsCnt;
|
||||
stats->rx_ucast_packets = portcnt.RxUniPktsCnt;
|
||||
stats->tx_mcast_packets = portcnt.TxMultiPktsCnt;
|
||||
@@ -330,7 +355,8 @@ int ecnt_prvt_get_port_statistics(uint32_t port,
|
||||
rstats->__rmon_field.drop_events = \
|
||||
portcnt.__ecnt_prefix ## DropFramesCnt; \
|
||||
rstats->__rmon_field.bytes = \
|
||||
- portcnt.__ecnt_prefix ## BytesCnt_Lo; \
|
||||
+ (((uint64_t)portcnt.__ecnt_prefix ## BytesCnt_Hi) << 32) \
|
||||
+ + portcnt.__ecnt_prefix ## BytesCnt_Lo; \
|
||||
rstats->__rmon_field.packets = portcnt.__ecnt_prefix ## PktsCnt;\
|
||||
rstats->__rmon_field.bcast_packets = \
|
||||
portcnt.__ecnt_prefix ## BroadPktsCnt; \
|
||||
--
|
||||
2.46.0
|
||||
|
||||
@@ -128,14 +128,14 @@ configure_mcpd_snooping() {
|
||||
config_snooping_common_params $protocol $igmp_s_version $igmp_s_robustness $igmp_s_mode
|
||||
config_mcast_querier_params $protocol $igmp_s_query_interval $igmp_s_q_resp_interval $igmp_s_last_mem_q_int
|
||||
config_snooping_upstream_interface "$igmp_s_iface"
|
||||
config_snooping_on_bridge $protocol $igmp_s_iface $igmp_s_mode
|
||||
config_snooping_on_bridge $protocol "$igmp_s_iface" $igmp_s_mode
|
||||
exceptions=$igmp_s_exceptions
|
||||
fast_leave=$igmp_s_fast_leave
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
config_snooping_common_params $protocol $mld_s_version $mld_s_robustness $mld_s_mode
|
||||
config_mcast_querier_params $protocol $mld_s_query_interval $mld_s_q_resp_interval $mld_s_last_mem_q_int
|
||||
config_snooping_upstream_interface "$mld_s_iface"
|
||||
config_snooping_on_bridge $protocol $mld_s_iface $mld_s_mode
|
||||
config_snooping_on_bridge $protocol "$mld_s_iface" $mld_s_mode
|
||||
exceptions=$mld_s_exceptions
|
||||
fast_leave=$mld_s_fast_leave
|
||||
fi
|
||||
@@ -171,14 +171,14 @@ configure_mcpd_proxy() {
|
||||
config_snooping_common_params $protocol $igmp_p_version $igmp_p_robustness $igmp_p_mode
|
||||
config_mcast_querier_params $protocol $igmp_query_interval $igmp_q_resp_interval $igmp_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol "$igmp_p_up_interfaces"
|
||||
config_snooping_on_bridge $protocol $igmp_p_down_interfaces $igmp_p_mode
|
||||
config_snooping_on_bridge $protocol "$igmp_p_down_interfaces" $igmp_p_mode
|
||||
fast_leave=$igmp_fast_leave
|
||||
exceptions=$igmp_p_exceptions
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
config_snooping_common_params $protocol $mld_p_version $mld_p_robustness $mld_p_mode
|
||||
config_mcast_querier_params $protocol $mld_query_interval $mld_q_resp_interval $mld_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol "$mld_p_up_interfaces"
|
||||
config_snooping_on_bridge $protocol $mld_p_down_interfaces $mld_p_mode
|
||||
config_snooping_on_bridge $protocol "$mld_p_down_interfaces" $mld_p_mode
|
||||
fast_leave=$mld_fast_leave
|
||||
exceptions=$mld_p_exceptions
|
||||
fi
|
||||
@@ -236,7 +236,7 @@ configure_mcpd() {
|
||||
|
||||
setup_mcast_mode() {
|
||||
# set the mode at chip to allow both tagged and untagged multicast forwarding
|
||||
bs /b/c iptv lookup_method=group_ip_src_ip
|
||||
bs /b/c iptv lookup_method=group_ip_src_ip_vid
|
||||
}
|
||||
|
||||
configure_mcast() {
|
||||
|
||||
@@ -64,23 +64,11 @@ read_mcast_stats() {
|
||||
|
||||
json_init
|
||||
json_add_array "snooping"
|
||||
json_add_object ""
|
||||
IFS=" "
|
||||
for intf in $ifaces; do
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
json_add_object ""
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
IFS=" "
|
||||
for gip_addr in $mcast_addrs; do
|
||||
grp_obj_added=0
|
||||
@@ -116,12 +104,14 @@ read_mcast_stats() {
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
if [ $grp_obj_added -eq 1 ]; then
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
fi
|
||||
done # close the loop for group addresses
|
||||
json_close_array #close the groups array
|
||||
json_close_object # close the snooping object
|
||||
done # close the loop for interfaces
|
||||
json_close_object # close the snooping object
|
||||
json_close_array # close the snooping array
|
||||
json_dump
|
||||
|
||||
|
||||
24
mcastmngr/files/common/etc/hotplug.d/ethernet/mcast.hotplug
Executable file
24
mcastmngr/files/common/etc/hotplug.d/ethernet/mcast.hotplug
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$LINK" = "up" -a -n "$PORT" ] || exit 0
|
||||
|
||||
compare_mcast_snooping_interface() {
|
||||
local interface dev running
|
||||
|
||||
config_get interface "$1" interface
|
||||
|
||||
for dev in $interface; do
|
||||
if [ "$PORT" = "$dev" ]; then
|
||||
running=$(ubus call service list '{"name": "mcast"}' | jsonfilter -e '@.mcast.instances')
|
||||
if [ -z "${running}" ]; then
|
||||
/etc/init.d/mcast start
|
||||
else
|
||||
ubus call uci commit '{"config":"mcast"}'
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
config_load mcast
|
||||
config_foreach compare_mcast_snooping_interface "snooping"
|
||||
20
mcastmngr/files/common/etc/hotplug.d/iface/mcast.hotplug
Normal file → Executable file
20
mcastmngr/files/common/etc/hotplug.d/iface/mcast.hotplug
Normal file → Executable file
@@ -1,27 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
[ "$ACTION" = "ifup" -a -n "$INTERFACE" ] || exit 0
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
network_get_device l3device $INTERFACE
|
||||
network_get_device l3device "$INTERFACE"
|
||||
|
||||
[ -n "$l3device" ] || exit 0
|
||||
|
||||
compare_mcast_proxy_upstream() {
|
||||
local upstream
|
||||
local mode="$2"
|
||||
local upstream dev running
|
||||
|
||||
if [ "$mode" == "proxy" ]; then
|
||||
config_get upstream $1 upstream_interface
|
||||
else
|
||||
config_get upstream $1 interface
|
||||
fi
|
||||
config_get upstream "$1" upstream_interface
|
||||
|
||||
for dev in $upstream; do
|
||||
if [ "$l3device" == "$dev" ]; then
|
||||
if [ "$l3device" = "$dev" ]; then
|
||||
running=$(ubus call service list '{"name": "mcast"}' | jsonfilter -e '@.mcast.instances')
|
||||
if [ -z "${running}" ];then
|
||||
if [ -z "${running}" ]; then
|
||||
/etc/init.d/mcast start
|
||||
else
|
||||
ubus call uci commit '{"config":"mcast"}'
|
||||
@@ -32,5 +27,4 @@ compare_mcast_proxy_upstream() {
|
||||
}
|
||||
|
||||
config_load mcast
|
||||
config_foreach compare_mcast_proxy_upstream "proxy" "proxy"
|
||||
config_foreach compare_mcast_proxy_upstream "snooping" "snooping"
|
||||
config_foreach compare_mcast_proxy_upstream "proxy"
|
||||
|
||||
@@ -395,13 +395,15 @@ config_mcproxy() {
|
||||
disable_snooping
|
||||
if [ "$igmp_p_enable" == "1" ]; then
|
||||
config_mcproxy_instance igmp "$igmp_p_version"
|
||||
elif [ "$igmp_s_enable" == "1" ]; then
|
||||
fi
|
||||
if [ "$igmp_s_enable" == "1" ]; then
|
||||
config_snooping igmp "$igmp_s_version"
|
||||
fi
|
||||
|
||||
if [ "$mld_p_enable" == "1" ]; then
|
||||
config_mcproxy_instance mld "$mld_p_version"
|
||||
elif [ "$mld_s_enable" == "1" ]; then
|
||||
fi
|
||||
if [ "$mld_s_enable" == "1" ]; then
|
||||
config_snooping mld "$mld_s_version"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -85,23 +85,11 @@ read_mcast_stats() {
|
||||
|
||||
json_init
|
||||
json_add_array "snooping"
|
||||
json_add_object ""
|
||||
IFS=" "
|
||||
for intf in $ifaces; do
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < "$temp_igmp_file"
|
||||
json_add_object ""
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
IFS=" "
|
||||
for gip_addr in $mcast_addrs; do
|
||||
grp_obj_added=0
|
||||
@@ -137,12 +125,14 @@ read_mcast_stats() {
|
||||
;;
|
||||
esac
|
||||
done < "$temp_igmp_file"
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
if [ $grp_obj_added -eq 1 ]; then
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
fi
|
||||
done # close the loop for group addresses
|
||||
json_close_array #close the groups array
|
||||
json_close_object # close the snooping object
|
||||
done # close the loop for interfaces
|
||||
json_close_object # close the snooping object
|
||||
json_close_array # close the snooping array
|
||||
json_dump
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
diff --git a/bbf_plugin/x_iopsys_eu_igmp.c b/bbf_plugin/x_iopsys_eu_igmp.c
|
||||
index 576099c..a6b0e5e 100644
|
||||
--- a/bbf_plugin/x_iopsys_eu_igmp.c
|
||||
+++ b/bbf_plugin/x_iopsys_eu_igmp.c
|
||||
@@ -60,7 +60,7 @@ static void sync_mcast_dmmap_iface_sec(struct uci_list *proxy_iface, char *s_mod
|
||||
struct uci_section *d_sec;
|
||||
int found = 0;
|
||||
char key[1024] = "";
|
||||
- char *s_name;
|
||||
+ char *s_name, *intf_dir, *intf_smode;
|
||||
|
||||
uci_foreach_element(proxy_iface, e) {
|
||||
char *p_ifname = dmstrdup(e->name);
|
||||
@@ -75,7 +75,12 @@ static void sync_mcast_dmmap_iface_sec(struct uci_list *proxy_iface, char *s_mod
|
||||
// file corresponding to this interface
|
||||
uci_path_foreach_option_eq(bbfdm, dmmap_package, dmmap_sec, "ifname", key, d_sec) {
|
||||
dmuci_get_value_by_section_string(d_sec, "section_name", &s_name);
|
||||
- if (strcmp(s_name, section_name(s)) == 0) {
|
||||
+ dmuci_get_value_by_section_string(d_sec, "upstream", &intf_dir);
|
||||
+ dmuci_get_value_by_section_string(d_sec, "snooping_mode", &intf_smode);
|
||||
+
|
||||
+ if (strcmp(s_name, section_name(s)) == 0 &&
|
||||
+ strcmp(intf_dir, up_iface) == 0 &&
|
||||
+ strcmp(intf_smode, s_mode) == 0) {
|
||||
add_dmmap_config_dup_list(dup_list, s, d_sec);
|
||||
found = 1;
|
||||
break;
|
||||
@@ -1640,12 +1645,6 @@ static void sync_proxy_interface_sections(struct uci_section *s, char *section,
|
||||
val = dmstrdup(e->name);
|
||||
if (DM_STRCMP(val, pch) == 0) {
|
||||
found = 1;
|
||||
- if (!up_iface) {
|
||||
- // if entry is found and upstream was set to
|
||||
- // false, then, remove this entry
|
||||
- dmuci_del_list_value_by_section(s, section, val);
|
||||
- }
|
||||
-
|
||||
// Further action is not required
|
||||
break;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
"dmcaching_exclude": [
|
||||
"Device.Hosts.Host.",
|
||||
"Device.IEEE1905.",
|
||||
"Device.WiFi.DataElements."
|
||||
"Device.WiFi.DataElements.",
|
||||
"Device.NAT.InterfaceSetting."
|
||||
]
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ index 5e367b7..db154a5 100644
|
||||
char *DEVICE_CONTROLLER_GetControllerTopic(int mqtt_instance);
|
||||
|
||||
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
||||
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_reply_to_t *mrt);
|
||||
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_conn_t *mpc);
|
||||
+#endif
|
||||
+
|
||||
#ifndef REMOVE_USP_BROKER
|
||||
@@ -30,12 +30,12 @@ index 97ca11d..19c91f1 100644
|
||||
+** This function is used by ValidateUspRecord() to determine whether to process a received USP message
|
||||
+**
|
||||
+** \param endpoint_id - Endpoint ID of controller that sent a USP message
|
||||
+** \param mrt - pointer to structure specifying on which MTP the message was received
|
||||
+** \param mpc - pointer to structure specifying on which MTP the message was received
|
||||
+**
|
||||
+** \return true if the MTP is allowed, false otherwise
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_reply_to_t *mrt)
|
||||
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_conn_t *mpc)
|
||||
+{
|
||||
+ controller_t *cont = FindEnabledControllerByEndpointId(endpoint_id);
|
||||
+ controller_mtp_t *mtp;
|
||||
@@ -46,18 +46,18 @@ index 97ca11d..19c91f1 100644
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ mtp = FindFirstEnabledMtp(cont, mrt->protocol);
|
||||
+ mtp = FindFirstEnabledMtp(cont, mpc->protocol);
|
||||
+
|
||||
+#ifdef ENABLE_WEBSOCKETS
|
||||
+ // Allow websocket server if no other MTP is configured
|
||||
+ if ((mrt->protocol == kMtpProtocol_WebSockets) && (mrt->wsserv_conn_id != INVALID))
|
||||
+ if ((mpc->protocol == kMtpProtocol_WebSockets) && (mpc->ws.serv_conn_id != INVALID))
|
||||
+ {
|
||||
+ return mtp == NULL;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ // Disallow if there is no MTP configured with matching protocol
|
||||
+ if ((mtp == NULL) || (mtp->protocol != mrt->protocol))
|
||||
+ if ((mtp == NULL) || (mtp->protocol != mpc->protocol))
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -67,7 +67,7 @@ index 97ca11d..19c91f1 100644
|
||||
+ {
|
||||
+#ifndef DISABLE_STOMP
|
||||
+ case kMtpProtocol_STOMP:
|
||||
+ return mtp->stomp_connection_instance == mrt->stomp_instance;
|
||||
+ return mtp->stomp_connection_instance == mpc->stomp.instance;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef ENABLE_COAP
|
||||
@@ -77,12 +77,12 @@ index 97ca11d..19c91f1 100644
|
||||
+
|
||||
+#ifdef ENABLE_MQTT
|
||||
+ case kMtpProtocol_MQTT:
|
||||
+ return mtp->mqtt_connection_instance == mrt->mqtt_instance;
|
||||
+ return mtp->mqtt_connection_instance == mpc->mqtt.instance;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef ENABLE_WEBSOCKETS
|
||||
+ case kMtpProtocol_WebSockets:
|
||||
+ return (mrt->wsclient_cont_instance == cont->instance) && (mrt->wsclient_mtp_instance == mtp->instance);
|
||||
+ return (mpc->ws.client_cont_instance == cont->instance) && (mpc->ws.client_mtp_instance == mtp->instance);
|
||||
+#endif
|
||||
+ default:
|
||||
+ TERMINATE_BAD_CASE(mtp->protocol);
|
||||
@@ -106,7 +106,7 @@ index 2a04d39..0b3074b 100644
|
||||
|
||||
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
||||
+ // Exit if the controller is not allowed to use the MTP on which the message was received
|
||||
+ if (DEVICE_CONTROLLER_IsMTPAllowed(rec->from_id, mrt) == false)
|
||||
+ if (DEVICE_CONTROLLER_IsMTPAllowed(rec->from_id, mtpc) == false)
|
||||
+ {
|
||||
+ USP_ERR_SetMessage("%s: Ignoring message from endpoint_id=%s (unauthorized MTP)", __FUNCTION__, rec->from_id);
|
||||
+ return USP_ERR_PERMISSION_DENIED;
|
||||
|
||||
@@ -26,7 +26,17 @@ hw_intf_init() {
|
||||
|
||||
# Initialize the hardware setup library
|
||||
hw_init_all() {
|
||||
local tc=0
|
||||
|
||||
export TMP_HW_QUEUE_LIST=""
|
||||
echo clear > /proc/ifc_debug
|
||||
echo reinit > /proc/ifc_debug
|
||||
|
||||
for tc in $(seq 0 7); do
|
||||
rm -rf "/tmp/qos/dscp_values_${tc}_4"
|
||||
rm -rf "/tmp/qos/dscp_values_${tc}_6"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -150,6 +160,8 @@ hw_commit_all() {
|
||||
local shape_rate="$TMP_HW_SHAPE_RATE"
|
||||
local q_count="0"
|
||||
local mac_qos_flag=""
|
||||
local pbit=0
|
||||
local tc=0
|
||||
|
||||
# Reorder queues
|
||||
for q in ${sorted_list} ; do
|
||||
@@ -205,4 +217,33 @@ hw_commit_all() {
|
||||
else
|
||||
/userfs/bin/qosrule discpline Enable 0
|
||||
fi
|
||||
|
||||
if [ -x /userfs/bin/blapi_cmd ]; then
|
||||
echo 1 > /proc/ifc_send_to_ppe
|
||||
for tc in $(seq 0 7); do
|
||||
if [ -s "/tmp/qos/dscp_values_${tc}_4" ]; then
|
||||
sort -un "/tmp/qos/dscp_values_${tc}_4" | awk 'NR==1{first=$1;last=$1;next}
|
||||
$1 == last+1 {last=$1;next}
|
||||
{system("/userfs/bin/blapi_cmd traffic set_traffic_class DSCP " first*4 " " or(last*4, 0x3) " 1");first=$1;last=first}
|
||||
END{system("/userfs/bin/blapi_cmd traffic set_traffic_class DSCP " first*4 " " or(last*4, 0x3) " 1")}'
|
||||
fi
|
||||
if [ -s "/tmp/qos/dscp_values_${tc}_6" ]; then
|
||||
[ -s "/tmp/qos/dscp_values_${tc}_4" ] && sort -un "/tmp/qos/dscp_values_${tc}_6" | awk 'NR==1{first=$1;last=$1;next}
|
||||
$1 == last+1 {last=$1;next}
|
||||
{system("/userfs/bin/blapi_cmd traffic set_traffic_class DSCP " first*4 " " or(last*4, 0x3) " 0");first=$1;last=first}
|
||||
END{system("/userfs/bin/blapi_cmd traffic set_traffic_class DSCP " first*4 " " or(last*4, 0x3) " 0")}'
|
||||
sort -un "/tmp/qos/dscp_values_${tc}_6" | awk 'NR==1{first=$1;last=$1;next}
|
||||
$1 == last+1 {last=$1;next}
|
||||
{system("/userfs/bin/blapi_cmd traffic set_traffic_class DSCP " first*4 " " or(last*4, 0x3) " 1");first=$1;last=first}
|
||||
END{system("/userfs/bin/blapi_cmd traffic set_traffic_class DSCP " first*4 " " or(last*4, 0x3) " 1")}'
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -x /userfs/bin/ifc ]; then
|
||||
echo 1 > /proc/ifc_send_to_ppe
|
||||
for pbit in $(seq 0 7); do
|
||||
/userfs/bin/ifc add vip pbit $pbit
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ broute_ipv4_rule_options()
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
config_get traffic_class "$cid" "traffic_class"
|
||||
|
||||
set_ip_addr "$cid" ebt_match_src_ip ebt_match_dst_ip
|
||||
|
||||
@@ -36,6 +37,7 @@ broute_ipv4_rule_options()
|
||||
tos_val=$((dscp_filter<<2))
|
||||
tos_hex=$(printf "%x" $tos_val)
|
||||
broute_filter_on_dscp "$tos_hex"
|
||||
[ -n "$traffic_class" -a "$dscp_filter" != "0" ] && echo "$((dscp_filter))" >> "/tmp/qos/dscp_values_${traffic_class}_4"
|
||||
fi
|
||||
|
||||
if [ -n "$protocol" ]; then
|
||||
@@ -57,6 +59,7 @@ broute_ipv6_rule_options()
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
config_get traffic_class "$cid" "traffic_class"
|
||||
|
||||
set_ip_addr "$cid" ebt_match_ipv6_src_ip ebt_match_ipv6_dst_ip
|
||||
|
||||
@@ -67,6 +70,7 @@ broute_ipv6_rule_options()
|
||||
tos_val=$((dscp_filter<<2))
|
||||
tos_hex=$(printf "%x" $tos_val)
|
||||
ebt_match_ipv6_dscp "$tos_hex"
|
||||
[ -n "$traffic_class" -a "$dscp_filter" != "0" ] && echo "$((dscp_filter))" >> "/tmp/qos/dscp_values_${traffic_class}_6"
|
||||
fi
|
||||
|
||||
if [ -n "$protocol" ]; then
|
||||
|
||||
Reference in New Issue
Block a user