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

Function add_proto_compat

tools/ipfw/ipfw2.c:3641–3660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3639}
3640
3641static ipfw_insn *
3642add_proto_compat(ipfw_insn *cmd, char *av, u_char *protop)
3643{
3644 u_char proto = IPPROTO_IP;
3645
3646 if (_substrcmp(av, "all") == 0 || strcmp(av, "ip") == 0)
3647 ; /* do not set O_IP4 nor O_IP6 */
3648 else if (strcmp(av, "ipv4") == 0 || strcmp(av, "ip4") == 0)
3649 /* explicit "just IPv4" rule */
3650 fill_cmd(cmd, O_IP4, 0, 0);
3651 else if (strcmp(av, "ipv6") == 0 || strcmp(av, "ip6") == 0) {
3652 /* explicit "just IPv6" rule */
3653 proto = IPPROTO_IPV6;
3654 fill_cmd(cmd, O_IP6, 0, 0);
3655 } else
3656 return add_proto0(cmd, av, protop);
3657
3658 *protop = proto;
3659 return cmd;
3660}
3661
3662static ipfw_insn *
3663add_srcip(ipfw_insn *cmd, char *av, int cblen, struct tidx *tstate)

Callers 1

compile_ruleFunction · 0.85

Calls 4

_substrcmpFunction · 0.85
strcmpFunction · 0.85
add_proto0Function · 0.85
fill_cmdFunction · 0.70

Tested by

no test coverage detected