diff options
Diffstat (limited to 'net/core/utils.c')
-rw-r--r-- | net/core/utils.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/core/utils.c b/net/core/utils.c index f5613d569c23..e3487e461939 100644 --- a/net/core/utils.c +++ b/net/core/utils.c | |||
@@ -107,6 +107,18 @@ static inline int xdigit2bin(char c, int delim) | |||
107 | return IN6PTON_UNKNOWN; | 107 | return IN6PTON_UNKNOWN; |
108 | } | 108 | } |
109 | 109 | ||
110 | /** | ||
111 | * in4_pton - convert an IPv4 address from literal to binary representation | ||
112 | * @src: the start of the IPv4 address string | ||
113 | * @srclen: the length of the string, -1 means strlen(src) | ||
114 | * @dst: the binary (u8[4] array) representation of the IPv4 address | ||
115 | * @delim: the delimiter of the IPv4 address in @src, -1 means no delimiter | ||
116 | * @end: A pointer to the end of the parsed string will be placed here | ||
117 | * | ||
118 | * Return one on success, return zero when any error occurs | ||
119 | * and @end will point to the end of the parsed string. | ||
120 | * | ||
121 | */ | ||
110 | int in4_pton(const char *src, int srclen, | 122 | int in4_pton(const char *src, int srclen, |
111 | u8 *dst, | 123 | u8 *dst, |
112 | int delim, const char **end) | 124 | int delim, const char **end) |
@@ -161,6 +173,18 @@ out: | |||
161 | } | 173 | } |
162 | EXPORT_SYMBOL(in4_pton); | 174 | EXPORT_SYMBOL(in4_pton); |
163 | 175 | ||
176 | /** | ||
177 | * in6_pton - convert an IPv6 address from literal to binary representation | ||
178 | * @src: the start of the IPv6 address string | ||
179 | * @srclen: the length of the string, -1 means strlen(src) | ||
180 | * @dst: the binary (u8[16] array) representation of the IPv6 address | ||
181 | * @delim: the delimiter of the IPv6 address in @src, -1 means no delimiter | ||
182 | * @end: A pointer to the end of the parsed string will be placed here | ||
183 | * | ||
184 | * Return one on success, return zero when any error occurs | ||
185 | * and @end will point to the end of the parsed string. | ||
186 | * | ||
187 | */ | ||
164 | int in6_pton(const char *src, int srclen, | 188 | int in6_pton(const char *src, int srclen, |
165 | u8 *dst, | 189 | u8 *dst, |
166 | int delim, const char **end) | 190 | int delim, const char **end) |