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

Function print_flags

tools/ipfw/ipfw2.c:1171–1198  ·  view source on GitHub ↗

* print flags set/clear in the two bitmasks passed as parameters. * There is a specialized check for f_tcpflags. */

Source from the content-addressed store, hash-verified

1169 * There is a specialized check for f_tcpflags.
1170 */
1171static void
1172print_flags(struct buf_pr *bp, char const *name, const ipfw_insn *cmd,
1173 struct _s_x *list)
1174{
1175 char const *comma = "";
1176 int i;
1177 uint8_t set = cmd->arg1 & 0xff;
1178 uint8_t clear = (cmd->arg1 >> 8) & 0xff;
1179
1180 if (list == f_tcpflags && set == TH_SYN && clear == TH_ACK) {
1181 bprintf(bp, " setup");
1182 return;
1183 }
1184
1185 bprintf(bp, " %s ", name);
1186 for (i=0; list[i].x != 0; i++) {
1187 if (set & list[i].x) {
1188 set &= ~list[i].x;
1189 bprintf(bp, "%s%s", comma, list[i].s);
1190 comma = ",";
1191 }
1192 if (clear & list[i].x) {
1193 clear &= ~list[i].x;
1194 bprintf(bp, "%s!%s", comma, list[i].s);
1195 comma = ",";
1196 }
1197 }
1198}
1199
1200
1201/*

Callers 1

print_instructionFunction · 0.85

Calls 1

bprintfFunction · 0.85

Tested by

no test coverage detected