1 // SPDX-License-Identifier: GPL-2.0+
3 * Generic network code. Moved from net.c
5 * Copyright 1994 - 2000 Neil Russell.
6 * Copyright 2000 Roland Borde
7 * Copyright 2000 Paolo Scaffardi
8 * Copyright 2000-2002 Wolfgang Denk, wd@denx.de
9 * Copyright 2009 Dirk Behme, dirk.behme@googlemail.com
14 struct in_addr string_to_ip(const char *s)
24 for (addr.s_addr = 0, i = 0; i < 4; ++i) {
25 ulong val = s ? simple_strtoul(s, &e, 10) : 0;
30 if (i != 3 && *e != '.') {
35 addr.s_addr |= (val & 0xFF);
41 addr.s_addr = htonl(addr.s_addr);