| diff --git a/configure.ac b/configure.ac |
| index c4aeb55..7eded47 100644 |
| --- a/configure.ac |
| +++ b/configure.ac |
| @@ -53,5 +53,6 @@ AC_CONFIG_FILES( |
| Makefile |
| ) |
| AM_CONDITIONAL([PLATFORM_RASPBERRYPI_ENABLED], [test $PLATFORM_RASPBERRYPI_ENABLED = yes]) |
| +AM_CONDITIONAL([PLATFORM_TURRIS_ENABLED], [test $PLATFORM_TURRIS_ENABLED = yes]) |
| AC_OUTPUT |
| |
| diff --git a/source/Makefile.am b/source/Makefile.am |
| index d7d99da..4cb1847 100644 |
| --- a/source/Makefile.am |
| +++ b/source/Makefile.am |
| @@ -23,9 +23,13 @@ AM_CFLAGS += -DCONFIG_PRIMARY_NET_BRIDGE_MODE |
| if PLATFORM_RASPBERRYPI_ENABLED |
| AM_LDFLAGS = -lsysevent |
| else |
| +if PLATFORM_TURRIS_ENABLED |
| +AM_LDFLAGS = -lsysevent |
| +else |
| AM_LDFLAGS = -lgwprovappabs |
| AM_LDFLAGS += -lsysevent |
| endif |
| +endif |
| AM_LDFLAGS += -lsyscfg |
| AM_LDFLAGS += -lulog |
| |
| @@ -38,5 +42,11 @@ gw_prov_utopia_SOURCES = gw_prov_sm.c |
| if PLATFORM_RASPBERRYPI_ENABLED |
| gw_prov_utopia_LDFLAGS = -lsysevent -lsyscfg -lulog |
| else |
| +if PLATFORM_TURRIS_ENABLED |
| +gw_prov_utopia_LDFLAGS = -lsysevent -lsyscfg -lulog |
| +else |
| gw_prov_utopia_LDFLAGS = -lgwprovappabs -lsysevent -lsyscfg -lulog |
| endif |
| +endif |
| +gw_prov_utopia_LDFLAGS += -pthread |
| +gw_prov_utopia_LDFLAGS += -pthread |
| diff --git a/source/gw_prov_sm.c b/source/gw_prov_sm.c |
| index 7117be3..a8c154f 100644 |
| --- a/source/gw_prov_sm.c |
| +++ b/source/gw_prov_sm.c |
| @@ -55,11 +55,11 @@ |
| #include <sys/socket.h> |
| #include <sys/stat.h> |
| #include <fcntl.h> |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| #include <sys/types.h> |
| #endif |
| #include <unistd.h> |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| #include <ruli.h> |
| #endif |
| #include <sysevent/sysevent.h> |
| @@ -68,7 +68,7 @@ |
| #include "gw_prov_abstraction.h" |
| #include "Tr69_Tlv.h" |
| #include <autoconf.h> |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| #include "docsis_esafe_db.h" |
| #endif |
| #include <time.h> |
| @@ -197,7 +197,7 @@ static token_t sysevent_token; |
| static int sysevent_fd_gs; |
| static token_t sysevent_token_gs; |
| static pthread_t sysevent_tid; |
| -#if defined(_PLATFORM_RASPBERRYPI_) |
| +#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| static pthread_t linkstate_tid; |
| #endif |
| static int phylink_wan_state = 0; |
| @@ -264,7 +264,7 @@ static int getSyseventBridgeMode(int erouterMode, int bridgeMode) { |
| } |
| |
| |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| /**************************************************************************/ |
| /*! \fn STATUS GW_TlvParserInit(void) |
| ************************************************************************** |
| @@ -736,7 +736,7 @@ static int GWP_SysCfgSetInt(const char *name, int int_value) |
| return syscfg_set(NULL, name, value); |
| } |
| |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| /**************************************************************************/ |
| /*! \fn static STATUS GWP_UpdateEsafeAdminMode() |
| ************************************************************************** |
| @@ -788,7 +788,7 @@ validate_mode(int* bridge_mode, int* eRouterMode) |
| GWPROV_PRINT(" %s : bridge_mode = %d , eRouterMode = %d \n", __FUNCTION__, *bridge_mode, *eRouterMode); |
| } |
| |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| void docsis_gotEnable_callback(Uint8 state) |
| { |
| GWPROV_PRINT(" Entry %s , state = %d \n", __FUNCTION__, state); |
| @@ -840,7 +840,7 @@ static void GWP_DocsisInited(void) |
| **************************************************************************/ |
| static void GWP_EnableERouter(void) |
| { |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| GWPROV_PRINT(" Entry %s \n", __FUNCTION__); |
| /* Update ESAFE state */ |
| GWP_UpdateEsafeAdminMode(eRouterMode); |
| @@ -903,7 +903,7 @@ static void GWP_EnterRouterMode(void) |
| **************************************************************************/ |
| static void GWP_DisableERouter(void) |
| { |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| GWPROV_PRINT(" Entry %s \n", __FUNCTION__); |
| /* Update ESAFE state */ |
| GWP_UpdateEsafeAdminMode(eRouterMode); |
| @@ -1049,7 +1049,7 @@ static void GWP_UpdateERouterMode(void) |
| } |
| else // remain enabled, switch mode |
| { |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| /* Update ESAFE state */ |
| GWP_UpdateEsafeAdminMode(eRouterMode); |
| #endif |
| @@ -1121,7 +1121,7 @@ static void GWP_ProcessUtopiaRestart(void) |
| // } |
| } |
| |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| /**************************************************************************/ |
| /*! \fn int GWP_ProcessIpv4Down(); |
| ************************************************************************** |
| @@ -1428,13 +1428,13 @@ static void *GWP_sysevent_threadfunc(void *data) |
| { |
| if (strcmp(val, "up")==0) |
| { |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| GWP_ProcessIpv4Up(); |
| #endif |
| } |
| else if (strcmp(val, "down")==0) |
| { |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| GWP_ProcessIpv4Down(); |
| #endif |
| } |
| @@ -1443,13 +1443,13 @@ static void *GWP_sysevent_threadfunc(void *data) |
| { |
| if (strcmp(val, "up")==0) |
| { |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| GWP_ProcessIpv6Up(); |
| #endif |
| } |
| else if (strcmp(val, "down")==0) |
| { |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| GWP_ProcessIpv6Down(); |
| #endif |
| } |
| @@ -1492,7 +1492,7 @@ static void *GWP_sysevent_threadfunc(void *data) |
| { |
| if (strcmp(val, "started") == 0) { |
| if (!webui_started) { |
| -#if defined(_PLATFORM_RASPBERRYPI_) |
| +#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| if(strcmp(name, "bridge-status") == 0) { |
| GWP_DisableERouter(); |
| } |
| @@ -1536,7 +1536,7 @@ static void *GWP_sysevent_threadfunc(void *data) |
| Uint8 v6addr[ NETUTILS_IPv6_GLOBAL_ADDR_LEN / sizeof(Uint8) ]; |
| Uint8 soladdr[ NETUTILS_IPv6_GLOBAL_ADDR_LEN / sizeof(Uint8) ]; |
| inet_pton(AF_INET6, val, v6addr); |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| getMultiCastGroupAddress(v6addr,soladdr); |
| #endif |
| inet_ntop(AF_INET6, soladdr, val, sizeof(val)); |
| @@ -1621,7 +1621,7 @@ static int GWP_act_DocsisLinkUp_callback() |
| printf("\n**************************\n\n"); |
| |
| |
| -#if defined(_PLATFORM_RASPBERRYPI_) |
| +#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| char *temp; |
| char command[128]; |
| char wanPhyName[20]; |
| @@ -1678,7 +1678,7 @@ static int GWP_act_DocsisLinkUp_callback() |
| } |
| |
| |
| -#if defined(_PLATFORM_RASPBERRYPI_) |
| +#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| /**************************************************************************/ |
| /*! \fn void *GWP_linkstate_threadfunc(void *) |
| ************************************************************************** |
| @@ -1796,7 +1796,7 @@ void GWP_Util_get_shell_output( char * cmd, char *out, int len ) |
| } |
| |
| /* GWP_UpdateTr069CfgThread() */ |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| void GWP_UpdateTr069CfgThread( void *data ) |
| { |
| int IsNeedtoProceedFurther = TRUE; |
| @@ -1911,7 +1911,7 @@ void GWP_UpdateTr069CfgThread( void *data ) |
| GWPROV_PRINT(" Exit %s \n", __FUNCTION__); |
| } |
| #endif |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| /**************************************************************************/ |
| /*! \fn int GWP_act_DocsisCfgfile(SME_APP_T *app, SME_EVENT_T *event); |
| ************************************************************************** |
| @@ -2144,7 +2144,7 @@ static int GWP_act_DocsisInited_callback() |
| { |
| esafeErouterOperModeExtIf_e operMode; |
| //DOCSIS_Esafe_Db_Enable_e eRouterModeTmp; |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| DOCSIS_Esafe_Db_extIf_e eRouterModeTmp; |
| #endif |
| char macstr[20]; |
| @@ -2154,7 +2154,7 @@ static int GWP_act_DocsisInited_callback() |
| char soladdrStr[64]; |
| int sysevent_bridge_mode = 0; |
| GWPROV_PRINT(" Entry %s \n", __FUNCTION__); |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| /* Docsis initialized */ |
| printf("Got DOCSIS Initialized\n"); |
| |
| @@ -2198,7 +2198,7 @@ static int GWP_act_DocsisInited_callback() |
| // } |
| #if !defined(INTEL_PUMA7) && !defined(_COSA_BCM_MIPS_) && !defined(_COSA_BCM_ARM_) |
| printf("Not Initializing bridge_mode and eRouterMode for XB3\n"); |
| -#elif defined(_PLATFORM_RASPBERRYPI_) |
| +#elif defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| printf("Not Initializing bridge_mode and eRouterMode for Raspberry Pi\n"); |
| #else |
| bridge_mode = GWP_SysCfgGetInt("bridge_mode"); |
| @@ -2212,12 +2212,12 @@ static int GWP_act_DocsisInited_callback() |
| system(sysevent_cmd); |
| #endif |
| |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| GWP_DocsisInited(); |
| #endif |
| |
| system("sysevent set docsis-initialized 1"); |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| |
| /* Must set the ESAFE Enable state before replying to the DocsisInit event */ |
| eRouterModeTmp = eRouterMode; |
| @@ -2279,7 +2279,7 @@ static int GWP_act_DocsisInited_callback() |
| } |
| |
| //calculate cm base solicited node address |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| getInterfaceLinkLocalAddress(IFNAME_WAN_0, lladdr); |
| |
| |
| @@ -2482,7 +2482,7 @@ static int GWP_act_DocsisInited_callback() |
| **************************************************************************/ |
| static int GWP_act_ProvEntry_callback() |
| { |
| -#if defined(_PLATFORM_RASPBERRYPI_) |
| +#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| int uid = 0; |
| uid = getuid(); |
| #endif |
| @@ -2491,7 +2491,7 @@ static int GWP_act_ProvEntry_callback() |
| #ifdef MULTILAN_FEATURE |
| macaddr_t macAddr; |
| #endif |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| GWPROV_PRINT(" Entry %s \n", __FUNCTION__); |
| //system("sysevent set lan-start"); |
| |
| @@ -2411,14 +2411,14 @@ static int GWP_act_ProvEntry_callback() |
| |
| /* Now that we have the ICC que (SME) and we are registered on the docsis INIT */ |
| /* event, we can notify PCD to continue */ |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| sendProcessReadySignal(); |
| #endif |
| |
| /* Initialize Switch */ |
| // VEN_SWT_InitSwitch(); |
| |
| -#if defined(_PLATFORM_RASPBERRYPI_) |
| +#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| printf("Thread to monitor link status \n"); |
| pthread_create(&linkstate_tid, NULL, GWP_linkstate_threadfunc, NULL); |
| #endif |
| @@ -2426,7 +2426,7 @@ static int GWP_act_ProvEntry_callback() |
| return 0; |
| } |
| |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| static int GWP_act_DocsisTftpOk_callback(){ |
| GWPROV_PRINT(" Entry %s \n", __FUNCTION__); |
| gDocTftpOk = 1; |
| @@ -2735,13 +2735,13 @@ int main(int argc, char *argv[]) |
| #ifdef MULTILAN_FEATURE |
| char sysevent_cmd[80]; |
| #endif |
| -#if defined(_PLATFORM_RASPBERRYPI_) |
| +#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| int uid = 0; |
| uid = getuid(); |
| #endif |
| printf("Started gw_prov_utopia\n"); |
| |
| -#if !defined(_PLATFORM_RASPBERRYPI_) |
| +#if !defined(_PLATFORM_RASPBERRYPI_) && !defined(_PLATFORM_TURRIS_) |
| |
| #ifdef FEATURE_SUPPORT_RDKLOG |
| setenv("LOG4C_RCPATH","/rdklogger",1); |
| diff --git a/source/include/gw_prov_abstraction.h b/source/include/gw_prov_abstraction.h |
| index e5a45e0..536191a 100644 |
| --- a/source/include/gw_prov_abstraction.h |
| +++ b/source/include/gw_prov_abstraction.h |
| @@ -62,7 +62,7 @@ |
| #define GW_SUBTLV_TR069_CONNREQ_PASSWORD_EXTIF 6 |
| #define GW_SUBTLV_TR069_ACS_OVERRIDE_EXTIF 7 |
| |
| -#if defined(_PLATFORM_RASPBERRYPI_) |
| +#if defined(_PLATFORM_RASPBERRYPI_) || defined(_PLATFORM_TURRIS_) |
| typedef enum |
| { |
| False = 0, |