Skip to content

Commit f665e17

Browse files
committed
Add MQX RTCS compatibility for XINET_PTON
1 parent 7efc962 commit f665e17

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/internal.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13242,9 +13242,17 @@ static int MatchIPv6(const char* pattern, int patternLen,
1324213242
XMEMSET(&addr2, 0, sizeof(addr2));
1324313243

1324413244
/* Try parsing both as IPv6 */
13245+
#ifdef FREESCALE_MQX
13246+
if (XINET_PTON(WOLFSSL_IP6, patBuf, &addr1, sizeof(addr1)) != RTCS_OK)
13247+
#else
1324513248
if (XINET_PTON(WOLFSSL_IP6, patBuf, &addr1) != 1)
13249+
#endif
1324613250
return 0;
13251+
#ifdef FREESCALE_MQX
13252+
if (XINET_PTON(WOLFSSL_IP6, strBuf, &addr2, sizeof(addr2)) != RTCS_OK)
13253+
#else
1324713254
if (XINET_PTON(WOLFSSL_IP6, strBuf, &addr2) != 1)
13255+
#endif
1324813256
return 0;
1324913257

1325013258
/* Compare raw address bytes */

src/sniffer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7659,6 +7659,9 @@ static int addKeyLogSnifferServerHelper(const char* address,
76597659
#ifdef FUSION_RTOS
76607660
if (XINET_PTON(AF_INET6, address, serverIp.ip6,
76617661
sizeof(serverIp.ip4)) == 1)
7662+
#elif defined(FREESCALE_MQX)
7663+
if (XINET_PTON(AF_INET6, address, serverIp.ip6,
7664+
sizeof(serverIp.ip6)) == RTCS_OK)
76627665
#else
76637666
if (XINET_PTON(AF_INET6, address, serverIp.ip6) == 1)
76647667
#endif

src/x509.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3084,15 +3084,25 @@ int wolfSSL_X509_add_altname(WOLFSSL_X509* x509, const char* name, int type)
30843084
int ptonRet;
30853085

30863086
/* Check if this is an ip4 address */
3087+
#ifdef FREESCALE_MQX
3088+
ptonRet = XINET_PTON(WOLFSSL_IP4, name, ip4, sizeof(ip4));
3089+
if (ptonRet == RTCS_OK) {
3090+
#else
30873091
ptonRet = XINET_PTON(WOLFSSL_IP4, name, ip4);
30883092
if (ptonRet == 1) {
3093+
#endif
30893094
return wolfSSL_X509_add_altname_ex(x509, (const char*)ip4, 4,
30903095
type);
30913096
}
30923097

30933098
/* Check for ip6 */
3099+
#ifdef FREESCALE_MQX
3100+
ptonRet = XINET_PTON(WOLFSSL_IP6, name, ip6, sizeof(ip6));
3101+
if (ptonRet == RTCS_OK) {
3102+
#else
30943103
ptonRet = XINET_PTON(WOLFSSL_IP6, name, ip6);
30953104
if (ptonRet == 1) {
3105+
#endif
30963106
return wolfSSL_X509_add_altname_ex(x509, (const char*)ip6, 16,
30973107
type);
30983108
}
@@ -5507,12 +5517,20 @@ static int MatchIpName(const char* name, int nameSz, WOLFSSL_GENERAL_NAME* gn)
55075517
/* IPv4 constraint 8 bytes (IP + mask),
55085518
* IPv6 constraint 32 bytes (IP + mask) */
55095519
if (constraintLen == 8) {
5520+
#ifdef FREESCALE_MQX
5521+
if (XINET_PTON(WOLFSSL_IP4, ipStr, ipBytes, sizeof(ipBytes)) == RTCS_OK) {
5522+
#else
55105523
if (XINET_PTON(WOLFSSL_IP4, ipStr, ipBytes) == 1) {
5524+
#endif
55115525
ipLen = 4;
55125526
}
55135527
}
55145528
else if (constraintLen == 32) {
5529+
#ifdef FREESCALE_MQX
5530+
if (XINET_PTON(WOLFSSL_IP6, ipStr, ipBytes, sizeof(ipBytes)) == RTCS_OK) {
5531+
#else
55155532
if (XINET_PTON(WOLFSSL_IP6, ipStr, ipBytes) == 1) {
5533+
#endif
55165534
ipLen = 16;
55175535
}
55185536
}

0 commit comments

Comments
 (0)