|
485 | 485 | #include <linux/net.h> |
486 | 486 | #ifndef WOLFCRYPT_ONLY |
487 | 487 | #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 */ |
490 | 511 |
|
491 | 512 | #include <linux/slab.h> |
492 | 513 | #include <linux/sched.h> |
|
1786 | 1807 | #define WC_DUMP_BACKTRACE_NONDEBUG dump_stack() |
1787 | 1808 | #endif |
1788 | 1809 |
|
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 | | - |
1813 | 1810 | #endif /* LINUXKM_WC_PORT_H */ |
0 commit comments