diff --git a/src/cli/cli_tcp.cpp b/src/cli/cli_tcp.cpp index 777d89ca8272..d243251a4d48 100644 --- a/src/cli/cli_tcp.cpp +++ b/src/cli/cli_tcp.cpp @@ -257,19 +257,22 @@ template <> otError TcpExample::Process(Arg aArgs[]) mInitialized = true; exit: -#if OPENTHREAD_CONFIG_TLS_ENABLE - if ((error != OT_ERROR_NONE) && mUseTls) + if (error != OT_ERROR_NONE) { - mbedtls_ssl_config_free(&mSslConfig); - mbedtls_ssl_free(&mSslContext); +#if OPENTHREAD_CONFIG_TLS_ENABLE + if (mUseTls) + { + mbedtls_ssl_config_free(&mSslConfig); + mbedtls_ssl_free(&mSslContext); - mbedtls_pk_free(&mPKey); - mbedtls_x509_crt_free(&mSrvCert); + mbedtls_pk_free(&mPKey); + mbedtls_x509_crt_free(&mSrvCert); + } +#endif // OPENTHREAD_CONFIG_TLS_ENABLE otTcpCircularSendBufferForceDiscardAll(&mSendBuffer); OT_UNUSED_VARIABLE(otTcpCircularSendBufferDeinitialize(&mSendBuffer)); } -#endif // OPENTHREAD_CONFIG_TLS_ENABLE return error; } diff --git a/tests/fuzz/fuzzer_platform.cpp b/tests/fuzz/fuzzer_platform.cpp index e616fc25e00d..abc8baae3560 100644 --- a/tests/fuzz/fuzzer_platform.cpp +++ b/tests/fuzz/fuzzer_platform.cpp @@ -35,8 +35,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -147,6 +149,8 @@ void FuzzerPlatformProcess(otInstance *aInstance) bool FuzzerPlatformResetWasRequested(void) { return sResetWasRequested; } +extern "C" { + uint32_t otPlatAlarmMilliGetNow(void) { return sAlarmNow / 1000; } void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt) @@ -515,3 +519,129 @@ void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otErro } void otPlatDiagAlarmCallback(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); } + +otPlatDnssdState otPlatDnssdGetState(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return OT_PLAT_DNSSD_STOPPED; +} + +void otPlatDnssdRegisterService(otInstance *aInstance, + const otPlatDnssdService *aService, + otPlatDnssdRequestId aRequestId, + otPlatDnssdRegisterCallback aCallback) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aService); + OT_UNUSED_VARIABLE(aRequestId); + OT_UNUSED_VARIABLE(aCallback); +} + +void otPlatDnssdUnregisterService(otInstance *aInstance, + const otPlatDnssdService *aService, + otPlatDnssdRequestId aRequestId, + otPlatDnssdRegisterCallback aCallback) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aService); + OT_UNUSED_VARIABLE(aRequestId); + OT_UNUSED_VARIABLE(aCallback); +} + +void otPlatDnssdRegisterHost(otInstance *aInstance, + const otPlatDnssdHost *aHost, + otPlatDnssdRequestId aRequestId, + otPlatDnssdRegisterCallback aCallback) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aHost); + OT_UNUSED_VARIABLE(aRequestId); + OT_UNUSED_VARIABLE(aCallback); +} + +void otPlatDnssdUnregisterHost(otInstance *aInstance, + const otPlatDnssdHost *aHost, + otPlatDnssdRequestId aRequestId, + otPlatDnssdRegisterCallback aCallback) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aHost); + OT_UNUSED_VARIABLE(aRequestId); + OT_UNUSED_VARIABLE(aCallback); +} + +void otPlatDnssdRegisterKey(otInstance *aInstance, + const otPlatDnssdKey *aKey, + otPlatDnssdRequestId aRequestId, + otPlatDnssdRegisterCallback aCallback) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aKey); + OT_UNUSED_VARIABLE(aRequestId); + OT_UNUSED_VARIABLE(aCallback); +} + +void otPlatDnssdUnregisterKey(otInstance *aInstance, + const otPlatDnssdKey *aKey, + otPlatDnssdRequestId aRequestId, + otPlatDnssdRegisterCallback aCallback) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aKey); + OT_UNUSED_VARIABLE(aRequestId); + OT_UNUSED_VARIABLE(aCallback); +} + +otError otPlatMdnsSetListeningEnabled(otInstance *aInstance, bool aEnable, uint32_t aInfraIfIndex) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aEnable); + OT_UNUSED_VARIABLE(aInfraIfIndex); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +void otPlatMdnsSendMulticast(otInstance *aInstance, otMessage *aMessage, uint32_t aInfraIfIndex) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aMessage); + OT_UNUSED_VARIABLE(aInfraIfIndex); +} + +void otPlatMdnsSendUnicast(otInstance *aInstance, otMessage *aMessage, const otPlatMdnsAddressInfo *aAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aMessage); + OT_UNUSED_VARIABLE(aAddress); +} + +bool otPlatInfraIfHasAddress(uint32_t aInfraIfIndex, const otIp6Address *aAddress) +{ + OT_UNUSED_VARIABLE(aInfraIfIndex); + OT_UNUSED_VARIABLE(aAddress); + + return false; +} + +otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex, + const otIp6Address *aDestAddress, + const uint8_t *aBuffer, + uint16_t aBufferLength) +{ + OT_UNUSED_VARIABLE(aInfraIfIndex); + OT_UNUSED_VARIABLE(aDestAddress); + OT_UNUSED_VARIABLE(aBuffer); + OT_UNUSED_VARIABLE(aBufferLength); + + return OT_ERROR_FAILED; +} + +otError otPlatInfraIfDiscoverNat64Prefix(uint32_t aInfraIfIndex) +{ + OT_UNUSED_VARIABLE(aInfraIfIndex); + + return OT_ERROR_FAILED; +} + +} // extern "C" diff --git a/tests/fuzz/oss-fuzz-build b/tests/fuzz/oss-fuzz-build index 9a511b5ba464..3f03af8f5bac 100755 --- a/tests/fuzz/oss-fuzz-build +++ b/tests/fuzz/oss-fuzz-build @@ -44,6 +44,7 @@ set -euxo pipefail -DOT_RCP=OFF \ -DOT_BORDER_AGENT=ON \ -DOT_BORDER_ROUTER=ON \ + -DOT_BORDER_ROUTING=ON \ -DOT_CHANNEL_MANAGER=ON \ -DOT_CHANNEL_MONITOR=ON \ -DOT_COAP=ON \ @@ -55,6 +56,7 @@ set -euxo pipefail -DOT_DHCP6_CLIENT=ON \ -DOT_DHCP6_SERVER=ON \ -DOT_DNS_CLIENT=ON \ + -DOT_DNSSD_SERVER=ON \ -DOT_ECDSA=ON \ -DOT_HISTORY_TRACKER=ON \ -DOT_IP6_FRAGM=ON \ @@ -63,13 +65,14 @@ set -euxo pipefail -DOT_LINK_RAW=ON \ -DOT_LOG_OUTPUT=APP \ -DOT_MAC_FILTER=ON \ + -DOT_MDNS=ON \ -DOT_NETDATA_PUBLISHER=ON \ -DOT_NETDIAG_CLIENT=ON \ -DOT_PING_SENDER=ON \ -DOT_SERVICE=ON \ -DOT_SLAAC=ON \ -DOT_SNTP_CLIENT=ON \ - -DOT_SRN_ADV_PROXY=ON \ + -DOT_SRP_ADV_PROXY=ON \ -DOT_SRP_CLIENT=ON \ -DOT_SRP_SERVER=ON \ -DOT_THREAD_VERSION=1.3 \