1. 07 12月, 2006 1 次提交
  2. 03 12月, 2006 7 次提交
    • M
      [IPSEC]: Add encapsulation family. · 76b3f055
      Miika Komu 提交于
      Signed-off-by: NMiika Komu <miika@iki.fi>
      Signed-off-by: NDiego Beltrami <Diego.Beltrami@hiit.fi>
      Signed-off-by: NKazunori Miyazawa <miyazawa@linux-ipv6.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      76b3f055
    • A
      [XFRM]: Pack struct xfrm_policy · 46ca5f5d
      Arnaldo Carvalho de Melo 提交于
      [acme@newtoy net-2.6.20]$ pahole net/ipv4/tcp.o xfrm_policy
      /* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/security.h:67 */
      struct xfrm_policy {
              struct xfrm_policy *       next;                 /*     0     4 */
              struct hlist_node          bydst;                /*     4     8 */
              struct hlist_node          byidx;                /*    12     8 */
              rwlock_t                   lock;                 /*    20    36 */
              atomic_t                   refcnt;               /*    56     4 */
              struct timer_list          timer;                /*    60    24 */
              u8                         type;                 /*    84     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              u32                        priority;             /*    88     4 */
              u32                        index;                /*    92     4 */
              struct xfrm_selector       selector;             /*    96    56 */
              struct xfrm_lifetime_cfg   lft;                  /*   152    64 */
              struct xfrm_lifetime_cur   curlft;               /*   216    32 */
              struct dst_entry *         bundles;              /*   248     4 */
              __u16                      family;               /*   252     2 */
              __u8                       action;               /*   254     1 */
              __u8                       flags;                /*   255     1 */
              __u8                       dead;                 /*   256     1 */
              __u8                       xfrm_nr;              /*   257     1 */
      
              /* XXX 2 bytes hole, try to pack */
      
              struct xfrm_sec_ctx *      security;             /*   260     4 */
              struct xfrm_tmpl           xfrm_vec[6];          /*   264   360 */
      }; /* size: 624, sum members: 619, holes: 2, sum holes: 5 */
      
      So lets have just one hole instead of two, by moving 'type' to just before 'action',
      end result:
      
      [acme@newtoy net-2.6.20]$ codiff -s /tmp/tcp.o.before net/ipv4/tcp.o
      /pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/tcp.c:
        struct xfrm_policy |   -4
       1 struct changed
      [acme@newtoy net-2.6.20]$
      
      [acme@newtoy net-2.6.20]$ pahole -c 64 net/ipv4/tcp.o xfrm_policy
      /* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/security.h:67 */
      struct xfrm_policy {
              struct xfrm_policy *       next;                 /*     0     4 */
              struct hlist_node          bydst;                /*     4     8 */
              struct hlist_node          byidx;                /*    12     8 */
              rwlock_t                   lock;                 /*    20    36 */
              atomic_t                   refcnt;               /*    56     4 */
              struct timer_list          timer;                /*    60    24 */
              u32                        priority;             /*    84     4 */
              u32                        index;                /*    88     4 */
              struct xfrm_selector       selector;             /*    92    56 */
              struct xfrm_lifetime_cfg   lft;                  /*   148    64 */
              struct xfrm_lifetime_cur   curlft;               /*   212    32 */
              struct dst_entry *         bundles;              /*   244     4 */
              u16                        family;               /*   248     2 */
              u8                         type;                 /*   250     1 */
              u8                         action;               /*   251     1 */
              u8                         flags;                /*   252     1 */
              u8                         dead;                 /*   253     1 */
              u8                         xfrm_nr;              /*   254     1 */
      
              /* XXX 1 byte hole, try to pack */
      
              struct xfrm_sec_ctx *      security;             /*   256     4 */
              struct xfrm_tmpl           xfrm_vec[6];          /*   260   360 */
      }; /* size: 620, sum members: 619, holes: 1, sum holes: 1 */
      
      Are there any fugly data dependencies here? None that I know.
      
      In the process changed the removed the __ prefixed types, that are just for
      userspace visible headers.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@mandriva.com>
      46ca5f5d
    • G
      [NET]: Supporting UDP-Lite (RFC 3828) in Linux · ba4e58ec
      Gerrit Renker 提交于
      This is a revision of the previously submitted patch, which alters
      the way files are organized and compiled in the following manner:
      
      	* UDP and UDP-Lite now use separate object files
      	* source file dependencies resolved via header files
      	  net/ipv{4,6}/udp_impl.h
      	* order of inclusion files in udp.c/udplite.c adapted
      	  accordingly
      
      [NET/IPv4]: Support for the UDP-Lite protocol (RFC 3828)
      
      This patch adds support for UDP-Lite to the IPv4 stack, provided as an
      extension to the existing UDPv4 code:
              * generic routines are all located in net/ipv4/udp.c
              * UDP-Lite specific routines are in net/ipv4/udplite.c
              * MIB/statistics support in /proc/net/snmp and /proc/net/udplite
              * shared API with extensions for partial checksum coverage
      
      [NET/IPv6]: Extension for UDP-Lite over IPv6
      
      It extends the existing UDPv6 code base with support for UDP-Lite
      in the same manner as per UDPv4. In particular,
              * UDPv6 generic and shared code is in net/ipv6/udp.c
              * UDP-Litev6 specific extensions are in net/ipv6/udplite.c
              * MIB/statistics support in /proc/net/snmp6 and /proc/net/udplite6
              * support for IPV6_ADDRFORM
              * aligned the coding style of protocol initialisation with af_inet6.c
              * made the error handling in udpv6_queue_rcv_skb consistent;
                to return `-1' on error on all error cases
              * consolidation of shared code
      
      [NET]: UDP-Lite Documentation and basic XFRM/Netfilter support
      
      The UDP-Lite patch further provides
              * API documentation for UDP-Lite
              * basic xfrm support
              * basic netfilter support for IPv4 and IPv6 (LOG target)
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ba4e58ec
    • A
      [XFRM]: uninline xfrm_selector_match() · 77681021
      Andrew Morton 提交于
      Six callsites, huge.
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      77681021
    • A
      [XFRM]: annotate ->new_mapping() · 5d36b180
      Al Viro 提交于
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5d36b180
    • A
      04ce6909
    • A
      [XFRM]: misc annotations · 8c689a6e
      Al Viro 提交于
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8c689a6e
  3. 12 10月, 2006 1 次提交
    • V
      IPsec: correct semantics for SELinux policy matching · 5b368e61
      Venkat Yekkirala 提交于
      Currently when an IPSec policy rule doesn't specify a security
      context, it is assumed to be "unlabeled" by SELinux, and so
      the IPSec policy rule fails to match to a flow that it would
      otherwise match to, unless one has explicitly added an SELinux
      policy rule allowing the flow to "polmatch" to the "unlabeled"
      IPSec policy rules. In the absence of such an explicitly added
      SELinux policy rule, the IPSec policy rule fails to match and
      so the packet(s) flow in clear text without the otherwise applicable
      xfrm(s) applied.
      
      The above SELinux behavior violates the SELinux security notion of
      "deny by default" which should actually translate to "encrypt by
      default" in the above case.
      
      This was first reported by Evgeniy Polyakov and the way James Morris
      was seeing the problem was when connecting via IPsec to a
      confined service on an SELinux box (vsftpd), which did not have the
      appropriate SELinux policy permissions to send packets via IPsec.
      
      With this patch applied, SELinux "polmatching" of flows Vs. IPSec
      policy rules will only come into play when there's a explicit context
      specified for the IPSec policy rule (which also means there's corresponding
      SELinux policy allowing appropriate domains/flows to polmatch to this context).
      
      Secondly, when a security module is loaded (in this case, SELinux), the
      security_xfrm_policy_lookup() hook can return errors other than access denied,
      such as -EINVAL.  We were not handling that correctly, and in fact
      inverting the return logic and propagating a false "ok" back up to
      xfrm_lookup(), which then allowed packets to pass as if they were not
      associated with an xfrm policy.
      
      The solution for this is to first ensure that errno values are
      correctly propagated all the way back up through the various call chains
      from security_xfrm_policy_lookup(), and handled correctly.
      
      Then, flow_cache_lookup() is modified, so that if the policy resolver
      fails (typically a permission denied via the security module), the flow
      cache entry is killed rather than having a null policy assigned (which
      indicates that the packet can pass freely).  This also forces any future
      lookups for the same flow to consult the security module (e.g. SELinux)
      for current security policy (rather than, say, caching the error on the
      flow cache entry).
      
      This patch: Fix the selinux side of things.
      
      This makes sure SELinux polmatching of flow contexts to IPSec policy
      rules comes into play only when an explicit context is associated
      with the IPSec policy rule.
      
      Also, this no longer defaults the context of a socket policy to
      the context of the socket since the "no explicit context" case
      is now handled properly.
      Signed-off-by: NVenkat Yekkirala <vyekkirala@TrustedCS.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      5b368e61
  4. 29 9月, 2006 7 次提交
  5. 23 9月, 2006 24 次提交