On Sun, 2006-10-15 at 22:47 -0400, Dan McDonald wrote:
> This is a reminder that code review comments for the IPsec Tunnel Reform
> project are due by 11:59pm US/Pacific on Thursday, September 19th (aka 07:59
> GMT Friday Sept. 20th).
> 
> URLs are (in order of preference):
> 
> EXTERNAL (usr/src only) against Build 50:
> 
>       http://cr.grommit.com/~danmcd/tref.snv_50/

A few days late, but here are my comments.  I can't wait to mind-meld
with Dan to merge this into the clearview_iptun gate. :-)

usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c

* 3030: Would it be more clear to explicitly state "ipsecconf -l -i <bla>"
  here to help people figure out which usage of ipsecconf will give them
  what they want?


usr/src/cmd/cmd-inet/usr.sbin/ipsecconf.c.

* 1453: Why not?  Wouldn't it make sense to be able to type "ipsecconf -i
  punchin0" and see the policy associated with that tunnel?

* 2760: The man page in PSARC/2005/516 states that "-i" can be used with -d,
  -f, and -l, but this usage only includes -i with -f and -l.


usr/src/uts/common/inet/ip/ip.c

* 6285: Tunnels aren't the only things that can be bound to IPPROTO_ENCAP
  and IPPROTO_IPV6.  If a raw socket bound to one of those protocols uses
  per-socket policy, where is its policy going to be enforced?

  Luckily, with Clearview's iptun, the upper layer protocol isn't the way
  that a tunnel conn_t is differentiated.  There is a specific flag that
  associates a conn_t as a tunnel conn_t.  Before Clearview, perhaps the
  same approach should be taken to special-case tunnels.  FYI, there's
  already an IPCL_IS_IPTUN() macro that you can use and change how you see
  fit.

* 6357: Same raw socket issue here.  I don't think "one_only" is the right
  way to identify a tunnel client.  In addition to that, I don't believe
  that the semantics of "one_only" are correct even for tunnel clients (but
  that's not really a comment for this code-review).

* 6374: How could protocol be IPPROTO_ENCAP or IPPROTO_IPV6 if you're
  expecting to return at 6367 in those cases?

* 9971: This comment is strange in this context, as there's nothing tunnel
  specific in the following block of code.  Maybe it would be clearer if you
  just stated that this function isn't used at all for tunnel conn_t's.

* 17071: I take it that this is the fix for 6351840.  It might help to add a
  comment explaining why this function is the correct one to call for
  re-processing of this packet.  I don't think anyone really understands the
  subtle differences between ip_fanout_proto(), ip_proto_input(), and
  ip_fanout_proto_again().

* 25585: What is the XXX for?


usr/src/uts/common/inet/ip/ip6.c

* 3360: Similarly to ip.c, using the protocol number to assert that a given
  packet is destined to the tun module is going to leave some raw sockets
  without inbound policy checks.  Similar comment for 3431 and 3447.

* 4170: Since the function's purpose is to note the location of extension
  headers, this comment is somewhat misleading.  The new code does not skip
  the fragment header, it notes the location of the header, just like all
  other headers in this function.


usr/src/uts/common/inet/ip/ip_if.c

* This file can be "wx reset"'ed, right?


usr/src/uts/common/inet/ip/ipsecah.c

* 584: Move this out of the switch statement and remove M_CTL altogether
  from the switch.

* 1143,1144: cstyle, indent by 4 spaces.


usr/src/uts/common/inet/ip/ipsecesp.c

* 2412: Move this out of the switch statement and remove M_CTL altogether
  from the switch.


usr/src/uts/common/inet/ip/spd.c

* 96: Indent by 4

* 132: What is tunnel_policy_gen?  Can a comment explain this?  It appears
  to be some sort of counter.

* 155: size_t

* 225: Please no "#if 0".  Custom Dtrace probes would be much better than
  this.  They don't add any overhead if not used, and you wouldn't need to
  recompile spd.c to enable them...

* 923: It would be simpler for callers if you exported two functions,
  iph_has_ipv6() and iph_has_ipv4().  You could have one generic routine
  under the hood, but it would simplify the function signature for the
  callers, and it would be easier to wrap my head around (the negative
  return value is confusing).  If you don't like the separate functions,
  then at least reverse the polarity on the return value for this function.

* 5493: Comment missing.  What does this function do?

* 5515: I don't like this hack.  Add an argument if you must.


usr/src/uts/common/inet/ip/tun.c

* 264: Need a comment explaining the mechanism here.

* 337: Need a comment explaining why we need to do this (either here or in
  spd.c).  Part of me thinks tha having a separate tunnel policy table in
  spd.c might be worth it.  That way, when you lookup policy by address, you
  don't need to worry about tun being loaded or not.  There are either
  policy entries or there aren't.  It's possible that this has its downsides
  as well; have you considered it?  Another alternative would be a modstub,
  but I'm guessing there's a reason why you didn't write it this way...

* 390: It's not possible to create a tunnel from within a non-global zone.
  What is this for?

* 484: Don't need the brackets.

* 794: No caller ever passes in a non-NULL "target".  What is its purpose?

* 813: Rename "target" to "bytecount" or something more meaningful.

* 830: I don't understand the note.  Why is this sleazy mechanism needed?
  What is tun_itp_gen (there's no comment in tun.h)?  Is there no way to
  atomically set tunnel policy on a given tunnel from the PF_POLICY code
  paths?

* 845: This function is actually not called directly.  Please update the
  comment.  There's also a reason why this function isn't in modstubs,
  presumably because you don't want tun to get loaded everytime someone does
  a lookup for non-existent policy.  If that's the case, why would that be a
  bad thing?

* 865,922: All 6to4 and automatic tunnels end up in the same hash bucket
  (they have an unspecified destination address).  For what it's worth the
  new Clearview tunnel fanout hashes based on the xor of all 32 bit chunks
  of both src and dst.

* 916,1069: These are add/remove functions for the same list right?  Please
  move them together and name them to make that obvious.

* 938: What may change?  What technology would result in tunnels being
  created on the fly?  I'd remove this comment, I'm not sure it's very
  useful.

* 1029: What does the comment about letting it slide mean?  Let what slide?

* 1031: Why do we check for an uninitialized name here?

* 1032: Please add {}.

* 1033: Why is it appropriate to try and set the policy pointer here, as
  opposed to somewhere else.  It seems strange to me that this is the only
  non-stat-related tun_t member being initialized here.

* 1573: This function isn't referenced anywhere.

* 1816: I'm not sure I understand the bit about the version number, although
  this isn't something you changed.

* 1963: What is the significance of the call to tun_thisvers_policy()?  I
  ask because in the very near future (for Clearview) a single tunnel
  data-link serves multiple upper protocols, and this call will no longer
  make sense.

* 1966: What is the tun_policy_index comparison accomplishing here?  I think
  I understand that the block starting at 1968 only applies to the simple
  pre tref policy, but I don't understand how this check gets us there.
  Probably means there's a missing comment or macro.

* 2128: I think this comment needs a bit more detail.  Correct me if I'm
  wrong: Tunnel policy may have been configured via ipsecconf prior to the
  creation of the tunnel.  After a tunnel has been created, we need to find
  out if such policy is lying in wait for this tunnel.  We can't do that
  until we know the name of the tunnel, as ipsecconf associates tunnel
  policy using the tunnel name.

* 2770,4545: Is this a bug fix?  Why only update when the overhead
  increases?

* 2966,3104: I'm not sure that "+ 8" captures all cases.  What if the inner
  IPv4 header has options?  What if the inner IPv6 header is followed by
  extension headers?  Is getting the transport header into the first mblk
  crucial to the policy checks, or is it just an optimization?

* 2967: pullupmsg() is deprecated in favor of msgpullup().

* 2985,3012,3124,3151: Why does every incoming packet go through
  ipsec_tun_inbound()?  Is there a way to optimize this for tunnels that
  have no policy associated with them?

* 3045: Each individual packet needs to be accounted for, including
  fragments.

* 3240,3253,3272,3298,3332,3356: yes, each packet in the chain needs to be
  accounted for.

* 3450: There should probably be an IPv4(2) in there.

* 3464: This comment doesn't seem to make complete sense given the assert at
  3461.

* 4471: Are we guaranteed that the bits in an incoming ICMP error won't
  every accidentally be such that this ends up being true?

* 4492: Looking forward to yanking this out with Clearview.  I have no idea
  what "this" is referring to.

* 4715,4841,4997,5383: Is there a way to optimize this for tunnels that have
  no policy associated with them?


usr/src/uts/common/inet/ipsec_impl.h

* 723,724: These aren't use anywhere.


usr/src/uts/common/inet/tun.h

* 139: It would help to add a comment to state which list this is for.

* 148: What does "Line of defense..." mean?

* 224: This isn't used anywhere.

* 256: This doesn't exist.

* 256-259: These belong in ipsec_impl.h or some other IPsec header file.

Thanks!
-Seb


_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to