Some implementation problems about IPsec



Dear all:

I am tracing the codes for the implementation for IPsec recently. I have two problems here about the implementation:

1. In ip6_input.c, before handing the packet to the next protocol handler after processing of IPv6 headers,

#ifdef IPSEC
/*
* enforce IPsec policy checking if we are seeing last header.
* note that we do not visit this with protocols with pcb layer
* code - like udp/tcp/raw ip.
*/
if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0 &&
ipsec6_in_reject(m, NULL)) {
ipsec6stat.in_polvio++;
goto bad;
}
#endif

Why needs to do ipsec6_in_reject() here for some specific "LASTHDER" protocols, such as icmp? Why not all the packets need the check?

2. What is the real meaning for the flags M_AUTHIPHDR, M_AUTHIPDGM, and M_DECRYPTED? At the beginning, I thought the mbuf carrying either one of the flags would represent it had processed by IPsec stack. However, in KAME implementation, ah_input and ah6_input will unset the flag after an AH tunneled packet has been passed the authentication. While ESP is the case, once M_DECRYPTED flag is set, it would never be unset. On the other hand, in FAST_IPSEC, which is another different IPsec implementation on FreeBSD, the flags are never unset, and also another flag named M_IPSEC is defined as M_AUTHIPHDR | M_AUTHIPDGM | M_DECRYPTED. I am confused by the inconsistent usage.....

Many Thanks.

Susan
_______________________________________________
freebsd-net@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: wierdness in ipsec
    ... So mebbe one of the TCP ... > I'm running ipsec with some manual setkey statments. ... > A# telnet B 80 ...
    (FreeBSD-Security)
  • Re: best encryption + mode for network packets ?
    ... > I don't understand much about all the different encryption modes... ... The IPSEC design deals with many issues ... that the chaining modes typically require an unpredictable but non-secret ... start of the packet they've just received, ...
    (sci.crypt)
  • enc0 patch for ipsec
    ... This is a device to expose packets going in/out of ipsec and comes ... and handoff to pfilfor packet filtering. ... the extra work is only done when the enc0 interface is created. ...
    (freebsd-arch)
  • enc0 patch for ipsec
    ... This is a device to expose packets going in/out of ipsec and comes ... and handoff to pfilfor packet filtering. ... the extra work is only done when the enc0 interface is created. ...
    (freebsd-net)
  • [patch] Path MTU Discovery when routing over IPSec connections
    ... I have been looking into some problems with PMTU Discovery when routing packets over IPSec tunnels, I have submitted the details to the open PR kern/91412 but have had no response as to whether my patch is the correct solution to the problem. ... Triggered when a packet that is to be routed over the IPSec link is larger than the MTU on the link and has the Don't Fragment bit set. ... Vr HL TOS Len ID Flg off TTL Pro cks Src Dst ...
    (freebsd-hackers)