FreeBSD/sys/netipsec/key.c
/*
 * get PFKEY message length for security policy and request.
 */
get PFKEY message length for security policy and request.
get PFKEY message length for security policy and request .
static u_int
key_getspreqmsglen(struct secpolicy *sp)
{
	u_int tlen;
	tlen = sizeof(struct sadb_x_policy);
	if (sp->policy != IPSEC_POLICY_IPSEC)
		return tlen;
    {
	struct ipsecrequest *isr;
	int len;
	for (isr = sp->req; isr != NULL; isr = isr->next) {
		len = sizeof(struct sadb_x_ipsecrequest)
			+ isr->saidx.src.sa.sa_len
			+ isr->saidx.dst.sa.sa_len;
		tlen += PFKEY_ALIGN8(len);
	}
    }
	return tlen;
}
static u_int key_getspreqmsglen ( struct secpolicy * sp ) { u_int tlen ; tlen = sizeof ( struct sadb_x_policy ) ; if ( sp -> policy != IPSEC_POLICY_IPSEC ) return tlen ; { struct ipsecrequest * isr ; int len ; for ( isr = sp -> req ; isr != NULL ; isr = isr -> next ) { len = sizeof ( struct sadb_x_ipsecrequest ) + isr -> saidx . src . sa . sa_len + isr -> saidx . dst . sa . sa_len ; tlen += PFKEY_ALIGN8 ( len ) ; } } return tlen ; }
get PFKEY message length for security policy and request.
get PFKEY message length for security policy and request .
/* if is the policy for ipsec ? */ /* get length of ipsec requests */