1. 18 10月, 2007 2 次提交
  2. 16 10月, 2007 1 次提交
  3. 11 10月, 2007 7 次提交
  4. 18 7月, 2007 1 次提交
  5. 11 7月, 2007 4 次提交
  6. 08 6月, 2007 1 次提交
    • J
      xfrm: Add security check before flushing SAD/SPD · 4aa2e62c
      Joy Latten 提交于
      Currently we check for permission before deleting entries from SAD and
      SPD, (see security_xfrm_policy_delete() security_xfrm_state_delete())
      However we are not checking for authorization when flushing the SPD and
      the SAD completely. It was perhaps missed in the original security hooks
      patch.
      
      This patch adds a security check when flushing entries from the SAD and
      SPD.  It runs the entire database and checks each entry for a denial.
      If the process attempting the flush is unable to remove all of the
      entries a denial is logged the the flush function returns an error
      without removing anything.
      
      This is particularly useful when a process may need to create or delete
      its own xfrm entries used for things like labeled networking but that
      same process should not be able to delete other entries or flush the
      entire database.
      
      Signed-off-by: Joy Latten<latten@austin.ibm.com>
      Signed-off-by: NEric Paris <eparis@parisplace.org>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      4aa2e62c
  7. 31 5月, 2007 1 次提交
  8. 05 5月, 2007 2 次提交
  9. 30 4月, 2007 1 次提交
    • M
      [XFRM]: Restrict upper layer information by bundle. · 157bfc25
      Masahide NAKAMURA 提交于
      On MIPv6 usage, XFRM sub policy is enabled.
      When main (IPsec) and sub (MIPv6) policy selectors have the same
      address set but different upper layer information (i.e. protocol
      number and its ports or type/code), multiple bundle should be created.
      However, currently we have issue to use the same bundle created for
      the first time with all flows covered by the case.
      
      It is useful for the bundle to have the upper layer information
      to be restructured correctly if it does not match with the flow.
      
      1. Bundle was created by two policies
      Selector from another policy is added to xfrm_dst.
      If the flow does not match the selector, it goes to slow path to
      restructure new bundle by single policy.
      
      2. Bundle was created by one policy
      Flow cache is added to xfrm_dst as originated one. If the flow does
      not match the cache, it goes to slow path to try searching another
      policy.
      Signed-off-by: NMasahide NAKAMURA <nakam@linux-ipv6.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      157bfc25
  10. 29 4月, 2007 1 次提交
  11. 26 4月, 2007 2 次提交
    • J
      [XFRM]: Export SAD info. · 28d8909b
      Jamal Hadi Salim 提交于
      On a system with a lot of SAs, counting SAD entries chews useful
      CPU time since you need to dump the whole SAD to user space;
      i.e something like ip xfrm state ls | grep -i src | wc -l
      I have seen taking literally minutes on a 40K SAs when the system
      is swapping.
      With this patch, some of the SAD info (that was already being tracked)
      is exposed to user space. i.e you do:
      ip xfrm state count
      And you get the count; you can also pass -s to the command line and
      get the hash info.
      Signed-off-by: NJamal Hadi Salim <hadi@cyberus.ca>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28d8909b
    • P
      [XFRM]: Optimize MTU calculation · c5c25238
      Patrick McHardy 提交于
      Replace the probing based MTU estimation, which usually takes 2-3 iterations
      to find a fitting value and may underestimate the MTU, by an exact calculation.
      
      Also fix underestimation of the XFRM trailer_len, which causes unnecessary
      reallocations.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c5c25238
  12. 08 3月, 2007 1 次提交
    • E
      [IPSEC]: xfrm_policy delete security check misplaced · ef41aaa0
      Eric Paris 提交于
      The security hooks to check permissions to remove an xfrm_policy were
      actually done after the policy was removed.  Since the unlinking and
      deletion are done in xfrm_policy_by* functions this moves the hooks
      inside those 2 functions.  There we have all the information needed to
      do the security check and it can be done before the deletion.  Since
      auditing requires the result of that security check err has to be passed
      back and forth from the xfrm_policy_by* functions.
      
      This patch also fixes a bug where a deletion that failed the security
      check could cause improper accounting on the xfrm_policy
      (xfrm_get_policy didn't have a put on the exit path for the hold taken
      by xfrm_policy_by*)
      
      It also fixes the return code when no policy is found in
      xfrm_add_pol_expire.  In old code (at least back in the 2.6.18 days) err
      wasn't used before the return when no policy is found and so the
      initialization would cause err to be ENOENT.  But since err has since
      been used above when we don't get a policy back from the xfrm_policy_by*
      function we would always return 0 instead of the intended ENOENT.  Also
      fixed some white space damage in the same area.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NVenkat Yekkirala <vyekkirala@trustedcs.com>
      Acked-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ef41aaa0
  13. 14 2月, 2007 2 次提交
  14. 09 2月, 2007 2 次提交
  15. 07 12月, 2006 2 次提交
  16. 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
  17. 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
  18. 29 9月, 2006 2 次提交