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

Function tcp_log_state_change

freebsd/netinet/tcp_log_buf.c:1745–1779  ·  view source on GitHub ↗

* Change the logging state for a TCPCB. Returns 0 on success or an * error code on failure. */

Source from the content-addressed store, hash-verified

1743 * error code on failure.
1744 */
1745int
1746tcp_log_state_change(struct tcpcb *tp, int state)
1747{
1748 struct tcp_log_mem *log_entry;
1749
1750 INP_WLOCK_ASSERT(tp->t_inpcb);
1751 switch(state) {
1752 case TCP_LOG_STATE_CLEAR:
1753 while ((log_entry = STAILQ_FIRST(&tp->t_logs)) != NULL)
1754 tcp_log_remove_log_head(tp, log_entry);
1755 /* Fall through */
1756
1757 case TCP_LOG_STATE_OFF:
1758 tp->t_logstate = TCP_LOG_STATE_OFF;
1759 break;
1760
1761 case TCP_LOG_STATE_TAIL:
1762 case TCP_LOG_STATE_HEAD:
1763 case TCP_LOG_STATE_CONTINUAL:
1764 case TCP_LOG_STATE_HEAD_AUTO:
1765 case TCP_LOG_STATE_TAIL_AUTO:
1766 tp->t_logstate = state;
1767 break;
1768
1769 default:
1770 return (EINVAL);
1771 }
1772 if (tcp_disable_all_bb_logs) {
1773 /* We are prohibited from doing any logs */
1774 tp->t_logstate = TCP_LOG_STATE_OFF;
1775 }
1776 tp->t_flags2 &= ~(TF2_LOG_AUTO);
1777
1778 return (0);
1779}
1780
1781/* If tcp_drain() is called, flush half the log entries. */
1782void

Callers 2

tcp_log_event_Function · 0.85
tcp_default_ctloutputFunction · 0.85

Calls 1

tcp_log_remove_log_headFunction · 0.85

Tested by

no test coverage detected