|
Each message has a behavior. A behavior is defined as where the initial
message travels, for example, user to kernel, and what subsequent actions
are expected to take place. Contents of messages are illustrated as:
|
<base, REQUIRED EXTENSION, REQ., (OPTIONAL EXTENSION), (OPT)>
|
The SA extension is sometimes used only for its SPI field. If all other fields must be ignored, this is represented
by SA(*).
The lifetime extensions are represented with one to three letters after
the word lifetime, representing (H)ARD, (S)OFT, and (C)URRENT.
The address extensions are represented with one to three letters after
the word "address," representing (S)RC, (D)ST, (P)ROXY.
Note that when an error occurs, only the base header is sent. Typical
errors include:
-
EINVAL
- Various
message improprieties, including SPI ranges that are malformed,
weak keys, and others. If EINVAL is returned, an application should look at
the sadb_x_msg_diagnostic field of the sadb_msg
structure. It contains one of many possible causes for EINVAL. See net/pfkeyv2.h for values, all of the form SADB_X_DIAGNOSTIC_.
-
ENOMEM
- Needed
memory was not available.
-
ENSGSIZ
- Message exceeds the maximum length allowed.
-
EEXIST
-
SA (that is being added or created with GETSPI)
already exists.
-
ESRCH
-
SA could not be found.
The following are examples of message use and behavior:
SADB_GETSPI
Send a SADB_GETSPI message from a user process to
the kernel.
|
<base, address, SPI range>
|
The kernel returns the SADB_GETSPI message to all
listening processes.
|
<base, SA(*), address (SD)>
|
SADB_UPDATE
Send a SADB_UPDATE message from a user process to
the kernel.
|
<base, SA, (lifetime(HS),) address(SD), (address(P), key (AE),
(identity(SD),) (sensitivity)>c
|
The kernel returns the SADB_UPDATE message to all
listening processes.
|
<base, SA(*), address (SD)>
|
SADB_ADD
Send a SADB_ADD message from a user process to the
kernel.
|
<base, SA, (lifetime(HS),) address(SD), (address(P),) key (AE),
(identity(SD),) (sensitivity)>
|
The kernel returns the SADB_ADD message to all listening
processes.
|
<base, SA, (lifetime(HS),) address (SD),
(identity (SD),) (sensitivity)>
|
SADB_DELETE
Send a SADB_DELETE message from a user process to
the kernel.
|
<base, SA (*), address (SD)>
|
The kernel returns the SADB_DELETE message to all
listening processes.
|
<base, SA (*), address (SD)>
|
SADB_GET
Send a SADB_GET message from a user process to the
kernel.
|
<base, SA (*), address (SD)>
|
The kernel returns the SADB_GET message to the socket
that sent the SADB_GET message.
|
<base, SA , (lifetime (HSC),) address SD), (address (P),) key (AE),
(identity (SD),) (sensitivity)>
|
SADB_ACQUIRE
The kernel sends a SADB_ACQUIRE message to registered
sockets. Note that any GETSPI, ADD,
or UPDATE calls in reaction to an ACQUIRE
must fill in the sadb_msg_seq of those messages with the
one in the ACQUIRE message. The address (SD)
extensions must have the port fields filled in with the port numbers of the
session requiring keys if appropriate.
|
<base, address (SD), (address(P)), (identity(SD),)
(sensitivity,) proposal>
|
Extended ACQUIRE will have a slightly different format. The sadb_msg_satype field is 0, and the extension contains the desired
combination(s) of security protocols.
|
<base, address (SD), (address(P)), (identity(SD),)
(sensitivity,) eprop>
|
If key management fails, send an SADB_ACQUIRE to
indicate failure.
SADB_X_INVERSE_ACQUIRE
For inbound Key Management processing, a Key Management application
may wish to consult the kernel for its policy. The application should send
to the kernel:
The kernel returns a message similar to a kernel-generated extended
ACQUIRE:
|
<base, address (SD), (address(P)), (identity(SD),)
(sensitivity,) eprop>
|
SADB_REGISTER
Send a SADB_REGISTER message from a user process
to the kernel.
The kernel returns the SADB_REGISTER message to registered
sockets, with algorithm types supported by the kernel being indicated in the
supported algorithms field. Note that this message may arrive asynchronously
due to an algorithm being loaded or unloaded into a dynamically linked kernel.
There is also the extended REGISTER, which will allow this process to
receive extended ACQUIREs.
Which returns a series of SADB_REGISTER replies (one for each security
protocol registered) from the kernel.
SADB_EXPIRE
The kernel sends a SADB_EXPIRE message to all listeners
when the soft lmit of a security association has been expired.
|
<base, SA, lifetime (C and one of HS), address (SD)>
|
SADB_FLUSH
Send a SADB_FLUSH message from a user process to
the kernel.
The kernel returns the SADB_FLUSH message to all
listening sockets.
SADB_DUMP
Send a SADB_DUMP message from a user process to the
kernel.
Several SADB_DUMP messages will return from the kernel
to the sending socket.
|
<base, SA, (lifetime (HSC),) address (SD), (address (P),) key (AE),
(identity (SD),) sensitivity)>
|
To mark the end of a dump a single base header arrives with its sadb_mdg_seq set to 0.
SADB_X_PROMISC
Send a SADB_X_PROMISC message from a user process
to the kernel.
The kernel returns the SADB_X_PROMISC message to
all listening processes.
|