Skip to content

Commit 64bdcce

Browse files
committed
linuxkm/linuxkm_wc_port.h: move implementation of wc_linuxkm_inet_pton() and definition of XINET_PTON() inside BUILDING_WOLFSSL guard.
1 parent 6123feb commit 64bdcce

1 file changed

Lines changed: 23 additions & 26 deletions

File tree

linuxkm/linuxkm_wc_port.h

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,29 @@
485485
#include <linux/net.h>
486486
#ifndef WOLFCRYPT_ONLY
487487
#include <linux/inet.h>
488-
#endif
489-
#endif
488+
static inline int wc_linuxkm_inet_pton(int af, const char *src, void *dst)
489+
{
490+
int ret;
491+
492+
if (!src || !dst)
493+
return -EFAULT;
494+
495+
switch (af) {
496+
case AF_INET:
497+
ret = in4_pton(src, -1, (u8 *)dst, '\0', NULL);
498+
return ret == 1 ? 1 : 0;
499+
500+
case AF_INET6:
501+
ret = in6_pton(src, -1, (u8 *)dst, '\0', NULL);
502+
return ret == 1 ? 1 : 0;
503+
504+
default:
505+
return -EAFNOSUPPORT;
506+
}
507+
}
508+
#define XINET_PTON(af, src, dst) wc_linuxkm_inet_pton(af, src, dst)
509+
#endif /* !WOLFCRYPT_ONLY */
510+
#endif /* !WC_CONTAINERIZE_THIS */
490511

491512
#include <linux/slab.h>
492513
#include <linux/sched.h>
@@ -1786,28 +1807,4 @@
17861807
#define WC_DUMP_BACKTRACE_NONDEBUG dump_stack()
17871808
#endif
17881809

1789-
#if !defined(WOLFCRYPT_ONLY) && !defined(WC_CONTAINERIZE_THIS)
1790-
static inline int wc_linuxkm_inet_pton(int af, const char *src, void *dst)
1791-
{
1792-
int ret;
1793-
1794-
if (!src || !dst)
1795-
return -EFAULT;
1796-
1797-
switch (af) {
1798-
case AF_INET:
1799-
ret = in4_pton(src, -1, (u8 *)dst, '\0', NULL);
1800-
return ret == 1 ? 1 : 0;
1801-
1802-
case AF_INET6:
1803-
ret = in6_pton(src, -1, (u8 *)dst, '\0', NULL);
1804-
return ret == 1 ? 1 : 0;
1805-
1806-
default:
1807-
return -EAFNOSUPPORT;
1808-
}
1809-
}
1810-
#define XINET_PTON(af, src, dst) wc_linuxkm_inet_pton(af, src, dst)
1811-
#endif /* !WOLFCRYPT_ONLY && !WC_CONTAINERIZE_THIS */
1812-
18131810
#endif /* LINUXKM_WC_PORT_H */

0 commit comments

Comments
 (0)