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

Function LibAliasAddServer

freebsd/netinet/libalias/alias_db.c:2248–2282  ·  view source on GitHub ↗

Add server to the pool of servers */

Source from the content-addressed store, hash-verified

2246
2247/* Add server to the pool of servers */
2248int
2249LibAliasAddServer(struct libalias *la, struct alias_link *lnk, struct in_addr addr, u_short port)
2250{
2251 struct server *server;
2252 int res;
2253
2254 LIBALIAS_LOCK(la);
2255 (void)la;
2256
2257 server = malloc(sizeof(struct server));
2258
2259 if (server != NULL) {
2260 struct server *head;
2261
2262 server->addr = addr;
2263 server->port = port;
2264
2265 head = lnk->server;
2266 if (head == NULL)
2267 server->next = server;
2268 else {
2269 struct server *s;
2270
2271 for (s = head; s->next != head; s = s->next);
2272 s->next = server;
2273 server->next = head;
2274 }
2275 lnk->server = server;
2276 res = 0;
2277 } else
2278 res = -1;
2279
2280 LIBALIAS_UNLOCK(la);
2281 return (res);
2282}
2283
2284/* Redirect packets of a given IP protocol from a specific
2285 public address to a private address */

Callers 2

add_redir_spool_cfgFunction · 0.85
ng_nat_rcvmsgFunction · 0.85

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected