|
NAMEipnat - Network Address Translation kernel interface SYNOPSIS#include <netinet/ip_compat.h>
IOCTLSTo add and delete rules to the NAT list, two 'basic' ioctls are provided for use. The ioctl's are called as: ioctl(fd, SIOCADNAT, struct ipnat **) ioctl(fd, SIOCRMNAT, struct ipnat **) ioctl(fd, SIOCGNATS, struct natstat **) ioctl(fd, SIOCGNATL, struct natlookup **) Unlike ipf(4), there is only a single list supported by the kernel NAT interface. An inactive list which can be swapped to is not currently supported. These ioctl's are implemented as being routing ioctls and thus the same rules for the various routing ioctls and the file descriptor are employed, mainly being that the fd must be that of the device associated with the module (i.e., /dev/ipl). The structure used with the NAT interface is described below: typedef struct ipnat {
Recognised values for in_redir: #define NAT_MAP 0 #define NAT_REDIRECT 1 NAT statistics Statistics on the number of packets mapped, going in and out are kept, the number of times a new entry is added and deleted (through expiration) to the NAT table and the current usage level of the NAT table. Pointers to the NAT table inside the kernel, as well as to the top of the internal NAT lists constructed with the SIOCADNAT ioctls. The table itself is a hash table of size NAT_SIZE (default size is 367). To retrieve the statistics, the SIOCGNATS ioctl must be used, with the appropriate structure passed by reference, as follows: ioctl(fd, SIOCGNATS, struct natstat *)
typedef struct natstat {
BUGSIt would be nice if there were more flexibility when adding and deleting filter rules. FILES/dev/ipnat SEE ALSOipf(4), ipnat(5), ipf(8), ipnat(8), ipfstat(8)
|