MCPcopy Create free account
hub / github.com/F-Stack/f-stack / StrToAddr

Function StrToAddr

tools/ipfw/nat.c:206–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204#define SETNUMPORTS(x,y) ((x) = ((x) & 0xffff0000) | (y))
205
206static void
207StrToAddr (const char* str, struct in_addr* addr)
208{
209 struct hostent* hp;
210
211 if (inet_aton (str, addr))
212 return;
213#ifdef FSTACK
214 else
215 errx (1, "invalid addr %d", addr->s_addr);
216#else
217
218 hp = gethostbyname (str);
219 if (!hp)
220 errx (1, "unknown host %s", str);
221
222 memcpy (addr, hp->h_addr, sizeof (struct in_addr));
223#endif
224}
225
226static int
227StrToPortRange (const char* str, const char* proto, port_range *portRange)

Callers 4

StrToAddrAndPortRangeFunction · 0.85
setup_redir_addrFunction · 0.85
setup_redir_portFunction · 0.85
setup_redir_protoFunction · 0.85

Calls 2

inet_atonFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected