From e2a943b3df55ff67c367713c47ec7a3437c42ef6 Mon Sep 17 00:00:00 2001 From: vanhu Date: Mon, 25 Sep 2006 17:42:08 +0000 Subject: [PATCH] From Yves-Alexis Perez: struct ip -> struct iphdr for Linux --- crypto/dist/ipsec-tools/src/racoon/isakmp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crypto/dist/ipsec-tools/src/racoon/isakmp.c b/crypto/dist/ipsec-tools/src/racoon/isakmp.c index d82571a9606a..23ab3b845598 100644 --- a/crypto/dist/ipsec-tools/src/racoon/isakmp.c +++ b/crypto/dist/ipsec-tools/src/racoon/isakmp.c @@ -1,4 +1,4 @@ -/* $NetBSD: isakmp.c,v 1.16 2006/09/25 05:08:52 manu Exp $ */ +/* $NetBSD: isakmp.c,v 1.17 2006/09/25 17:42:08 vanhu Exp $ */ /* Id: isakmp.c,v 1.74 2006/05/07 21:32:59 manubsd Exp */ @@ -203,7 +203,11 @@ isakmp_handler(so_isakmp) char buf[sizeof (isakmp) + 4]; u_int32_t non_esp[2]; char lbuf[sizeof(struct udphdr) + +#ifdef __linux + sizeof(struct iphdr) + +#else sizeof(struct ip) + +#endif sizeof(isakmp) + 4]; } x; struct sockaddr_storage remote; @@ -242,6 +246,15 @@ isakmp_handler(so_isakmp) /* Lucent IKE in UDP encapsulation */ { struct udphdr *udp; +#ifdef __linux__ + struct iphdr *ip; + + udp = (struct udphdr *)&x.lbuf[0]; + if (ntohs(udp->dest) == 501) { + ip = (struct iphdr *)(x.lbuf + sizeof(*udp)); + extralen += sizeof(*udp) + ip->ihl; + } +#else struct ip *ip; udp = (struct udphdr *)&x.lbuf[0]; @@ -249,6 +262,7 @@ isakmp_handler(so_isakmp) ip = (struct ip *)(x.lbuf + sizeof(*udp)); extralen += sizeof(*udp) + ip->ip_hl; } +#endif } #ifdef ENABLE_NATT