1 .\" $NetBSD: pf.4,v 1.11 2009/09/14 11:17:49 wiz Exp $
2 .\" $OpenBSD: pf.4,v 1.59 2007/05/31 19:19:51 jmc Exp $
4 .\" Copyright (C) 2001, Kjell Wooding. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the project nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 .Cd "pseudo-device pf"
39 Packet filtering takes place in the kernel.
42 allows userland processes to control the
43 behavior of the packet filter through an
46 There are commands to enable and disable the filter, load rulesets,
47 add and remove individual rules or state table entries,
48 and retrieve statistics.
49 The most commonly used functions are covered by
52 Manipulations like loading a ruleset that involve more than a single
54 call require a so-called
56 which prevents the occurrence of
57 multiple concurrent manipulations.
61 parameter structures that refer to packet data (like
62 addresses and ports) are generally expected in network byte-order.
64 Rules and address tables are contained in so-called
68 request, if the anchor field of the argument structure is empty,
69 the kernel will use the default anchor (i.e., the main ruleset)
71 Anchors are specified by name and may be nested, with components
74 characters, similar to how file system hierarchies are laid out.
75 The final component of the anchor path is the anchor under which
76 operations will be performed.
79 supports the following
81 commands, available through
83 .Bl -tag -width xxxxxx
85 Start the packet filter.
87 Stop the packet filter.
89 Start the ALTQ bandwidth control system (see
92 Stop the ALTQ bandwidth control system.
93 .It Dv DIOCBEGINADDRS Fa "struct pfioc_pooladdr *pp"
95 struct pfioc_pooladdr {
103 char anchor[MAXPATHLEN];
104 struct pf_pooladdr addr;
108 Clear the buffer address pool and get a
116 .It Dv DIOCADDADDR Fa "struct pfioc_pooladdr *pp"
120 to the buffer address pool to be used in the following
125 All other members of the structure are ignored.
126 .It Dv DIOCADDRULE Fa "struct pfioc_rule *pr"
131 u_int32_t pool_ticket;
133 char anchor[MAXPATHLEN];
134 char anchor_call[MAXPATHLEN];
141 at the end of the inactive ruleset.
144 obtained through a preceding
152 must also be called if any pool addresses are required.
155 name indicates the anchor in which to append the rule.
160 .It Dv DIOCADDALTQ Fa "struct pfioc_altq *pa"
161 Add an ALTQ discipline or queue.
170 .It Dv DIOCGETRULES Fa "struct pfioc_rule *pr"
177 of rules in the active ruleset.
178 .It Dv DIOCGETRULE Fa "struct pfioc_rule *pr"
185 obtained through a preceding
191 .Dv PF_GET_CLR_CNTR ,
192 the per-rule statistics on the requested rule are cleared.
193 .It Dv DIOCGETADDRS Fa "struct pfioc_pooladdr *pp"
200 of pool addresses in the rule specified with
205 .It Dv DIOCGETADDR Fa "struct pfioc_pooladdr *pp"
210 from the rule specified with
217 obtained through a preceding
220 .It Dv DIOCGETALTQS Fa "struct pfioc_altq *pa"
227 of queues in the active list.
228 .It Dv DIOCGETALTQ Fa "struct pfioc_altq *pa"
229 Get the queueing discipline
235 obtained through a preceding
238 .It Dv DIOCGETQSTATS Fa "struct pfioc_qstats *pq"
239 Get the statistics on a queue.
241 struct pfioc_qstats {
250 This call fills in a pointer to the buffer of statistics
254 for the queue specified by
256 .It Dv DIOCGETRULESETS Fa "struct pfioc_ruleset *pr"
258 struct pfioc_ruleset {
260 char path[MAXPATHLEN];
261 char name[PF_ANCHOR_NAME_SIZE];
267 of rulesets (i.e., anchors) directly attached to the anchor named by
269 for use in subsequent
272 Nested anchors, since they are not directly attached to the given
273 anchor, will not be included.
276 if the given anchor does not exist.
277 .It Dv DIOCGETRULESET Fa "struct pfioc_ruleset *pr"
278 Get a ruleset (i.e., an anchor)
282 from the given anchor
284 the maximum number of which can be obtained from a preceding
289 if the given anchor does not exist or
291 if another process is concurrently updating a ruleset.
292 .It Dv DIOCADDSTATE Fa "struct pfioc_state *ps"
297 struct pf_state state;
300 .It Dv DIOCGETSTATE Fa "struct pfioc_state *ps"
301 Extract the entry with the specified number
303 from the state table.
304 .It Dv DIOCKILLSTATES Fa "struct pfioc_state_kill *psk"
305 Remove matching entries from the state table.
306 This ioctl returns the number of killed states in
309 struct pfioc_state_kill {
312 struct pf_rule_addr psk_src;
313 struct pf_rule_addr psk_dst;
314 char psk_ifname[IFNAMSIZ];
317 .It Dv DIOCCLRSTATES Fa "struct pfioc_state_kill *psk"
330 .It Dv DIOCSETSTATUSIF Fa "struct pfioc_if *pi"
331 Specify the interface for which statistics are accumulated.
334 char ifname[IFNAMSIZ];
337 .It Dv DIOCGETSTATUS Fa "struct pf_status *s"
338 Get the internal packet filter statistics.
341 u_int64_t counters[PFRES_MAX];
342 u_int64_t lcounters[LCNT_MAX];
343 u_int64_t fcounters[FCNT_MAX];
344 u_int64_t scounters[SCNT_MAX];
345 u_int64_t pcounters[2][2][3];
346 u_int64_t bcounters[2][2];
354 char ifname[IFNAMSIZ];
355 u_int8_t pf_chksum[MD5_DIGEST_LENGTH];
359 Clear the internal packet filter statistics.
360 .It Dv DIOCNATLOOK Fa "struct pfioc_natlook *pnl"
361 Look up a state table entry by source and destination addresses and ports.
363 struct pfioc_natlook {
364 struct pf_addr saddr;
365 struct pf_addr daddr;
366 struct pf_addr rsaddr;
367 struct pf_addr rdaddr;
377 .It Dv DIOCSETDEBUG Fa "u_int32_t *level"
380 enum { PF_DEBUG_NONE, PF_DEBUG_URGENT, PF_DEBUG_MISC,
383 .It Dv DIOCGETSTATES Fa "struct pfioc_states *ps"
384 Get state table entries.
386 struct pfioc_states {
390 struct pf_state *psu_states;
392 #define ps_buf ps_u.psu_buf
393 #define ps_states ps_u.psu_states
399 is non-zero on entry, as many states as possible that can fit into this
400 size will be copied into the supplied buffer
404 is always set to the total size required to hold all state table entries
406 .Li sizeof(struct pf_state) * nr ) .
407 .It Dv DIOCCHANGERULE Fa "struct pfioc_rule *pcr"
410 in the ruleset specified by
413 The type of operation to be performed is indicated by
415 which can be any of the following:
417 enum { PF_CHANGE_NONE, PF_CHANGE_ADD_HEAD, PF_CHANGE_ADD_TAIL,
418 PF_CHANGE_ADD_BEFORE, PF_CHANGE_ADD_AFTER,
419 PF_CHANGE_REMOVE, PF_CHANGE_GET_TICKET };
423 must be set to the value obtained with
424 .Dv PF_CHANGE_GET_TICKET
425 for all actions except
426 .Dv PF_CHANGE_GET_TICKET .
428 must be set to the value obtained with the
430 call for all actions except
433 .Dv PF_CHANGE_GET_TICKET .
435 indicates to which anchor the operation applies.
437 indicates the rule number against which
438 .Dv PF_CHANGE_ADD_BEFORE ,
439 .Dv PF_CHANGE_ADD_AFTER ,
443 .\" It Dv DIOCCHANGEALTQ Fa "struct pfioc_altq *pcr"
444 .It Dv DIOCCHANGEADDR Fa "struct pfioc_pooladdr *pca"
445 Add or remove the pool address
447 from the rule specified by
452 .It Dv DIOCSETTIMEOUT Fa "struct pfioc_tm *pt"
460 Set the state timeout of
464 The old value will be placed into
466 For possible values of
472 .It Dv DIOCGETTIMEOUT Fa "struct pfioc_tm *pt"
473 Get the state timeout of
475 The value will be placed into the
478 .It Dv DIOCCLRRULECTRS
479 Clear per-rule statistics.
480 .It Dv DIOCSETLIMIT Fa "struct pfioc_limit *pl"
481 Set the hard limits on the memory pools used by the packet filter.
488 enum { PF_LIMIT_STATES, PF_LIMIT_SRC_NODES, PF_LIMIT_FRAGS,
489 PF_LIMIT_TABLES, PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_MAX };
491 .It Dv DIOCGETLIMIT Fa "struct pfioc_limit *pl"
494 for the memory pool indicated by
496 .It Dv DIOCRCLRTABLES Fa "struct pfioc_table *io"
498 All the ioctls that manipulate radix tables
499 use the same structure described below.
503 contains on exit the number of tables deleted.
506 struct pfr_table pfrio_table;
515 u_int32_t pfrio_ticket;
517 #define pfrio_exists pfrio_nadd
518 #define pfrio_nzero pfrio_nadd
519 #define pfrio_nmatch pfrio_nadd
520 #define pfrio_naddr pfrio_size2
521 #define pfrio_setflag pfrio_size2
522 #define pfrio_clrflag pfrio_nadd
524 .It Dv DIOCRADDTABLES Fa "struct pfioc_table *io"
525 Create one or more tables.
528 must point to an array of
535 .Vt struct pfr_table .
538 contains the number of tables effectively created.
541 char pfrt_anchor[MAXPATHLEN];
542 char pfrt_name[PF_TABLE_NAME_SIZE];
543 u_int32_t pfrt_flags;
547 .It Dv DIOCRDELTABLES Fa "struct pfioc_table *io"
548 Delete one or more tables.
551 must point to an array of
558 .Vt struct pfr_table .
561 contains the number of tables effectively deleted.
562 .It Dv DIOCRGETTABLES Fa "struct pfioc_table *io"
563 Get the list of all tables.
565 .Va pfrio_buffer[pfrio_size]
566 contains a valid writeable buffer for
571 contains the number of tables written into the buffer.
572 If the buffer is too small, the kernel does not store anything but just
573 returns the required buffer size, without error.
574 .It Dv DIOCRGETTSTATS Fa "struct pfioc_table *io"
577 but is used to get an array of
582 struct pfr_table pfrts_t;
583 u_int64_t pfrts_packets
584 [PFR_DIR_MAX][PFR_OP_TABLE_MAX];
585 u_int64_t pfrts_bytes
586 [PFR_DIR_MAX][PFR_OP_TABLE_MAX];
587 u_int64_t pfrts_match;
588 u_int64_t pfrts_nomatch;
591 int pfrts_refcnt[PFR_REFCNT_MAX];
593 #define pfrts_name pfrts_t.pfrt_name
594 #define pfrts_flags pfrts_t.pfrt_flags
596 .It Dv DIOCRCLRTSTATS Fa "struct pfioc_table *io"
597 Clear the statistics of one or more tables.
600 must point to an array of
607 .Vt struct pfr_table .
610 contains the number of tables effectively cleared.
611 .It Dv DIOCRCLRADDRS Fa "struct pfioc_table *io"
612 Clear all addresses in a table.
615 contains the table to clear.
618 contains the number of addresses removed.
619 .It Dv DIOCRADDADDRS Fa "struct pfioc_table *io"
620 Add one or more addresses to a table.
623 contains the table ID and
625 must point to an array of
629 elements to add to the table.
632 .Vt struct pfr_addr .
635 contains the number of addresses effectively added.
639 struct in_addr _pfra_ip4addr;
640 struct in6_addr _pfra_ip6addr;
647 #define pfra_ip4addr pfra_u._pfra_ip4addr
648 #define pfra_ip6addr pfra_u._pfra_ip6addr
650 .It Dv DIOCRDELADDRS Fa "struct pfioc_table *io"
651 Delete one or more addresses from a table.
654 contains the table ID and
656 must point to an array of
660 elements to delete from the table.
663 .Vt struct pfr_addr .
666 contains the number of addresses effectively deleted.
667 .It Dv DIOCRSETADDRS Fa "struct pfioc_table *io"
668 Replace the content of a table by a new address list.
669 This is the most complicated command, which uses all the structure members.
673 contains the table ID and
675 must point to an array of
679 elements which become the new contents of the table.
682 .Vt struct pfr_addr .
686 .Va pfrio_buffer[pfrio_size..pfrio_size2]
687 must be a writeable buffer, into which the kernel can copy the
688 addresses that have been deleted during the replace operation.
694 contain the number of addresses deleted, added, and changed by the
700 will point to the size of the buffer used, exactly like
702 .It Dv DIOCRGETADDRS Fa "struct pfioc_table *io"
703 Get all the addresses of a table.
706 contains the table ID and
707 .Va pfrio_buffer[pfrio_size]
708 contains a valid writeable buffer for
713 contains the number of addresses written into the buffer.
714 If the buffer was too small, the kernel does not store anything but just
715 returns the required buffer size, without returning an error.
716 .It Dv DIOCRGETASTATS Fa "struct pfioc_table *io"
719 but is used to get an array of
724 struct pfr_addr pfras_a;
725 u_int64_t pfras_packets
726 [PFR_DIR_MAX][PFR_OP_ADDR_MAX];
727 u_int64_t pfras_bytes
728 [PFR_DIR_MAX][PFR_OP_ADDR_MAX];
732 .It Dv DIOCRCLRASTATS Fa "struct pfioc_table *io"
733 Clear the statistics of one or more addresses.
736 contains the table ID and
738 must point to an array of
742 elements to be cleared from the table.
745 .Vt struct pfr_addr .
748 contains the number of addresses effectively cleared.
749 .It Dv DIOCRTSTADDRS Fa "struct pfioc_table *io"
750 Test if the given addresses match a table.
753 contains the table ID and
755 must point to an array of
759 elements, each of which will be tested for a match in the table.
762 .Vt struct pfr_addr .
763 On exit, the kernel updates the
767 member appropriately.
768 .It Dv DIOCRSETTFLAGS Fa "struct pfioc_table *io"
772 .Dv PFR_TFLAG_PERSIST
776 must point to an array of
783 .Vt struct pfr_table .
785 must contain the flags to add, while
787 must contain the flags to remove.
792 contain the number of tables altered or deleted by the kernel.
793 Yes, tables can be deleted if one removes the
794 .Dv PFR_TFLAG_PERSIST
795 flag of an unreferenced table.
796 .It Dv DIOCRINADEFINE Fa "struct pfioc_table *io"
797 Defines a table in the inactive set.
800 contains the table ID and
801 .Va pfrio_buffer[pfrio_size]
804 structures to put in the table.
805 A valid ticket must also be supplied to
809 contains 0 if the table was already defined in the inactive list
810 or 1 if a new table has been created.
812 contains the number of addresses effectively put in the table.
813 .It Dv DIOCXBEGIN Fa "struct pfioc_trans *io"
816 int size; /* number of elements */
817 int esize; /* size of each element in bytes */
818 struct pfioc_trans_e {
820 char anchor[MAXPATHLEN];
826 Clear all the inactive rulesets specified in the
829 For each ruleset, a ticket is returned for subsequent "add rule" ioctls,
836 Ruleset types, identified by
838 include the following:
840 .Bl -tag -width PF_RULESET_FILTER -offset ind -compact
841 .It Dv PF_RULESET_SCRUB
842 Scrub (packet normalization) rules.
843 .It Dv PF_RULESET_FILTER
845 .It Dv PF_RULESET_NAT
846 NAT (Network Address Translation) rules.
847 .It Dv PF_RULESET_BINAT
848 Bidirectional NAT rules.
849 .It Dv PF_RULESET_RDR
851 .It Dv PF_RULESET_ALTQ
853 .It Dv PF_RULESET_TABLE
856 .It Dv DIOCXCOMMIT Fa "struct pfioc_trans *io"
857 Atomically switch a vector of inactive rulesets to the active rulesets.
858 This call is implemented as a standard two-phase commit, which will either
859 fail for all rulesets or completely succeed.
860 All tickets need to be valid.
863 if another process is concurrently updating some of the same rulesets.
864 .It Dv DIOCXROLLBACK Fa "struct pfioc_trans *io"
865 Clean up the kernel by undoing all changes that have taken place on the
866 inactive rulesets since the last
869 will silently ignore rulesets for which the ticket is invalid.
870 .It Dv DIOCSETHOSTID Fa "u_int32_t *hostid"
871 Set the host ID, which is used by
873 to identify which host created state table entries.
875 Flush the passive OS fingerprint table.
876 .It Dv DIOCOSFPADD Fa "struct pf_osfp_ioctl *io"
878 struct pf_osfp_ioctl {
879 struct pf_osfp_entry {
880 SLIST_ENTRY(pf_osfp_entry) fp_entry;
882 char fp_class_nm[PF_OSFP_LEN];
883 char fp_version_nm[PF_OSFP_LEN];
884 char fp_subtype_nm[PF_OSFP_LEN];
886 pf_tcpopts_t fp_tcpopts;
898 Add a passive OS fingerprint to the table.
901 to the packed fingerprint,
902 .Va fp_os.fp_class_nm
903 to the name of the class (Linux, Windows, etc),
904 .Va fp_os.fp_version_nm
905 to the name of the version (NT, 95, 98), and
906 .Va fp_os.fp_subtype_nm
907 to the name of the subtype or patchlevel.
916 are set to the TCP MSS, the TCP window size, the IP length, the IP TTL,
917 the number of TCP options, and the TCP window scaling constant of the
918 TCP SYN packet, respectively.
922 member is filled according to the
929 member contains packed TCP options.
931 .Dv PF_OSFP_TCPOPT_BITS
932 bits in the packed value.
933 Options include any of
934 .Dv PF_OSFP_TCPOPT_NOP ,
935 .Dv PF_OSFP_TCPOPT_SACK ,
936 .Dv PF_OSFP_TCPOPT_WSCALE ,
937 .Dv PF_OSFP_TCPOPT_MSS ,
939 .Dv PF_OSFP_TCPOPT_TS .
943 member is not used with this ioctl.
945 The structure's slack space must be zeroed for correct operation;
947 the whole structure to zero before filling and sending to the kernel.
948 .It Dv DIOCOSFPGET Fa "struct pf_osfp_ioctl *io"
949 Get the passive OS fingerprint number
951 from the kernel's fingerprint list.
952 The rest of the structure members will come back filled.
953 Get the whole list by repeatedly incrementing the
955 number until the ioctl returns
957 .It Dv DIOCGETSRCNODES Fa "struct pfioc_src_nodes *psn"
959 struct pfioc_src_nodes {
963 struct pf_src_node *psu_src_nodes;
965 #define psn_buf psn_u.psu_buf
966 #define psn_src_nodes psn_u.psu_src_nodes
970 Get the list of source nodes kept by sticky addresses and source
972 The ioctl must be called once with
975 If the ioctl returns without error,
977 will be set to the size of the buffer required to hold all the
979 structures held in the table.
980 A buffer of this size should then be allocated, and a pointer to this buffer
983 The ioctl must then be called again to fill this buffer with the actual
987 will be set to the length of the buffer actually used.
988 .It Dv DIOCCLRSRCNODES
989 Clear the tree of source tracking nodes.
990 .It Dv DIOCIGETIFACES Fa "struct pfioc_iface *io"
991 Get the list of interfaces and interface drivers known to
993 All the ioctls that manipulate interfaces
994 use the same structure described below:
997 char pfiio_name[IFNAMSIZ];
1008 can be used to restrict the search to a specific interface or driver.
1009 .Va pfiio_buffer[pfiio_size]
1010 is the user-supplied buffer for returning the data.
1013 contains the number of
1015 entries that can fit into the buffer.
1016 The kernel will replace this value by the real number of entries it wants
1020 .Li sizeof(struct pfi_kif) .
1022 The data is returned in the
1024 structure described below:
1027 RB_ENTRY(pfi_kif) pfik_tree;
1028 char pfik_name[IFNAMSIZ];
1029 u_int64_t pfik_packets[2][2][2];
1030 u_int64_t pfik_bytes[2][2][2];
1031 u_int32_t pfik_tzero;
1033 struct pf_state_tree_lan_ext pfik_lan_ext;
1034 struct pf_state_tree_ext_gwy pfik_ext_gwy;
1035 TAILQ_ENTRY(pfi_kif) pfik_w_states;
1036 void *pfik_ah_cookie;
1037 struct ifnet *pfik_ifp;
1038 struct ifg_group *pfik_group;
1041 TAILQ_HEAD(, pfi_dynaddr) pfik_dynaddrs;
1044 .It Dv DIOCSETIFFLAG Fa "struct pfioc_iface *io"
1045 Set the user setable flags (described above) of the
1047 internal interface description.
1048 The filtering process is the same as for
1049 .Dv DIOCIGETIFACES .
1051 #define PFI_IFLAG_SKIP 0x0100 /* skip filtering on interface */
1053 .It Dv DIOCCLRIFFLAG Fa "struct pfioc_iface *io"
1056 above but clears the flags.
1059 .Bl -tag -width /dev/pf -compact
1061 packet filtering device.
1064 The following example demonstrates how to use the
1066 command to find the internal host/port of a NATed connection:
1068 #include \*[Lt]sys/types.h\*[Gt]
1069 #include \*[Lt]sys/socket.h\*[Gt]
1070 #include \*[Lt]sys/ioctl.h\*[Gt]
1071 #include \*[Lt]sys/fcntl.h\*[Gt]
1072 #include \*[Lt]net/if.h\*[Gt]
1073 #include \*[Lt]netinet/in.h\*[Gt]
1074 #include \*[Lt]net/pfvar.h\*[Gt]
1075 #include \*[Lt]err.h\*[Gt]
1076 #include \*[Lt]stdio.h\*[Gt]
1077 #include \*[Lt]stdlib.h\*[Gt]
1080 read_address(const char *s)
1084 sscanf(s, "%i.%i.%i.%i", \*[Am]a, \*[Am]b, \*[Am]c, \*[Am]d);
1085 return htonl(a \*[Lt]\*[Lt] 24 | b \*[Lt]\*[Lt] 16 | c \*[Lt]\*[Lt] 8 | d);
1089 print_address(u_int32_t a)
1092 printf("%d.%d.%d.%d", a \*[Gt]\*[Gt] 24 \*[Am] 255, a \*[Gt]\*[Gt] 16 \*[Am] 255,
1093 a \*[Gt]\*[Gt] 8 \*[Am] 255, a \*[Am] 255);
1097 main(int argc, char *argv[])
1099 struct pfioc_natlook nl;
1103 printf("%s \*[Lt]gwy addr\*[Gt] \*[Lt]gwy port\*[Gt] \*[Lt]ext addr\*[Gt] \*[Lt]ext port\*[Gt]\\n",
1108 dev = open("/dev/pf", O_RDWR);
1110 err(1, "open(\\"/dev/pf\\") failed");
1112 memset(\*[Am]nl, 0, sizeof(struct pfioc_natlook));
1113 nl.saddr.v4.s_addr = read_address(argv[1]);
1114 nl.sport = htons(atoi(argv[2]));
1115 nl.daddr.v4.s_addr = read_address(argv[3]);
1116 nl.dport = htons(atoi(argv[4]));
1118 nl.proto = IPPROTO_TCP;
1119 nl.direction = PF_IN;
1121 if (ioctl(dev, DIOCNATLOOK, \*[Am]nl))
1122 err(1, "DIOCNATLOOK");
1124 printf("internal host ");
1125 print_address(nl.rsaddr.v4.s_addr);
1126 printf(":%u\\n", ntohs(nl.rsport));
1140 packet filtering mechanism first appeared in
1143 The following functionality is missing from
1147 .Bl -bullet -offset indent
1151 keyword is not supported.