Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebPA: recipe integration #614

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
69 changes: 69 additions & 0 deletions recipes-webpa/ccsp/ccsp-common-library.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
SUMMARY = "CCSP libccsp_common component"
HOMEPAGE = "http://github.com/belvedere-yocto/CcspCommonLibrary"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=19774cd4dd519f099bc404798ceeab19"

DEPENDS_append = " dbus openssl rbus rbus-core zlib"

require ccsp_common.inc

RECIPE_BRANCH ?= "rdk-next"
SRC_URI = "\
git://github.com/rdkcmf/rdkb-CcspCommonLibrary.git;protocol=https;branch=${RECIPE_BRANCH} \
file://0001-DBusLoop-SSL_state-TLS_ST_OK.patch \
file://0001-SSLeay_add_all_algorithms-remove-in-openssl-1.1.patch \
file://0003-support-to-build-for-non-rdk-platform.patch \
"

SRCREV = "6432e257aa30bdf766db16a0db83394801bc4708"
PV = "git${SRCPV}"

S = "${WORKDIR}/git"

inherit autotools systemd pkgconfig

SECURITY_STRINGFORMAT = ""

CFLAGS_append += " \
-DSAFEC_DUMMY_API \
-D_GNU_SOURCE -D__USE_XOPEN \
-I${STAGING_INCDIR}/dbus-1.0 \
-I${STAGING_LIBDIR}/dbus-1.0/include \
-I${STAGING_INCDIR}/rbus \
-I${STAGING_INCDIR}/rtmessage \
"

LDFLAGS_append = " -ldbus-1 -lrbus-core -lrtMessage -lrbus"

do_install_append_class-target () {
install -d ${D}/usr/include/ccsp
install -d ${D}/usr/include/ccsp/linux
install -m 644 ${S}/source/debug_api/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/util_api/ansc/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/util_api/asn.1/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/util_api/http/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/util_api/slap/components/SlapVarConverter/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/util_api/stun/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/util_api/tls/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/util_api/web/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/cosa/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/cosa/package/slap/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/cosa/package/system/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/cosa/include/linux/*.h ${D}/usr/include/ccsp/linux
install -m 644 ${S}/source/cosa/include/linux/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/ccsp/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/ccsp/custom/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/ccsp/components/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/ccsp/components/common/MessageBusHelper/include/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/ccsp/components/common/PoamIrepFolder/*.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/dm_pack/dm_pack_create_func.h ${D}/usr/include/ccsp
install -m 644 ${S}/source/dm_pack/dm_pack_xml_helper.h ${D}/usr/include/ccsp

# Config files
install -d ${D}/usr/ccsp
install -m 644 ${S}/config/ccsp_msg.cfg ${D}/usr/ccsp
}

FILES_${PN} += " /usr/ccsp ${libdir}"

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From d69f7dc3304bb5dd8803cef63a1a96e7c102e153 Mon Sep 17 00:00:00 2001
From: Jaga <[email protected]>
Date: Mon, 6 Apr 2020 17:29:42 +0000
Subject: [PATCH] DBusLoop-SSL_state-TLS_ST_OK

Reason for change: typedef DBusLoop struct, changed ssl->state
to SSL_state(ssl) for openssl > 1.1 and SSL_get_state(ssl) for openssl >
1.1.1

Source: COMCAST
License: Apache-2.0
Upstream-Status: Pending
Signed-off-by: Jaga <[email protected]>
---
source/ccsp/include/ccsp_message_bus.h | 2 ++
source/util_api/ansc/AnscPlatform/user_openssl.c | 10 +++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/source/ccsp/include/ccsp_message_bus.h b/source/ccsp/include/ccsp_message_bus.h
index 9fb9aae9..7c315be0 100644
--- a/source/ccsp/include/ccsp_message_bus.h
+++ b/source/ccsp/include/ccsp_message_bus.h
@@ -153,6 +153,8 @@ typedef struct _CCSP_MESSAGE_FILTER

} CCSP_MESSAGE_FILTER;

+typedef struct DBusLoop DBusLoop;
+
typedef struct _CCSP_MESSAGE_BUS_CONNECTION
{
DBusConnection *conn;
diff --git a/source/util_api/ansc/AnscPlatform/user_openssl.c b/source/util_api/ansc/AnscPlatform/user_openssl.c
index 7e5c2c7d..6d1f4f51 100644
--- a/source/util_api/ansc/AnscPlatform/user_openssl.c
+++ b/source/util_api/ansc/AnscPlatform/user_openssl.c
@@ -392,7 +392,15 @@ SSL * openssl_connect (int fd)

SSL_set_connect_state (ssl);

- if (SSL_connect (ssl) <= 0 || ssl->state != SSL_ST_OK)
+ if (SSL_connect (ssl) <= 0 ||
+#if (OPENSSL_VERSION_NUMBER >= 0x10101000L)
+ SSL_get_state(ssl) != TLS_ST_OK)
+#elif (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+ SSL_state(ssl) != TLS_ST_OK)
+#else
+ ssl->state != SSL_ST_OK)
+#endif
+
{
AnscTraceWarning(("openssl_connect - failed in SSL_set_connect_state \n"));
goto error;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From d1b13416095d4fe513ee739de179913222539993 Mon Sep 17 00:00:00 2001
From: Jaga <[email protected]>
Date: Mon, 6 Apr 2020 18:35:17 +0000
Subject: [PATCH] SSLeay_add_all_algorithms remove in openssl 1.1

Reason for change: Remove deprecated API SSLeay_add_all_algorithms for
openssl 1.1 and above

Source: COMCAST
License: Apache-2.0
Upstream-Status: Pending
Signed-off-by: Jaga <[email protected]>
---
source/util_api/ansc/AnscPlatform/user_openssl.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/source/util_api/ansc/AnscPlatform/user_openssl.c b/source/util_api/ansc/AnscPlatform/user_openssl.c
index 0d74871f..4cac8483 100644
--- a/source/util_api/ansc/AnscPlatform/user_openssl.c
+++ b/source/util_api/ansc/AnscPlatform/user_openssl.c
@@ -68,7 +68,9 @@ void initialize_openssl_lib()

SSL_library_init ();
SSL_load_error_strings ();
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSLeay_add_all_algorithms ();
+#endif
SSLeay_add_ssl_algorithms ();
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/source/debug_api/ansc_debug.c b/source/debug_api/ansc_debug.c
index 7945da13..b6a47d42 100644
--- a/source/debug_api/ansc_debug.c
+++ b/source/debug_api/ansc_debug.c
@@ -534,10 +534,12 @@ void CcspTraceLogAPI(char *fileName, char *pComponentName, int level, const char
char sfn[32];
va_list args;

+#if FEATURE_SUPPORT_RDKLOG
CcspTraceShortenFileName(sfn, 32, fileName);
va_start(args, format);
RDK_LOG1(level, ComponentName, format, args);
va_end(args);
+#endif
}
}
}
61 changes: 61 additions & 0 deletions recipes-webpa/ccsp/ccsp-cr.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
SUMMARY = "CCSP CcspCrSsp component"
HOMEPAGE = "http://github.com/belvedere-yocto/CcspCr"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=175792518e4ac015ab6696d16c4f607e"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

DEPENDS_append = " ccsp-common-library dbus telemetry libunpriv rbus libxml2 utopia"

require ccsp_common.inc

RECIPE_BRANCH ?= "rdk-next"
SRC_URI = "\
git://code.rdkcentral.com/r/rdkb/components/opensource/ccsp/CcspCr.git;protocol=https;branch=${RECIPE_BRANCH} \
file://0001-ccspcr-build-support.patch \
file://ccspcr-init \
"

SRCREV = "7054041df8817aa0e019a41363520ffeff9dcf91"
PV = "git${SRCPV}"

S = "${WORKDIR}/git"

inherit autotools systemd update-rc.d

EXTRA_OECONF_append = " --with-rbus-build=only"
CFLAGS_append = " \
-DDISABLE_RDK_LOGGER \
-I=${includedir}/dbus-1.0 \
-I=${libdir}/dbus-1.0/include \
-I=${includedir}/ccsp \
-I${STAGING_INCDIR}/syscfg \
-I${STAGING_INCDIR}/utapi \
-I${STAGING_INCDIR}/utctx \
-I${STAGING_INCDIR}/ulog \
-I${STAGING_INCDIR}/rbus \
-I${STAGING_INCDIR}/rtmessage \
-I${STAGING_INCDIR}/libxml2 \
"

LDFLAGS_append = " -ldbus-1 -ltelemetry_msgsender -lprivilege -lsyscfg -lcjson -lmsgpackc"

do_install_append () {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/ccspcr-init ${D}${sysconfdir}/init.d/ccspcr

if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${systemd_unitdir}/system
install -m 644 ${WORKDIR}/ccspcr.service ${D}${systemd_unitdir}/system
fi
}

PACKAGES =+ "${PN}-initscript"
INITSCRIPT_PACKAGES = "${PN}-initscript"
INITSCRIPT_NAME_${PN}-initscript = "ccspcr"
INITSCRIPT_PARAMS_${PN}-initscript = "defaults 35 25"
RRECOMMENDS_${PN} = "${PN}-initscript"

FILES_${PN}-initscript = "${sysconfdir}/init.d/ccspcr"
FILES_${PN} += " ${bindir}/CcspCrSsp"

51 changes: 51 additions & 0 deletions recipes-webpa/ccsp/ccsp-cr/0001-ccspcr-build-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff --git a/source/CCSP_CR/ccsp_cr_exportDM.c b/source/CCSP_CR/ccsp_cr_exportDM.c
index 4b41ecb..088ffcd 100644
--- a/source/CCSP_CR/ccsp_cr_exportDM.c
+++ b/source/CCSP_CR/ccsp_cr_exportDM.c
@@ -135,6 +135,7 @@ static void WriteXmlHead(FILE *file)
if(NULL == g_pDbusHandle)
printf("g_pDbusHanle is NULL\n");
/* CID 57006 - Unchecked return value */
+#ifdef RDK_BUILD
ret = CcspBaseIf_getParameterValues(g_pDbusHandle, "com.cisco.spvtg.ccsp.tdm", "/com/cisco/spvtg/ccsp/tdm", pParamNames, 5, &valCount, &ppReturnVal);
if (CCSP_Message_Bus_OK != ret)
{
@@ -154,7 +155,8 @@ static void WriteXmlHead(FILE *file)
fprintf(file, "%s%s%s\n", "<softwareVersion>",ppReturnVal[4]->parameterValue, "</softwareVersion>");
free_parameterValStruct_t(g_pDbusHandle, valCount, ppReturnVal);
}
-
+#endif
+
fprintf(file, "%s", ATTRIBUTE_STR);
}

diff --git a/source/CrSsp/ssp_main.c b/source/CrSsp/ssp_main.c
index 9320169..a1639ff 100644
--- a/source/CrSsp/ssp_main.c
+++ b/source/CrSsp/ssp_main.c
@@ -48,7 +48,9 @@
#endif

#include "ssp_global.h"
+#ifdef RDK_BUILD
#include "syscfg/syscfg.h"
+#endif
#include "cap.h"
#include "telemetry_busmessage_sender.h"

@@ -456,6 +458,7 @@ static void* waitforsyscfgReady(void *arg)
#define MAX_WAIT_TIME 90
int times = 0;
pthread_detach(pthread_self());
+#ifdef RDK_BUILD
while(times++ < MAX_WAIT_TIME) {
if ( 0 != syscfg_init( ) ) {
CCSP_Msg_SleepInMilliSeconds(TIME_INTERVAL);
@@ -465,6 +468,7 @@ static void* waitforsyscfgReady(void *arg)
break;
}
}
+#endif
pthread_exit(NULL);
}
38 changes: 38 additions & 0 deletions recipes-webpa/ccsp/ccsp-cr/ccspcr-init
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

start() {
printf "Starting WebPA CcspCR module: "

ln -sf /usr/ccsp/ccsp_msg.cfg /tmp/ccsp_msg.cfg
rm -rf /tmp/syscfg.shmid
syscfg_create -f /usr/ccsp/syscfg.db
start-stop-daemon -S -q -b --exec /usr/bin/CcspCrSsp -- -subsys eRT. </dev/null >/dev/nul
[ $? == 0 ] && echo "OK" || echo "FAIL"
}

stop() {
printf "Stopping WebPA CcspCR module: "
start-stop-daemon -K -q --exec /usr/bin/CcspCrSsp
[ $? == 0 ] && echo "OK" || echo "FAIL"
}

restart() {
stop
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
13 changes: 13 additions & 0 deletions recipes-webpa/ccsp/ccsp-cr/ccspcr.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=CCSP CR Service
Before=wpeframework.service
After=rbuscore.service

[Service]
ExecStart=/etc/init.d/ccspcr start
ExecStop=/etc/init.d/ccspcr stop
ExecReload=/etc/init.d/ccspcr reload
Restart=always

[Install]
WantedBy=multi-user.target
16 changes: 16 additions & 0 deletions recipes-webpa/ccsp/ccsp_common.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SUMMARY = "common inc for ccsp modules."

inherit pkgconfig

CFLAGS_append = "\
-D_COSA_HAL_ -U_COSA_SIM_ -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-strict-aliasing \
-DCONFIG_SYSTEM_MOCA -D_ANSC_LINUX -D_ANSC_USER -D_ANSC_LITTLE_ENDIAN_ -D_CCSP_CWMP_TCP_CONNREQ_HANDLER \
-D_DSLH_STUN_ -D_NO_PKI_KB5_SUPPORT -D_BBHM_SSE_FILE_IO -D_ANSC_USE_OPENSSL_ -DENABLE_SA_KEY \
-D_ANSC_AES_USED_ -D_COSA_INTEL_USG_ARM_ -D_COSA_FOR_COMCAST_ -D_NO_EXECINFO_H_ -DFEATURE_SUPPORT_SYSLOG \
-DBUILD_WEB -D_NO_ANSC_ZLIB_ -D_DEBUG -U_ANSC_IPV6_COMPATIBLE_ -DUSE_NOTIFY_COMPONENT -DNTPD_ENABLE \
-DUTC_ENABLE -DXDNS_ENABLE -DMOCA_HOME_ISOLATION -DCCSP_SUPPORT_ENABLED \
"

FILES_${PN} += "${libdir}/*.so"
FILES_SOLIBSDEV = ""
INSANE_SKIP_${PN} += "dev-so"
Loading