Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/usr.sbin/npf/npfctl/npf_build.c,v rcsdiff: /ftp/cvs/cvsroot/src/usr.sbin/npf/npfctl/npf_build.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.21 retrieving revision 1.22 diff -u -p -r1.21 -r1.22 --- src/usr.sbin/npf/npfctl/npf_build.c 2013/02/16 21:11:14 1.21 +++ src/usr.sbin/npf/npfctl/npf_build.c 2013/03/18 02:17:49 1.22 @@ -1,4 +1,4 @@ -/* $NetBSD: npf_build.c,v 1.21 2013/02/16 21:11:14 rmind Exp $ */ +/* $NetBSD: npf_build.c,v 1.22 2013/03/18 02:17:49 rmind Exp $ */ /*- * Copyright (c) 2011-2013 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__RCSID("$NetBSD: npf_build.c,v 1.21 2013/02/16 21:11:14 rmind Exp $"); +__RCSID("$NetBSD: npf_build.c,v 1.22 2013/03/18 02:17:49 rmind Exp $"); #include #include @@ -453,6 +453,22 @@ npfctl_build_rproc(const char *name, npf } } +void +npfctl_build_maprset(const char *name, int attr, u_int if_idx) +{ + const int attr_di = (NPF_RULE_IN | NPF_RULE_OUT); + nl_rule_t *rl; + + /* If no direction is not specified, then both. */ + if ((attr & attr_di) == 0) { + attr |= attr_di; + } + /* Allow only "in/out" attributes. */ + attr = NPF_RULE_GROUP | NPF_RULE_GROUP | (attr & attr_di); + rl = npf_rule_create(name, attr, if_idx); + npf_nat_insert(npf_conf, rl, NPF_PRI_LAST); +} + /* * npfctl_build_group: create a group, insert into the global ruleset, * update the current group pointer and increase the nesting level.