[PATCH] Add IP_MINTTL socket option

Matthew Dillon dillon at apollo.backplane.com
Mon Apr 2 10:26:53 PDT 2007


    Looks good, except the conditionals need to be rearranged a bit to make
    them more readable and there is also no need to check for 0.  For
    example:

	if (last && last->inp_ip_minttl && last->inp_ip_minttl > ip->ip_ttl) {

    Can just be:

	if (last && ip->ip_ttl < last->inp_ip_minttl) {


    The code logic in raw_ip.c doesn't look quite right.  I think you are
    missing an 'else' clause:

        } else
 #endif /*FAST_IPSEC*/
+       /* Check the minimum TTL for socket. */
+       if (last && last->inp_ip_minttl && last->inp_ip_minttl > ip->ip_ttl) {
+               m_freem(opts);
+               ipstat.ips_delivered--;
+       }
+
	^^^^^^ needs an else clause to chain into the unmodified code that
	       occurs afterwords?
	if (last) {



						-Matt





More information about the Submit mailing list