• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/src/router/iputils/racoon/

Lines Matching refs:isakmp

1 /*	$KAME: isakmp.c,v 1.172 2002/01/02 09:06:53 jinmei Exp $	*/
75 #include "isakmp.h"
148 * isakmp packet handler
154 struct isakmp isakmp;
165 while ((len = recvfromto(so_isakmp, (char *)&isakmp, sizeof(isakmp),
171 "failed to receive isakmp packet\n");
175 /* check isakmp header length */
176 if (len < sizeof(isakmp)) {
178 "packet shorter than isakmp header size.\n");
180 if ((len = recvfrom(so_isakmp, (char *)&isakmp, sizeof(isakmp),
183 "failed to receive isakmp packet\n");
189 if ((buf = vmalloc(ntohl(isakmp.len))) == NULL) {
193 if ((len = recvfrom(so_isakmp, (char *)&isakmp, sizeof(isakmp),
196 "failed to receive isakmp packet\n");
207 "failed to receive isakmp packet\n");
256 /* isakmp main routine */
270 * main processing to handle isakmp payload
277 struct isakmp *isakmp = (struct isakmp *)msg->v;
278 isakmp_index *index = (isakmp_index *)isakmp;
279 u_int32_t msgid = isakmp->msgid;
287 if (memcmp(&isakmp->i_ck, r_ck0, sizeof(cookie_t)) == 0) {
294 if (isakmp->v < ISAKMP_VERSION_NUMBER) {
295 if (ISAKMP_GETMAJORV(isakmp->v) < ISAKMP_MAJOR_VERSION) {
298 ISAKMP_GETMAJORV(isakmp->v));
302 if (ISAKMP_GETMINORV(isakmp->v) < ISAKMP_MINOR_VERSION) {
305 ISAKMP_GETMINORV(isakmp->v));
312 if (isakmp->flags & ~(ISAKMP_FLAG_E | ISAKMP_FLAG_C | ISAKMP_FLAG_A)) {
314 "invalid flag 0x%02x.\n", isakmp->flags);
319 if (ISSET(isakmp->flags, ISAKMP_FLAG_C)) {
320 if (isakmp->msgid == 0) {
321 isakmp_info_send_nx(isakmp, remote, local,
332 if (memcmp(&isakmp->r_ck, r_ck0, sizeof(cookie_t)) == 0 &&
361 switch (isakmp->etype) {
366 if (isakmp->msgid != 0) {
372 /* search for isakmp status record of phase 1 */
383 if (memcmp(&isakmp->r_ck, r_ck0,
394 isakmp->etype) < 0)
416 if (iph1->etype != isakmp->etype) {
421 s_isakmp_etype(isakmp->etype));
438 isakmp->etype);
475 isakmp_info_send_nx(isakmp, remote, local,
480 isakmp_pindex((isakmp_index *)&isakmp->i_ck,
481 isakmp->msgid));
494 /* search isakmp phase 2 stauts record. */
505 if (ISSET(isakmp->flags, ISAKMP_FLAG_C))
534 isakmp->etype, saddr2str(remote));
652 struct isakmp *isakmp = (struct isakmp *)msg->v;
668 if (ph2exchange[etypesw2(isakmp->etype)]
675 error = (ph2exchange[etypesw2(isakmp->etype)]
706 if ((ph2exchange[etypesw2(isakmp->etype)]
736 /* get new entry to isakmp status table. */
808 struct isakmp *isakmp = (struct isakmp *)msg->v;
833 /* get new entry to isakmp status table. */
838 memcpy(&iph1->index.i_ck, &isakmp->i_ck, sizeof(iph1->index.i_ck));
844 iph1->version = isakmp->v;
919 /* found isakmp-sa */
941 struct isakmp *isakmp = (struct isakmp *)msg->v;
958 iph2->flags = isakmp->flags;
959 iph2->msgid = isakmp->msgid;
1008 /* add new entry to isakmp status table */
1047 if ((ph2exchange[etypesw2(isakmp->etype)]
1158 struct isakmp *isakmp = (struct isakmp *)buf->v;
1164 np = isakmp->np;
1165 gen = (struct isakmp_gen *)(buf->v + sizeof(*isakmp));
1166 tlen = buf->l - sizeof(struct isakmp);
1176 /* initialize a isakmp status table */
1338 "%s used as isakmp port (fd=%d)\n",
1653 /* search isakmp status table by address with masking port */
1776 /* found isakmp-sa */
1782 /* no isakmp-sa found */
2023 * set values into allocated buffer of isakmp header for phase 1
2031 struct isakmp *isakmp;
2033 if (vbuf->l < sizeof(*isakmp))
2036 isakmp = (struct isakmp *)vbuf->v;
2037 memcpy(&isakmp->i_ck, &iph1->index.i_ck, sizeof(cookie_t));
2038 memcpy(&isakmp->r_ck, &iph1->index.r_ck, sizeof(cookie_t));
2039 isakmp->np = nptype;
2040 isakmp->v = iph1->version;
2041 isakmp->etype = iph1->etype;
2042 isakmp->flags = iph1->flags;
2043 isakmp->msgid = iph1->msgid;
2044 isakmp->len = htonl(vbuf->l);
2046 return vbuf->v + sizeof(*isakmp);
2050 * set values into allocated buffer of isakmp header for phase 2
2058 struct isakmp *isakmp;
2060 if (vbuf->l < sizeof(*isakmp))
2063 isakmp = (struct isakmp *)vbuf->v;
2064 memcpy(&isakmp->i_ck, &iph2->ph1->index.i_ck, sizeof(cookie_t));
2065 memcpy(&isakmp->r_ck, &iph2->ph1->index.r_ck, sizeof(cookie_t));
2066 isakmp->np = nptype;
2067 isakmp->v = iph2->ph1->version;
2068 isakmp->etype = ISAKMP_ETYPE_QUICK;
2069 isakmp->flags = iph2->flags;
2070 memcpy(&isakmp->msgid, &iph2->msgid, sizeof(isakmp->msgid));
2071 isakmp->len = htonl(vbuf->l);
2073 return vbuf->v + sizeof(*isakmp);
2077 * set values into allocated buffer of isakmp payload.
2132 /* for print-isakmp.c */
2215 struct isakmp *isakmp;
2258 isakmp = (struct isakmp *)buf->v;
2259 if (isakmp->flags & ISAKMP_FLAG_E) {
2260 isakmp->flags &= ~ISAKMP_FLAG_E;