MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ipsec_init_reqid

Function ipsec_init_reqid

freebsd/net/if_ipsec.c:920–941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918 */
919#define IPSEC_REQID_TRYCNT 64
920static int
921ipsec_init_reqid(struct ipsec_softc *sc)
922{
923 uint32_t reqid;
924 int trycount;
925
926 sx_assert(&ipsec_ioctl_sx, SA_XLOCKED);
927 if (sc->reqid != 0) /* already initialized */
928 return (0);
929
930 trycount = IPSEC_REQID_TRYCNT;
931 while (--trycount > 0) {
932 reqid = key_newreqid();
933 if (ipsec_check_reqid(reqid) == 0)
934 break;
935 }
936 if (trycount == 0)
937 return (EEXIST);
938 sc->reqid = reqid;
939 CK_LIST_INSERT_HEAD(ipsec_idhash(reqid), sc, idhash);
940 return (0);
941}
942
943/*
944 * Set or update reqid for given tunneling interface.

Callers 2

ipsec_set_reqidFunction · 0.85
ipsec_set_addressesFunction · 0.85

Calls 3

key_newreqidFunction · 0.85
ipsec_check_reqidFunction · 0.85
ipsec_idhashFunction · 0.85

Tested by

no test coverage detected