Q2: 既然tcpdump和 iplink都能使网口进入混杂模式,这两个命令又可以独立执行。运行tcpdump命令抓包时,被ip link命令设置了promisc off, 网卡会退出混杂模式,会不会对tcdpump抓包造成影响? A:命令可以并发执行,不会相互干扰。这个场景下,ip link不会让网口退出混杂模式,也不会影响后续的 tcpdump 抓包。promisc off 命令只会让 ip link 显示的网口的状态标志位里的PROMISC被清除掉。
1160 static inline bool tcp_paws_reject(const struct tcp_options_received *rx_opt, 1161 int rst) 1162 { 1163 if (tcp_paws_check(rx_opt, 0)) 1164 return false; 1165 1166 /* RST segments are not recommended to carry timestamp, 1167 and, if they do, it is recommended to ignore PAWS because 1168 "their cleanup function should take precedence over timestamps." 1169 Certainly, it is mistake. It is necessary to understand the reasons 1170 of this constraint to relax it: if peer reboots, clock may go 1171 out-of-sync and half-open connections will not be reset. 1172 Actually, the problem would be not existing if all 1173 the implementations followed draft about maintaining clock 1174 via reboots. Linux-2.2 DOES NOT! 1175 1176 However, we can relax time bounds for RST segments to MSL. 1177 */ 1178 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) 1179 return false; 1180 return true; 1181 }
11 /**
12 * __struct_group() - Create a mirrored named and anonyomous struct
13 *
14 * @TAG: The tag name for the named sub-struct (usually empty)
15 * @NAME: The identifier name of the mirrored sub-struct
16 * @ATTRS: Any struct attributes (usually empty)
17 * @MEMBERS: The member declarations for the mirrored structs
18 *
19 * Used to create an anonymous union of two structs with identical layout
20 * and size: one anonymous and one named. The former's members can be used
21 * normally without sub-struct naming, and the latter can be used to
22 * reason about the start, end, and size of the group of struct members.
23 * The named struct can also be explicitly tagged for layer reuse, as well
24 * as both having struct attributes appended.
25 */
26 #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
27 union { \
28 struct { MEMBERS } ATTRS; \
29 struct TAG { MEMBERS } ATTRS NAME; \
30 } ATTRS
```