Skip to content

Commit 42af7f8

Browse files
committed
Add MQX RTCS compatibility for XINET_PTON
1 parent 9176185 commit 42af7f8

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
@@ -13262,9 +13262,17 @@ static int MatchIPv6(const char* pattern, int patternLen,
1326213262
XMEMSET(&addr2, 0, sizeof(addr2));
1326313263

1326413264
/* Try parsing both as IPv6 */
13265+
#ifdef FREESCALE_MQX
13266+
if (XINET_PTON(WOLFSSL_IP6, patBuf, &addr1, sizeof(addr1)) != RTCS_OK)
13267+
#else
1326513268
if (XINET_PTON(WOLFSSL_IP6, patBuf, &addr1) != 1)
13269+
#endif
1326613270
return 0;
13271+
#ifdef FREESCALE_MQX
13272+
if (XINET_PTON(WOLFSSL_IP6, strBuf, &addr2, sizeof(addr2)) != RTCS_OK)
13273+
#else
1326713274
if (XINET_PTON(WOLFSSL_IP6, strBuf, &addr2) != 1)
13275+
#endif
1326813276
return 0;
1326913277

1327013278
/* 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
@@ -3085,15 +3085,25 @@ int wolfSSL_X509_add_altname(WOLFSSL_X509* x509, const char* name, int type)
30853085
int ptonRet;
30863086

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

30943099
/* Check for ip6 */
3100+
#ifdef FREESCALE_MQX
3101+
ptonRet = XINET_PTON(WOLFSSL_IP6, name, ip6, sizeof(ip6));
3102+
if (ptonRet == RTCS_OK) {
3103+
#else
30953104
ptonRet = XINET_PTON(WOLFSSL_IP6, name, ip6);
30963105
if (ptonRet == 1) {
3106+
#endif
30973107
return wolfSSL_X509_add_altname_ex(x509, (const char*)ip6, 16,
30983108
type);
30993109
}
@@ -5521,12 +5531,20 @@ static int MatchIpName(const char* name, int nameSz, WOLFSSL_GENERAL_NAME* gn)
55215531
/* IPv4 constraint 8 bytes (IP + mask),
55225532
* IPv6 constraint 32 bytes (IP + mask) */
55235533
if (constraintLen == 8) {
5534+
#ifdef FREESCALE_MQX
5535+
if (XINET_PTON(WOLFSSL_IP4, ipStr, ipBytes, sizeof(ipBytes)) == RTCS_OK) {
5536+
#else
55245537
if (XINET_PTON(WOLFSSL_IP4, ipStr, ipBytes) == 1) {
5538+
#endif
55255539
ipLen = 4;
55265540
}
55275541
}
55285542
else if (constraintLen == 32) {
5543+
#ifdef FREESCALE_MQX
5544+
if (XINET_PTON(WOLFSSL_IP6, ipStr, ipBytes, sizeof(ipBytes)) == RTCS_OK) {
5545+
#else
55295546
if (XINET_PTON(WOLFSSL_IP6, ipStr, ipBytes) == 1) {
5547+
#endif
55305548
ipLen = 16;
55315549
}
55325550
}

0 commit comments

Comments
 (0)