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

Function InitPacketAliasLog

freebsd/netinet/libalias/alias_db.c:2141–2160  ·  view source on GitHub ↗

Init the log file and enable logging */

Source from the content-addressed store, hash-verified

2139
2140/* Init the log file and enable logging */
2141static int
2142InitPacketAliasLog(struct libalias *la)
2143{
2144
2145 LIBALIAS_LOCK_ASSERT(la);
2146 if (~la->packetAliasMode & PKT_ALIAS_LOG) {
2147#ifdef _KERNEL
2148 if ((la->logDesc = malloc(LIBALIAS_BUF_SIZE)))
2149 ;
2150#else
2151 if ((la->logDesc = fopen("/var/log/alias.log", "w")))
2152 fprintf(la->logDesc, "PacketAlias/InitPacketAliasLog: Packet alias logging enabled.\n");
2153#endif
2154 else
2155 return (ENOMEM); /* log initialization failed */
2156 la->packetAliasMode |= PKT_ALIAS_LOG;
2157 }
2158
2159 return (1);
2160}
2161
2162/* Close the log-file and disable logging. */
2163static void

Callers 1

LibAliasSetModeFunction · 0.85

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected