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

Function LibAliasSetMode

freebsd/netinet/libalias/alias_db.c:2506–2544  ·  view source on GitHub ↗

Change mode for some operations */

Source from the content-addressed store, hash-verified

2504
2505/* Change mode for some operations */
2506unsigned int
2507LibAliasSetMode(
2508 struct libalias *la,
2509 unsigned int flags, /* Which state to bring flags to */
2510 unsigned int mask /* Mask of which flags to affect (use 0 to
2511 * do a probe for flag values) */
2512)
2513{
2514 int res = -1;
2515
2516 LIBALIAS_LOCK(la);
2517/* Enable logging? */
2518 if (flags & mask & PKT_ALIAS_LOG) {
2519 /* Do the enable */
2520 if (InitPacketAliasLog(la) == ENOMEM)
2521 goto getout;
2522 } else
2523/* _Disable_ logging? */
2524 if (~flags & mask & PKT_ALIAS_LOG) {
2525 UninitPacketAliasLog(la);
2526 }
2527#ifndef NO_FW_PUNCH
2528/* Start punching holes in the firewall? */
2529 if (flags & mask & PKT_ALIAS_PUNCH_FW) {
2530 InitPunchFW(la);
2531 } else
2532/* Stop punching holes in the firewall? */
2533 if (~flags & mask & PKT_ALIAS_PUNCH_FW) {
2534 UninitPunchFW(la);
2535 }
2536#endif
2537
2538/* Other flags can be set/cleared without special action */
2539 la->packetAliasMode = (flags & mask) | (la->packetAliasMode & ~mask);
2540 res = la->packetAliasMode;
2541getout:
2542 LIBALIAS_UNLOCK(la);
2543 return (res);
2544}
2545
2546int
2547LibAliasCheckNewLink(struct libalias *la)

Callers 3

nat44_configFunction · 0.85
ng_nat_constructorFunction · 0.85
ng_nat_rcvmsgFunction · 0.85

Calls 4

InitPacketAliasLogFunction · 0.85
UninitPacketAliasLogFunction · 0.85
InitPunchFWFunction · 0.85
UninitPunchFWFunction · 0.85

Tested by

no test coverage detected