Skip to content
Open
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
21 changes: 14 additions & 7 deletions source/scripts/init/service.d/lan_handler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ case "$1" in
fi
;;
ipv4_*-status)
echo_t "LAN HANDLER : Received $1 event with status $2"
if [ x"up" = x${2} ]; then
echo_t "LAN HANDLER : Handling LAN up event for instance ${1}"
INST=${1#*_}
INST=${INST%-*}
RG_MODE=`syscfg get last_erouter_mode`
Expand All @@ -172,7 +174,6 @@ case "$1" in
SYSCFG_last_erouter_mode=`syscfg get last_erouter_mode`
echo "lan_handler.sh last_erouter_mode: $SYSCFG_last_erouter_mode"


if [ "1" = "$SYSCFG_last_erouter_mode" ]; then
echo 0 > /proc/sys/net/ipv6/conf/$LAN_IFNAME/autoconf # Do not do SLAAC
else
Expand All @@ -184,12 +185,14 @@ case "$1" in


if [ xbrlan0 = x${LAN_IFNAME} ]; then
echo_t "LAN HANDLER : Handling LAN up event for brlan0, configuring IPv6 address if needed"
SYSEVT_lan_ipaddr_v6_prev=`sysevent get lan_ipaddr_v6_prev`

if [ "1" = "$(sysevent get ula_ipv6_enabled)" ] && [ "1" != "$(syscfg get Device_Mode)" ]; then
SYSEVT_lan_ipaddr_v6=$(sysevent get ipv6_prefix_ula | cut -d "/" -f 1)
SYSEVT_lan_ipaddr_v6=${SYSEVT_lan_ipaddr_v6}1
else
echo_t "LAN HANDLER : Using global IPv6 address for LAN"
SYSEVT_lan_ipaddr_v6=`sysevent get lan_ipaddr_v6`
fi
SYSEVT_lan_prefix_v6=`sysevent get lan_prefix_v6`
Expand All @@ -206,7 +209,7 @@ case "$1" in
sysevent set current_lan_ipaddr `sysevent get ipv4_${INST}-ipv4addr`

if [ "$RG_MODE" = "2" -a x"ready" != x`sysevent get start-misc` ]; then
echo_t "LAN HANDLER : Triggering DHCP server using LAN status based on RG_MODE:2"
echo_t "LAN HANDLER : Triggering DHCP server using LAN status based on RG_MODE:2"
sysevent set lan-status started
firewall
if [ ! -f "$POSTD_START_FILE" ];
Expand Down Expand Up @@ -253,8 +256,10 @@ case "$1" in
fi

elif [ x"ready" != x`sysevent get start-misc` ] && ( [ "$MANUFACTURE" = "Technicolor" ] || [ "$MANUFACTURE" = "Sercomm" ] ) ; then
echo_t "LAN HANDLER : box is from Technicolor or Sercomm, setting lan-status to started"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this comment to verify whether execution is reaching this point. This helps identify where the flow is breaking in cases where the LAN is not getting started.

#TCH XBx/TCCBR based startup post.d scripts which includes Firewall restart and dhcp start.
sysevent set lan-status started
echo_t "LAN HANDLER : lan status set to started"
firewall
if [ ! -f "$POSTD_START_FILE" ];
then
Expand All @@ -264,6 +269,7 @@ case "$1" in
else
echo_t "LAN HANDLER : Triggering DHCP server using LAN status"
sysevent set lan-status started
echo_t "LAN HANDLER : lan status set to started"
echo_t "LAN HANDLER : Triggering RDKB_FIREWALL_RESTART"
t2CountNotify "RF_INFO_RDKB_FIREWALL_RESTART"
sysevent set firewall-restart
Expand All @@ -282,11 +288,11 @@ case "$1" in
#disable dnsmasq when ipv6 only mode and DSlite is disabled
DSLITE_ENABLED=`sysevent get dslite_enabled`
DHCP_PROGRESS=`sysevent get dhcp_server-progress`
echo_t "LAN HANDLER : DHCP configuration status got is : $DHCP_PROGRESS"
echo_t "LAN HANDLER : DHCP configuration status got is : $DHCP_PROGRESS"
if [ "2" = "$SYSCFG_last_erouter_mode" ] && [ "x1" != x$DSLITE_ENABLED ]; then
sysevent set dhcp_server-stop
elif [ "0" != "$SYSCFG_last_erouter_mode" ] && [ "$DHCP_PROGRESS" != "inprogress" ] ; then
echo_t "LAN HANDLER : Triggering dhcp start based on last erouter mode"
echo_t "LAN HANDLER : Triggering dhcp start based on last erouter mode"
sysevent set dhcp_server-start
fi

Expand Down Expand Up @@ -314,6 +320,8 @@ case "$1" in
sysevent set firewall-restart
if [ -e "/usr/bin/print_uptime" ]; then
/usr/bin/print_uptime "Laninit_complete"
echo_t "LAN HANDLER : Laninit_complete uptime: $(cut -d. -f1 /proc/uptime)"
echo_t "LAN HANDLER : Checking lan-status after lan init complete, lan-status = $(sysevent get lan-status)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lan init complete will be after lan-status started , remove extra sysevent get

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this log because I observed two Laninit_complete uptime entries in the logs. In the boottime.log, the first occurrence was considered even though LAN was not started at that point, while only during the second occurrence the LAN actually gets started. This check was added to confirm the lan-status during both instances.

fi

uptime=$(cut -d. -f1 /proc/uptime)
Expand Down Expand Up @@ -344,7 +352,7 @@ case "$1" in
pnm-status | bring-lan)
if [ -e "/usr/bin/print_uptime" ]; then
/usr/bin/print_uptime "Lan_init_start"
fi
fi
uptime=$(cut -d. -f1 /proc/uptime)
if [ -e "/usr/bin/onboarding_log" ]; then
/usr/bin/onboarding_log "Lan_init_start:$uptime"
Expand All @@ -354,7 +362,6 @@ case "$1" in
if [ -z "$INST" ]
then
echo_t "THE INSTANT=$INST"
echo_t "THE INSTANT=$INST"
#(use a simpler test than this -- but Hacky, since it assumes everything we want is not XB3!!)if [ "$BOX_TYPE" = "TCCBR" ] || [ "$BOX_TYPE" = "XB6" -a "$MANUFACTURE" = "Technicolor" ] || [ "$BOX_TYPE" = "XB7" -a "$MANUFACTURE" = "Technicolor" ] ; then
if ( [ "$BOX_TYPE" != "XB3" ] && ( [ "$MANUFACTURE" = "Technicolor" ] || [ "$MANUFACTURE" = "Sercomm" ] ) ) || [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then
COUNTER=1
Expand All @@ -371,7 +378,7 @@ case "$1" in
echo_t "THE COUNTER =$COUNTER"
done
else
echo_t "RDKB_SYSTEM_BOOT_UP_LOG : INST rerurned null, retrying"
echo_t "RDKB_SYSTEM_BOOT_UP_LOG : INST returned null, retrying"
INST=`psmcli get dmsb.MultiLAN.PrimaryLAN_l3net`
fi

Expand Down
7 changes: 6 additions & 1 deletion source/service_routed/service_routed.c
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,7 @@ STATIC void checkIfModeIsSwitched(int sefd, token_t setok)
#endif
STATIC int radv_start(struct serv_routed *sr)
{
fprintf(logfptr, "%s: Entering function\n", __FUNCTION__);

#ifdef RDKB_EXTENDER_ENABLED
int deviceMode = GetDeviceNetworkMode();
Expand Down Expand Up @@ -2113,7 +2114,7 @@ STATIC int radv_start(struct serv_routed *sr)

char aBridgeMode[8];
syscfg_get(NULL, "bridge_mode", aBridgeMode, sizeof(aBridgeMode));

fprintf(logfptr, "%s: bridge_mode = %s and LAN = %d\n", __FUNCTION__, aBridgeMode, sr->lan_ready);
if ((!strcmp(aBridgeMode, "0")) && (!sr->lan_ready)) {
fprintf(logfptr, "%s: LAN is not ready !\n", __FUNCTION__);
return -1;
Expand Down Expand Up @@ -2177,6 +2178,7 @@ STATIC int radv_start(struct serv_routed *sr)
printf("DHCPv6 is %s. Starting zebra Process\n", (bEnabled?"Enabled":"Disabled"));
#else
v_secure_system("zebra -d -f %s -P 0 2> /tmp/.zedra_error", ZEBRA_CONF_FILE);
fprintf(logfptr, "%s: zebra process started\n", __FUNCTION__);
#endif

return 0;
Expand Down Expand Up @@ -2412,10 +2414,12 @@ STATIC int serv_routed_init(struct serv_routed *sr)
sysevent_get(sr->sefd, sr->setok, "wan-status", wan_st, sizeof(wan_st));
if (strcmp(wan_st, "started") == 0)
sr->wan_ready = true;
fprintf(logfptr, "%s: WAN status: %d\n", __FUNCTION__, sr->wan_ready);

sysevent_get(sr->sefd, sr->setok, "lan-status", lan_st, sizeof(lan_st));
if (strcmp(lan_st, "started") == 0)
sr->lan_ready = true;
fprintf(logfptr, "%s: LAN status: %d\n", __FUNCTION__, sr->lan_ready);

return 0;
}
Expand Down Expand Up @@ -2760,6 +2764,7 @@ int service_routed_main(int argc, char *argv[])
usage();
exit(1);
}
fprintf(logfptr, "%s: Entering %s\n", PROG_NAME, __FUNCTION__);
Comment thread
aj970-crypto marked this conversation as resolved.

Comment thread
aj970-crypto marked this conversation as resolved.
#if defined (_HUB4_PRODUCT_REQ_) || defined (RDKB_EXTENDER_ENABLED) || defined (FEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE) || defined(_RDKB_GLOBAL_PRODUCT_REQ_)
/* dbus init based on bus handle value */
Expand Down
Loading