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