Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_subr.c
Show First 20 Lines • Show All 3,161 Lines • ▼ Show 20 Lines | #ifdef INET | ||||
sprintf(sp, "]:%i", ntohs(th->th_dport)); | sprintf(sp, "]:%i", ntohs(th->th_dport)); | ||||
#endif /* INET */ | #endif /* INET */ | ||||
} else { | } else { | ||||
free(s, M_TCPLOG); | free(s, M_TCPLOG); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
sp = s + strlen(s); | sp = s + strlen(s); | ||||
if (th) | if (th) | ||||
sprintf(sp, " tcpflags 0x%b", th->th_flags, PRINT_TH_FLAGS); | sprintf(sp, " tcpflags 0x%b", (th->th_x2 << 8) | th->th_flags, PRINT_TH_FLAGS); | ||||
if (*(s + size - 1) != '\0') | if (*(s + size - 1) != '\0') | ||||
panic("%s: string too long", __func__); | panic("%s: string too long", __func__); | ||||
return (s); | return (s); | ||||
} | } | ||||
/* | /* | ||||
* A subroutine which makes it easy to track TCP state changes with DTrace. | * A subroutine which makes it easy to track TCP state changes with DTrace. | ||||
* This function shouldn't be called for t_state initializations that don't | * This function shouldn't be called for t_state initializations that don't | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | #ifdef TCP_BLACKBOX | ||||
(void)tcp_log_get_id(tp, xt->xt_logid); | (void)tcp_log_get_id(tp, xt->xt_logid); | ||||
#endif | #endif | ||||
} | } | ||||
xt->xt_len = sizeof(struct xtcpcb); | xt->xt_len = sizeof(struct xtcpcb); | ||||
in_pcbtoxinpcb(inp, &xt->xt_inp); | in_pcbtoxinpcb(inp, &xt->xt_inp); | ||||
if (inp->inp_socket == NULL) | if (inp->inp_socket == NULL) | ||||
xt->xt_inp.xi_socket.xso_protocol = IPPROTO_TCP; | xt->xt_inp.xi_socket.xso_protocol = IPPROTO_TCP; | ||||
} | } | ||||
int | |||||
tcp_get_ace(struct tcphdr *th) | |||||
{ | |||||
int ace = 0; | |||||
if (th->th_flags & TH_ECE) | |||||
ace += 1; | |||||
if (th->th_flags & TH_CWR) | |||||
ace += 2; | |||||
if (th->th_x2 & (TH_AE >> 8)) | |||||
ace += 4; | |||||
return ace; | |||||
} | |||||
No newline at end of file |