diff --git a/cddl/lib/libdtrace/tcp.d b/cddl/lib/libdtrace/tcp.d --- a/cddl/lib/libdtrace/tcp.d +++ b/cddl/lib/libdtrace/tcp.d @@ -97,7 +97,7 @@ #pragma D binding "1.6.3" TH_CWR inline uint16_t TH_CWR = 0x80; #pragma D binding "1.6.3" TH_AE -inline uint16_t TH_AE = 0x100; +inline uint16_t TH_AE = 0x100; /* TCP connection state strings. */ #pragma D binding "1.6.3" tcp_state_string @@ -332,7 +332,7 @@ flags & TH_URG ? "URG" : flags & TH_ECE ? "ECE" : flags & TH_CWR ? "CWR" : - flags & TH_AE ? "AE" : + flags & TH_AE ? "AE" : "unknown" ; #pragma D binding "1.12.1" PRU_ATTACH diff --git a/sbin/ipf/iplang/iplang_y.y b/sbin/ipf/iplang/iplang_y.y --- a/sbin/ipf/iplang/iplang_y.y +++ b/sbin/ipf/iplang/iplang_y.y @@ -1059,7 +1059,8 @@ __tcp_set_flags(tcp, strtol(*arg, NULL, 0)); break; } else - __tcp_set_flags(tcp, __tcp_get_flags(tcp) | flagv[t - flags]); + __tcp_set_flags(tcp, __tcp_get_flags(tcp) | + flagv[t - flags]); free(*arg); *arg = NULL; } diff --git a/sbin/ipf/ipsend/ipsend.1 b/sbin/ipf/ipsend/ipsend.1 --- a/sbin/ipf/ipsend/ipsend.1 +++ b/sbin/ipf/ipsend/ipsend.1 @@ -39,7 +39,7 @@ packets to a destination host, using command line options to specify various attributes present in the headers. The \fIdestination\fP must be given as the last command line option, except for when TCP flags are specified as -a combination of A, S, F, U, P and R, last. +a combination of A, S, F, U, P, R, E, W and e, last. .PP The other way it may be compiled, with DOSOCKET defined, is to allow an attempt at making a TCP connection using a with ipsend resending the SYN diff --git a/sbin/ipf/ipsend/ipsend.c b/sbin/ipf/ipsend/ipsend.c --- a/sbin/ipf/ipsend/ipsend.c +++ b/sbin/ipf/ipsend/ipsend.c @@ -399,7 +399,7 @@ printf("Source: %s\n", inet_ntoa(ip->ip_src)); printf("Dest: %s\n", inet_ntoa(ip->ip_dst)); printf("Gateway: %s\n", inet_ntoa(gwip)); - if (ip->ip_p == IPPROTO_TCP && __tcp_get_flags(tcp)) + if (ip->ip_p == IPPROTO_TCP && __tcp_get_flags(tcp) != 0) printf("Flags: %#x\n", __tcp_get_flags(tcp)); printf("mtu: %d\n", mtu); diff --git a/sbin/ipf/ipsend/iptests.c b/sbin/ipf/ipsend/iptests.c --- a/sbin/ipf/ipsend/iptests.c +++ b/sbin/ipf/ipsend/iptests.c @@ -903,7 +903,6 @@ int nfd, i; t = (tcphdr_t *)((char *)ip + (IP_HL(ip) << 2)); - t->th_x2 = 0; TCP_OFF_A(t, 0); t->th_sport = htons(1); t->th_dport = htons(1); @@ -920,7 +919,7 @@ if (!ptest || (ptest == 1)) { /* - * Test 1: flags variations, 0 - 3f + * Test 1: flags variations, 0 - 1ff */ TCP_OFF_A(t, sizeof(*t) >> 2); printf("5.1 Test TCP flag combinations\n"); diff --git a/sbin/ipf/ipsend/resend.c b/sbin/ipf/ipsend/resend.c --- a/sbin/ipf/ipsend/resend.c +++ b/sbin/ipf/ipsend/resend.c @@ -50,7 +50,7 @@ if (ip->ip_p == IPPROTO_TCP) { printf(" seq %lu:%lu flags ", (u_long)t->th_seq, (u_long)t->th_ack); - for (j = 0, i = 1; i < 256; i *= 2, j++) + for (j = 0, i = 1; i < TH_FLAGS; i <<= 1, j++) if (__tcp_get_flags(t) & i) printf("%c", "FSRPAUEWe"[j]); } diff --git a/sbin/ipf/libipf/ipft_tx.c b/sbin/ipf/libipf/ipft_tx.c --- a/sbin/ipf/libipf/ipft_tx.c +++ b/sbin/ipf/libipf/ipft_tx.c @@ -267,8 +267,9 @@ __tcp_set_flags(tcp, 0); for (s = *cpp; *s; s++) - if ((t = strchr(myflagset, *s))) - __tcp_set_flags(tcp, __tcp_get_flags(tcp) | myflags[t-myflagset]); + if ((t = strchr(myflagset, *s))) + __tcp_set_flags(tcp, __tcp_get_flags(tcp) | + myflags[t-myflagset]); if (__tcp_get_flags(tcp)) cpp++; } @@ -438,8 +439,9 @@ __tcp_set_flags(tcp, 0); for (s = *cpp; *s; s++) - if ((t = strchr(myflagset, *s))) - __tcp_set_flags(tcp, __tcp_get_flags(tcp) | myflags[t-myflagset]); + if ((t = strchr(myflagset, *s))) + __tcp_set_flags(tcp, __tcp_get_flags(tcp) | + myflags[t-myflagset]); if (__tcp_get_flags(tcp)) cpp++; } diff --git a/sbin/ipf/libipf/printpacket.c b/sbin/ipf/libipf/printpacket.c --- a/sbin/ipf/libipf/printpacket.c +++ b/sbin/ipf/libipf/printpacket.c @@ -13,7 +13,6 @@ # define IP_OFFMASK 0x3fff #endif - void printpacket(int dir, mb_t *m) { @@ -83,7 +82,8 @@ if (!(off & IP_OFFMASK)) { if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_UDP) PRINTF(",%d", ntohs(tcp->th_dport)); - if ((ip->ip_p == IPPROTO_TCP) && ((tcpflags = __tcp_get_flags(tcp)) != 0)) { + if ((ip->ip_p == IPPROTO_TCP) && + ((tcpflags = __tcp_get_flags(tcp)) != 0)) { putchar(' '); if (tcpflags & TH_FIN) putchar('F'); diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -829,13 +829,11 @@ snprintf(logbuf + loglen, sizeof logbuf - loglen, "%s:%d", ncpaddr_ntoa(&dstaddr), ntohs(th->th_dport)); loglen += strlen(logbuf + loglen); - n = 0; - for (mask = TH_FIN; mask <= TH_FLAGS; mask <<= 1) { + for (mask = TH_FIN, n = 0; mask <= TH_FLAGS; mask <<= 1, n++) { if (__tcp_get_flags(th) & mask) { snprintf(logbuf + loglen, sizeof logbuf - loglen, " %s", TcpFlags[n]); loglen += strlen(logbuf + loglen); } - n++; } snprintf(logbuf + loglen, sizeof logbuf - loglen, " seq:%lx ack:%lx (%d/%d)",