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