generates an IPsec policy specification structure, namely

and/or

from a human-readable policy specification. The policy specification must be given as a C string

and its length

will return a buffer with the corresponding IPsec policy specification structure. The buffer is dynamically allocated, and must be

by the caller.

You can get the length of the generated buffer with

(i.e. for calling

converts an IPsec policy structure into human-readable form. Therefore,

can be regarded as the inverse function to

points to an IPsec policy structure,

is a delimiter string, which is usually a blank character. If you set

to

a single whitespace is assumed.

returns a pointer to a dynamically allocated string. It is the caller's responsibility to

it.

is formatted as either of the following:

must be

or

specifies in which direction the policy needs to be applied. The non-standard direction

is substituted with

on platforms which do not support forward policies.

is used to control the placement of the policy within the SPD. The policy position is determined by a signed integer where higher priorities indicate the policy is placed closer to the beginning of the list and lower priorities indicate the policy is placed closer to the end of the list. Policies with equal priorities are added at the end of the group of such policies.

Priority can only be specified when libipsec has been compiled against kernel headers that support policy priorities (Linux *[Gt]= 2.6.6). It takes one of the following formats:

is an integer in the range -2147483647..214783648.

is either

or

is an unsigned integer. It can be up to 1073741824 for positive offsets, and up to 1073741823 for negative offsets.

The interpretation of policy priority in these functions and the kernel DOES differ. The relationship between the two can be described as p(kernel) = 0x80000000 - p(func)

With

policy, packets will be dropped if they match the policy.

means to consult the SPD defined by

means to bypass the IPsec processing.

This is for privileged sockets.

means that the matching packets are subject to IPsec processing.

can be followed by one or more

strings, which are formatted as below:

is either

or

is either

or

and

specifies the IPsec endpoint.

always means the

and

always means the

Therefore, when

is

is this node and

is the other node

If

is

Both

and

can be omitted.

must be set to one of the following:

or

means that the kernel should consult the system default policy defined by

such as

See

regarding the system default.

means that a relevant SA can be used when available, since the kernel may perform IPsec operation against packets when possible. In this case, packets can be transmitted in clear

or encrypted

means that a relevant SA is required, since the kernel must perform IPsec operation against packets.

is the same as

but adds the restriction that the SA for outbound traffic is used only for this policy. You may need the identifier in order to relate the policy and the SA when you define the SA by manual keying. You can put the decimal number as the identifier after

like

must be between 1 and 32767 . If the

string is kept unambiguous,

and slash prior to

can be omitted. However, it is encouraged to specify them explicitly to avoid unintended behavior. If

is omitted, it will be interpreted as

Note that there are slight differences to the specification of

In the specification of

both

and

are not used. Refer to

for details.

Here are several examples

in discard out ipsec esp/transport//require in ipsec ah/transport//require out ipsec esp/tunnel/10.1.1.2-10.1.1.1/use in ipsec ipcomp/transport//use   esp/transport//use

returns a pointer to the allocated buffer with the policy specification if successful; otherwise a

pointer is returned.

returns a positive value

on success, and a negative value on errors.

returns a pointer to a dynamically allocated region on success, and

on errors.

The functions first appeared in the WIDE/KAME IPv6 protocol stack kit.

This HTML page was made with roffit.