adding the patch file too
[linux-2.6.git] / linux-2.6-520-vnet+.patch
index d33dd31..f425f62 100644 (file)
@@ -1,7 +1,7 @@
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_MARK.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter/xt_MARK.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_MARK.h  2006-06-17 21:49:35.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter/xt_MARK.h  2007-11-14 16:04:04.000000000 -0500
-@@ -11,6 +11,7 @@ enum {
+diff -Nurb linux-2.6.22-510/include/linux/netfilter/xt_MARK.h linux-2.6.22-520/include/linux/netfilter/xt_MARK.h
+--- linux-2.6.22-510/include/linux/netfilter/xt_MARK.h 2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/include/linux/netfilter/xt_MARK.h 2008-06-06 17:07:56.000000000 -0400
+@@ -11,6 +11,7 @@
        XT_MARK_SET=0,
        XT_MARK_AND,
        XT_MARK_OR,
@@ -9,9 +9,9 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_MARK.h lin
  };
  
  struct xt_mark_target_info_v1 {
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_SETXID.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter/xt_SETXID.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_SETXID.h        1969-12-31 19:00:00.000000000 -0500
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter/xt_SETXID.h        2007-11-14 16:05:44.000000000 -0500
+diff -Nurb linux-2.6.22-510/include/linux/netfilter/xt_SETXID.h linux-2.6.22-520/include/linux/netfilter/xt_SETXID.h
+--- linux-2.6.22-510/include/linux/netfilter/xt_SETXID.h       1969-12-31 19:00:00.000000000 -0500
++++ linux-2.6.22-520/include/linux/netfilter/xt_SETXID.h       2008-06-06 17:07:56.000000000 -0400
 @@ -0,0 +1,14 @@
 +#ifndef _XT_SETXID_H_target
 +#define _XT_SETXID_H_target
@@ -27,26 +27,20 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_SETXID.h l
 +};
 +
 +#endif /*_XT_SETXID_H_target*/
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_MARK.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter_ipv4/ipt_MARK.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_MARK.h    2006-06-17 21:49:35.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter_ipv4/ipt_MARK.h    2007-11-14 16:03:44.000000000 -0500
-@@ -9,9 +9,10 @@
- #define ipt_mark_target_info xt_mark_target_info
- /* Version 1 */
--#define IPT_MARK_SET  XT_MARK_SET
--#define IPT_MARK_AND  XT_MARK_AND
--#define       IPT_MARK_OR     XT_MARK_OR
-+#define IPT_MARK_SET          XT_MARK_SET
-+#define IPT_MARK_AND          XT_MARK_AND
-+#define       IPT_MARK_OR             XT_MARK_OR
+diff -Nurb linux-2.6.22-510/include/linux/netfilter_ipv4/ipt_MARK.h linux-2.6.22-520/include/linux/netfilter_ipv4/ipt_MARK.h
+--- linux-2.6.22-510/include/linux/netfilter_ipv4/ipt_MARK.h   2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/include/linux/netfilter_ipv4/ipt_MARK.h   2008-06-06 17:07:56.000000000 -0400
+@@ -12,6 +12,7 @@
+ #define IPT_MARK_SET  XT_MARK_SET
+ #define IPT_MARK_AND  XT_MARK_AND
+ #define       IPT_MARK_OR     XT_MARK_OR
 +#define IPT_MARK_COPYXID      XT_MARK_COPYXID
  
  #define ipt_mark_target_info_v1 xt_mark_target_info_v1
  
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_SETXID.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter_ipv4/ipt_SETXID.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_SETXID.h  1969-12-31 19:00:00.000000000 -0500
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter_ipv4/ipt_SETXID.h  2007-11-14 16:05:44.000000000 -0500
+diff -Nurb linux-2.6.22-510/include/linux/netfilter_ipv4/ipt_SETXID.h linux-2.6.22-520/include/linux/netfilter_ipv4/ipt_SETXID.h
+--- linux-2.6.22-510/include/linux/netfilter_ipv4/ipt_SETXID.h 1969-12-31 19:00:00.000000000 -0500
++++ linux-2.6.22-520/include/linux/netfilter_ipv4/ipt_SETXID.h 2008-06-06 17:07:56.000000000 -0400
 @@ -0,0 +1,13 @@
 +#ifndef _IPT_SETXID_H_target
 +#define _IPT_SETXID_H_target
@@ -61,23 +55,21 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_SETX
 +#define ipt_setxid_target_info_v1 xt_setxid_target_info_v1
 +
 +#endif /*_IPT_SETXID_H_target*/
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/skbuff.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/skbuff.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/skbuff.h     2007-07-21 18:00:24.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/skbuff.h     2007-11-15 13:57:04.000000000 -0500
-@@ -299,6 +299,9 @@ struct sk_buff {
- #endif
- #ifdef CONFIG_NETWORK_SECMARK
-       __u32                   secmark;
-+#  define skb_tag             secmark
-+#else
-+#  define skb_tag             mark
+diff -Nurb linux-2.6.22-510/include/linux/skbuff.h linux-2.6.22-520/include/linux/skbuff.h
+--- linux-2.6.22-510/include/linux/skbuff.h    2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/include/linux/skbuff.h    2008-06-06 17:07:56.000000000 -0400
+@@ -302,6 +302,7 @@
  #endif
  
        __u32                   mark;
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/socket.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/socket.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/socket.h     2007-07-21 18:00:24.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/socket.h     2007-11-14 14:24:36.000000000 -0500
-@@ -288,6 +288,8 @@ struct ucred {
++#define skb_tag                       mark
+       sk_buff_data_t          transport_header;
+       sk_buff_data_t          network_header;
+diff -Nurb linux-2.6.22-510/include/linux/socket.h linux-2.6.22-520/include/linux/socket.h
+--- linux-2.6.22-510/include/linux/socket.h    2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/include/linux/socket.h    2008-06-06 17:07:56.000000000 -0400
+@@ -288,6 +288,8 @@
  #define SOL_TIPC      271
  #define SOL_RXRPC     272
  
@@ -86,11 +78,11 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/socket.h linux-2.6.22.1
  /* IPX options */
  #define IPX_TYPE      1
  
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/vserver/network.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/vserver/network.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/vserver/network.h    2007-10-29 21:23:59.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/vserver/network.h    2007-11-14 14:23:54.000000000 -0500
-@@ -44,6 +44,8 @@ static inline uint64_t __nxf_init_set(vo
- /* network caps */
+diff -Nurb linux-2.6.22-510/include/linux/vserver/network.h linux-2.6.22-520/include/linux/vserver/network.h
+--- linux-2.6.22-510/include/linux/vserver/network.h   2008-06-06 17:07:48.000000000 -0400
++++ linux-2.6.22-520/include/linux/vserver/network.h   2008-06-06 17:07:56.000000000 -0400
+@@ -47,6 +47,8 @@
+ #define NXC_TUN_CREATE                0x00000001
  
  #define NXC_RAW_ICMP          0x00000100
 +#define NXC_RAW_SOCKET                0x00000200
@@ -98,23 +90,23 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/vserver/network.h linux
  
  
  /* address types */
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/net/netfilter/nf_conntrack.h linux-2.6.22.10-vs2.3.0.29-pl04/include/net/netfilter/nf_conntrack.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/net/netfilter/nf_conntrack.h       2007-07-21 18:00:24.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/net/netfilter/nf_conntrack.h       2007-11-14 16:35:42.000000000 -0500
-@@ -131,6 +131,9 @@ struct nf_conn
+diff -Nurb linux-2.6.22-510/include/net/netfilter/nf_conntrack.h linux-2.6.22-520/include/net/netfilter/nf_conntrack.h
+--- linux-2.6.22-510/include/net/netfilter/nf_conntrack.h      2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/include/net/netfilter/nf_conntrack.h      2008-06-06 17:07:56.000000000 -0400
+@@ -131,6 +131,9 @@
        /* Storage reserved for other modules: */
        union nf_conntrack_proto proto;
  
 +      /* PLANETLAB. VNET-specific */
-+      xid_t xid[IP_CT_DIR_MAX];
++      int xid[IP_CT_DIR_MAX];
 +
        /* features dynamically at the end: helper, nat (both optional) */
        char data[0];
  };
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/net/raw.h linux-2.6.22.10-vs2.3.0.29-pl04/include/net/raw.h
---- linux-2.6.22.10-vs2.3.0.29-pl03/include/net/raw.h  2007-05-04 09:55:46.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/include/net/raw.h  2007-11-14 14:22:49.000000000 -0500
-@@ -36,7 +36,7 @@ extern rwlock_t raw_v4_lock;
+diff -Nurb linux-2.6.22-510/include/net/raw.h linux-2.6.22-520/include/net/raw.h
+--- linux-2.6.22-510/include/net/raw.h 2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/include/net/raw.h 2008-06-06 17:07:56.000000000 -0400
+@@ -36,7 +36,7 @@
  
  extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
                                    __be32 raddr, __be32 laddr,
@@ -123,9 +115,97 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/net/raw.h linux-2.6.22.10-vs2
  
  extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
  
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/skbuff.c linux-2.6.22.10-vs2.3.0.29-pl04/net/core/skbuff.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/core/skbuff.c  2007-07-21 18:00:25.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/core/skbuff.c  2007-11-14 15:12:52.000000000 -0500
+diff -Nurb linux-2.6.22-510/net/core/dev.c linux-2.6.22-520/net/core/dev.c
+--- linux-2.6.22-510/net/core/dev.c    2008-06-06 17:07:48.000000000 -0400
++++ linux-2.6.22-520/net/core/dev.c    2008-06-06 17:07:56.000000000 -0400
+@@ -1803,6 +1803,7 @@
+  * the ingress scheduler, you just cant add policies on ingress.
+  *
+  */
++
+ static int ing_filter(struct sk_buff *skb)
+ {
+       struct Qdisc *q;
+@@ -1832,13 +1833,20 @@
+ }
+ #endif
++/* The code already makes the assumption that packet handlers run
++ * sequentially on the same CPU. -Sapan */
++DEFINE_PER_CPU(int, sknid_elevator);
++
+ int netif_receive_skb(struct sk_buff *skb)
+ {
+       struct packet_type *ptype, *pt_prev;
+       struct net_device *orig_dev;
+       int ret = NET_RX_DROP;
++      int *cur_elevator=&__get_cpu_var(sknid_elevator);
+       __be16 type;
++      *cur_elevator = 0;
++
+       /* if we've gotten here through NAPI, check netpoll */
+       if (skb->dev->poll && netpoll_rx(skb))
+               return NET_RX_DROP;
+@@ -1873,8 +1881,9 @@
+       list_for_each_entry_rcu(ptype, &ptype_all, list) {
+               if (!ptype->dev || ptype->dev == skb->dev) {
+-                      if (pt_prev)
++                      if (pt_prev) {
+                               ret = deliver_skb(skb, pt_prev, orig_dev);
++                      }
+                       pt_prev = ptype;
+               }
+       }
+@@ -1912,8 +1921,22 @@
+               }
+       }
++      /* We don't want the packet handlers to throw the packet away
++       * if we want the taps to treat it again - Sapan */
++      if (*cur_elevator) {
++              atomic_inc(&skb->users);
++      }
++
+       if (pt_prev) {
+               ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
++                      if (*cur_elevator > 0) {
++                              skb->skb_tag = *cur_elevator;
++                              list_for_each_entry_rcu(ptype, &ptype_all, list) {
++                                      if (!ptype->dev || ptype->dev == skb->dev) {
++                                                      ret = deliver_skb(skb, ptype, orig_dev);
++                                      }
++                              }
++                      }
+       } else {
+               kfree_skb(skb);
+               /* Jamal, now you will not able to escape explaining
+@@ -1922,6 +1945,13 @@
+               ret = NET_RX_DROP;
+       }
++      if (*cur_elevator) {
++              /* We have a packet */
++              kfree_skb(skb);
++      }
++
++      *cur_elevator=0;
++
+ out:
+       rcu_read_unlock();
+       return ret;
+@@ -3780,6 +3810,7 @@
+ EXPORT_SYMBOL(net_enable_timestamp);
+ EXPORT_SYMBOL(net_disable_timestamp);
+ EXPORT_SYMBOL(dev_get_flags);
++EXPORT_PER_CPU_SYMBOL(sknid_elevator);
+ #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
+ EXPORT_SYMBOL(br_handle_frame_hook);
+diff -Nurb linux-2.6.22-510/net/core/skbuff.c linux-2.6.22-520/net/core/skbuff.c
+--- linux-2.6.22-510/net/core/skbuff.c 2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/net/core/skbuff.c 2008-06-06 17:07:56.000000000 -0400
 @@ -56,6 +56,7 @@
  #include <linux/rtnetlink.h>
  #include <linux/init.h>
@@ -134,15 +214,15 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/skbuff.c linux-2.6.22.10-vs2
  
  #include <net/protocol.h>
  #include <net/dst.h>
-@@ -174,6 +175,7 @@ struct sk_buff *__alloc_skb(unsigned int
+@@ -174,6 +175,7 @@
        skb->data = data;
        skb_reset_tail_pointer(skb);
        skb->end = skb->tail + size;
-+      skb->skb_tag = nx_current_nid();
++      if (!in_interrupt()) skb->skb_tag = nx_current_nid(); else skb->skb_tag = 0;
        /* make sure we initialize shinfo sequentially */
        shinfo = skb_shinfo(skb);
        atomic_set(&shinfo->dataref, 1);
-@@ -443,6 +445,8 @@ struct sk_buff *skb_clone(struct sk_buff
+@@ -443,6 +445,8 @@
        C(tail);
        C(end);
  
@@ -151,7 +231,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/skbuff.c linux-2.6.22.10-vs2
        atomic_inc(&(skb_shinfo(skb)->dataref));
        skb->cloned = 1;
  
-@@ -492,6 +496,7 @@ static void copy_skb_header(struct sk_bu
+@@ -492,6 +496,7 @@
        new->tc_index   = old->tc_index;
  #endif
        skb_copy_secmark(new, old);
@@ -159,10 +239,10 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/skbuff.c linux-2.6.22.10-vs2
        atomic_set(&new->users, 1);
        skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
        skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/sock.c linux-2.6.22.10-vs2.3.0.29-pl04/net/core/sock.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/core/sock.c    2007-10-29 21:23:59.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/core/sock.c    2007-11-14 14:36:36.000000000 -0500
-@@ -444,6 +444,19 @@ set_sndbuf:
+diff -Nurb linux-2.6.22-510/net/core/sock.c linux-2.6.22-520/net/core/sock.c
+--- linux-2.6.22-510/net/core/sock.c   2008-06-06 17:07:48.000000000 -0400
++++ linux-2.6.22-520/net/core/sock.c   2008-06-06 17:07:56.000000000 -0400
+@@ -444,6 +444,19 @@
                }
                goto set_sndbuf;
  
@@ -182,7 +262,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/sock.c linux-2.6.22.10-vs2.3
        case SO_RCVBUF:
                /* Don't error on this BSD doesn't and if you think
                   about it this is right. Otherwise apps have to
-@@ -573,7 +586,7 @@ set_rcvbuf:
+@@ -573,7 +586,7 @@
                char devname[IFNAMSIZ];
  
                /* Sorry... */
@@ -191,22 +271,32 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/sock.c linux-2.6.22.10-vs2.3
                        ret = -EPERM;
                        break;
                }
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/af_inet.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/af_inet.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/af_inet.c 2007-10-29 21:23:59.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/af_inet.c 2007-11-14 16:40:54.000000000 -0500
-@@ -178,6 +178,8 @@ static int inet_autobind(struct sock *sk
+diff -Nurb linux-2.6.22-510/net/ipv4/af_inet.c linux-2.6.22-520/net/ipv4/af_inet.c
+--- linux-2.6.22-510/net/ipv4/af_inet.c        2008-06-06 17:07:48.000000000 -0400
++++ linux-2.6.22-520/net/ipv4/af_inet.c        2008-06-06 17:07:56.000000000 -0400
+@@ -178,6 +178,8 @@
                        return -EAGAIN;
                }
                inet->sport = htons(inet->num);
 +              sk->sk_xid = vx_current_xid();
-+              sk->sk_nid = nx_current_nid();
++              if (!in_interrupt()) sk->sk_nid = nx_current_nid(); else sk->sk_nid=0;
        }
        release_sock(sk);
        return 0;
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/icmp.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/icmp.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/icmp.c    2007-11-14 14:00:56.000000000 -0500
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/icmp.c    2007-11-15 13:57:04.000000000 -0500
-@@ -709,7 +709,7 @@ static void icmp_unreach(struct sk_buff 
+@@ -312,6 +314,9 @@
+       if ((protocol == IPPROTO_ICMP) &&
+               nx_capable(answer->capability, NXC_RAW_ICMP))
+               goto override;
++      if (sock->type == SOCK_RAW &&
++              nx_capable(answer->capability, NXC_RAW_SOCKET))
++              goto override;
+       if (answer->capability > 0 && !capable(answer->capability))
+               goto out_rcu_unlock;
+ override:
+diff -Nurb linux-2.6.22-510/net/ipv4/icmp.c linux-2.6.22-520/net/ipv4/icmp.c
+--- linux-2.6.22-510/net/ipv4/icmp.c   2008-06-06 17:07:55.000000000 -0400
++++ linux-2.6.22-520/net/ipv4/icmp.c   2008-06-06 17:07:56.000000000 -0400
+@@ -709,7 +709,7 @@
        if ((raw_sk = sk_head(&raw_v4_htable[hash])) != NULL) {
                while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->daddr,
                                                 iph->saddr,
@@ -215,21 +305,10 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/icmp.c linux-2.6.22.10-vs2.3
                        raw_err(raw_sk, skb, info);
                        raw_sk = sk_next(raw_sk);
                        iph = (struct iphdr *)skb->data;
-@@ -937,8 +937,8 @@ char sysctl_icmp_ipod_key[32+1] = { "SET
- static void icmp_ping_of_death(struct sk_buff *skb)
- {
--      struct icmphdr *icmph = skb->h.icmph;
--      struct iphdr *iph = skb->nh.iph;
-+      struct icmphdr *icmph = skb_transport_header(skb);
-+      struct iphdr *iph = skb_network_header(skb);
-       int doit = 0;
- #if 0
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/ip_options.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/ip_options.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/ip_options.c      2007-07-21 18:00:25.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/ip_options.c      2007-11-14 17:03:19.000000000 -0500
-@@ -409,7 +409,7 @@ int ip_options_compile(struct ip_options
+diff -Nurb linux-2.6.22-510/net/ipv4/ip_options.c linux-2.6.22-520/net/ipv4/ip_options.c
+--- linux-2.6.22-510/net/ipv4/ip_options.c     2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/net/ipv4/ip_options.c     2008-06-06 17:07:56.000000000 -0400
+@@ -409,7 +409,7 @@
                                        optptr[2] += 8;
                                        break;
                                      default:
@@ -238,7 +317,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/ip_options.c linux-2.6.22.10
                                                pp_ptr = optptr + 3;
                                                goto error;
                                        }
-@@ -445,7 +445,7 @@ int ip_options_compile(struct ip_options
+@@ -445,7 +445,7 @@
                                opt->router_alert = optptr - iph;
                        break;
                      case IPOPT_CIPSO:
@@ -247,7 +326,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/ip_options.c linux-2.6.22.10
                                pp_ptr = optptr;
                                goto error;
                        }
-@@ -458,7 +458,7 @@ int ip_options_compile(struct ip_options
+@@ -458,7 +458,7 @@
                      case IPOPT_SEC:
                      case IPOPT_SID:
                      default:
@@ -256,10 +335,10 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/ip_options.c linux-2.6.22.10
                                pp_ptr = optptr;
                                goto error;
                        }
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/netfilter/ipt_LOG.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/netfilter/ipt_LOG.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/netfilter/ipt_LOG.c       2007-08-11 21:54:37.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/netfilter/ipt_LOG.c       2007-11-14 16:00:55.000000000 -0500
-@@ -49,6 +49,8 @@ static void dump_packet(const struct nf_
+diff -Nurb linux-2.6.22-510/net/ipv4/netfilter/ipt_LOG.c linux-2.6.22-520/net/ipv4/netfilter/ipt_LOG.c
+--- linux-2.6.22-510/net/ipv4/netfilter/ipt_LOG.c      2008-06-06 17:07:43.000000000 -0400
++++ linux-2.6.22-520/net/ipv4/netfilter/ipt_LOG.c      2008-06-06 17:07:56.000000000 -0400
+@@ -49,6 +49,8 @@
        else
                logflags = NF_LOG_MASK;
  
@@ -268,10 +347,10 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/netfilter/ipt_LOG.c linux-2.
        ih = skb_header_pointer(skb, iphoff, sizeof(_iph), &_iph);
        if (ih == NULL) {
                printk("TRUNCATED");
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/raw.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c     2007-10-29 21:23:59.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/raw.c     2007-11-14 17:02:08.000000000 -0500
-@@ -103,7 +103,7 @@ static void raw_v4_unhash(struct sock *s
+diff -Nurb linux-2.6.22-510/net/ipv4/raw.c linux-2.6.22-520/net/ipv4/raw.c
+--- linux-2.6.22-510/net/ipv4/raw.c    2008-06-06 17:07:48.000000000 -0400
++++ linux-2.6.22-520/net/ipv4/raw.c    2008-06-06 17:07:56.000000000 -0400
+@@ -103,7 +103,7 @@
  
  struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
                             __be32 raddr, __be32 laddr,
@@ -280,7 +359,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c linux-2.6.22.10-vs2.3.
  {
        struct hlist_node *node;
  
-@@ -112,6 +112,7 @@ struct sock *__raw_v4_lookup(struct sock
+@@ -112,6 +112,7 @@
  
                if (inet->num == num                                    &&
                    !(inet->daddr && inet->daddr != raddr)              &&
@@ -288,7 +367,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c linux-2.6.22.10-vs2.3.
                    v4_sock_addr_match(sk->sk_nx_info, inet, laddr)     &&
                    !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
                        goto found; /* gotcha */
-@@ -161,7 +162,7 @@ int raw_v4_input(struct sk_buff *skb, st
+@@ -161,7 +162,7 @@
                goto out;
        sk = __raw_v4_lookup(__sk_head(head), iph->protocol,
                             iph->saddr, iph->daddr,
@@ -297,7 +376,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c linux-2.6.22.10-vs2.3.
  
        while (sk) {
                delivered = 1;
-@@ -174,7 +175,7 @@ int raw_v4_input(struct sk_buff *skb, st
+@@ -174,7 +175,7 @@
                }
                sk = __raw_v4_lookup(sk_next(sk), iph->protocol,
                                     iph->saddr, iph->daddr,
@@ -306,7 +385,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c linux-2.6.22.10-vs2.3.
        }
  out:
        read_unlock(&raw_v4_lock);
-@@ -315,7 +316,7 @@ static int raw_send_hdrinc(struct sock *
+@@ -315,7 +316,7 @@
        }
  
        err = -EPERM;
@@ -315,10 +394,10 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c linux-2.6.22.10-vs2.3.
                sk->sk_nx_info &&
                !v4_addr_in_nx_info(sk->sk_nx_info, iph->saddr, NXA_MASK_BIND))
                goto error_free;
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Kconfig linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Kconfig
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Kconfig      2007-07-21 18:00:27.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Kconfig      2007-11-14 15:27:12.000000000 -0500
-@@ -389,6 +389,13 @@ config NETFILTER_XT_TARGET_TCPMSS
+diff -Nurb linux-2.6.22-510/net/netfilter/Kconfig linux-2.6.22-520/net/netfilter/Kconfig
+--- linux-2.6.22-510/net/netfilter/Kconfig     2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/net/netfilter/Kconfig     2008-06-06 17:07:56.000000000 -0400
+@@ -389,6 +389,13 @@
  
          To compile it as a module, choose M here.  If unsure, say N.
  
@@ -332,10 +411,10 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Kconfig linux-2.6.22.10
  config NETFILTER_XT_MATCH_COMMENT
        tristate  '"comment" match support'
        depends on NETFILTER_XTABLES
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Makefile linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Makefile
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Makefile     2007-07-21 17:58:59.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Makefile     2007-11-14 15:25:53.000000000 -0500
-@@ -37,6 +37,7 @@ obj-$(CONFIG_NF_CONNTRACK_TFTP) += nf_co
+diff -Nurb linux-2.6.22-510/net/netfilter/Makefile linux-2.6.22-520/net/netfilter/Makefile
+--- linux-2.6.22-510/net/netfilter/Makefile    2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/net/netfilter/Makefile    2008-06-06 17:07:56.000000000 -0400
+@@ -37,6 +37,7 @@
  obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
  
  # targets
@@ -343,10 +422,10 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Makefile linux-2.6.22.1
  obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o
  obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o
  obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/nf_conntrack_core.c linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/nf_conntrack_core.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/nf_conntrack_core.c  2007-07-21 18:00:27.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/nf_conntrack_core.c  2007-11-14 16:39:09.000000000 -0500
-@@ -726,6 +726,8 @@ init_conntrack(const struct nf_conntrack
+diff -Nurb linux-2.6.22-510/net/netfilter/nf_conntrack_core.c linux-2.6.22-520/net/netfilter/nf_conntrack_core.c
+--- linux-2.6.22-510/net/netfilter/nf_conntrack_core.c 2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/net/netfilter/nf_conntrack_core.c 2008-06-06 17:07:56.000000000 -0400
+@@ -726,6 +726,8 @@
  
        /* Overload tuple linked list to put us in unconfirmed list. */
        list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed);
@@ -355,9 +434,9 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/nf_conntrack_core.c lin
  
        write_unlock_bh(&nf_conntrack_lock);
  
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_MARK.c linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_MARK.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_MARK.c    2007-07-21 17:59:00.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_MARK.c    2007-11-15 13:57:04.000000000 -0500
+diff -Nurb linux-2.6.22-510/net/netfilter/xt_MARK.c linux-2.6.22-520/net/netfilter/xt_MARK.c
+--- linux-2.6.22-510/net/netfilter/xt_MARK.c   2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/net/netfilter/xt_MARK.c   2008-06-07 17:55:26.000000000 -0400
 @@ -5,13 +5,18 @@
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
@@ -377,7 +456,7 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_MARK.c linux-2.6.22.
  #include <linux/netfilter/x_tables.h>
  #include <linux/netfilter/xt_MARK.h>
  
-@@ -21,6 +26,48 @@ MODULE_DESCRIPTION("ip[6]tables MARK mod
+@@ -21,6 +26,48 @@
  MODULE_ALIAS("ipt_MARK");
  MODULE_ALIAS("ip6t_MARK");
  
@@ -426,70 +505,114 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_MARK.c linux-2.6.22.
  static unsigned int
  target_v0(struct sk_buff **pskb,
          const struct net_device *in,
-@@ -44,7 +91,7 @@ target_v1(struct sk_buff **pskb,
+@@ -35,6 +82,8 @@
+       return XT_CONTINUE;
+ }
++extern DEFINE_PER_CPU(int, sknid_elevator);
++
+ static unsigned int
+ target_v1(struct sk_buff **pskb,
+         const struct net_device *in,
+@@ -44,7 +93,20 @@
          const void *targinfo)
  {
        const struct xt_mark_target_info_v1 *markinfo = targinfo;
 -      int mark = 0;
++      enum ip_conntrack_info ctinfo;
++      struct sock *connection_sk;
++      int dif;
++      struct nf_conn *ct;
++      extern struct inet_hashinfo tcp_hashinfo;
++      enum ip_conntrack_dir dir;
++      int *curtag;
++      u_int32_t src_ip;
++      u_int32_t dst_ip;
++      u_int16_t proto, src_port;
++      u_int32_t ip;
++      u_int16_t port;
++
 +      int mark = -1;
  
        switch (markinfo->mode) {
        case XT_MARK_SET:
-@@ -58,9 +105,52 @@ target_v1(struct sk_buff **pskb,
+@@ -58,13 +120,74 @@
        case XT_MARK_OR:
                mark = (*pskb)->mark | markinfo->mark;
                break;
 +
-+      case XT_MARK_COPYXID: {
-+              enum ip_conntrack_info ctinfo;
-+              struct sock *connection_sk;
-+              int dif;
-+
-+              struct nf_conn *ct = nf_ct_get((*pskb), &ctinfo);
-+              extern struct inet_hashinfo tcp_hashinfo;
-+              enum ip_conntrack_dir dir;
-+
-+              if (!ct) 
-+                      break;
-+              dir = CTINFO2DIR(ctinfo);
-+              u_int32_t src_ip = ct->tuplehash[dir].tuple.src.u3.ip;
-+              u_int16_t src_port = get_src_port(&ct->tuplehash[dir].tuple);
-+
-+              u_int32_t ip;
-+              u_int16_t port;
-+
-+              dif = ((struct rtable *)(*pskb)->dst)->rt_iif;
-+              ip = ct->tuplehash[dir].tuple.dst.u3.ip;
-+              port = get_dst_port(&ct->tuplehash[dir].tuple);
-+
-+              if ((*pskb)->sk) 
-+                      connection_sk = (*pskb)->sk;
-+              else {
-+                      connection_sk = inet_lookup(&tcp_hashinfo, src_ip, src_port, ip, port, dif);
-+              }
-+
-+              if (connection_sk) {
-+#ifdef REQUIRESFIXFROMSAPAN
-+                      connection_sk->sk_peercred.gid = connection_sk->sk_peercred.uid = ct->xid[dir];
-+                      ct->xid[!dir]=connection_sk->sk_xid;
-+                      /*connection_sk->sk_peercred.gid = connection_sk->sk_peercred.uid = connection_sk->sk_xid;*/
-+                      if (connection_sk->sk_xid != 0) 
-+                              mark = connection_sk->sk_xid;
-+#endif
-+                      if (connection_sk != (*pskb)->sk)
-+                              sock_put(connection_sk);
-+              }
-+              break;
-+              }
++              case XT_MARK_COPYXID: 
++                                            
++                                            ct = nf_ct_get((*pskb), &ctinfo);
++                                            if (!ct) 
++                                                    break;
++
++                                            dir = CTINFO2DIR(ctinfo);
++                                            src_ip = ct->tuplehash[dir].tuple.src.u3.ip;
++                                            dst_ip = ct->tuplehash[dir].tuple.dst.u3.ip;
++                                            src_port = get_src_port(&ct->tuplehash[dir].tuple);
++                                            proto = ct->tuplehash[dir].tuple.dst.protonum;
++
++                                            dif = ((struct rtable *)(*pskb)->dst)->rt_iif;
++                                            ip = ct->tuplehash[dir].tuple.dst.u3.ip;
++                                            port = get_dst_port(&ct->tuplehash[dir].tuple);
++
++                                            if (proto == 1 || proto == 17) {
++                                                    if ((*pskb)->mark>0) /* The packet is marked, it's going out */
++                                                    {
++                                                              //if (ct->xid[0]>0 && ct->xid[0]!=(*pskb)->mark)
++                                                                      /*printk(KERN_CRIT "xt_MARK log: %d/%d/%d/%d\n",ct->xid[0],(*pskb)->mark,hooknum==NF_IP_LOCAL_IN,proto);*/
++
++                                                              ct->xid[0]=(*pskb)->mark;
        }
  
--      (*pskb)->mark = mark;
-+      if (mark != -1)
-+              (*pskb)->mark = mark;
++                                                    if (ct->xid[0] > 0) {
++                                                            mark = ct->xid[0];
++                                                    }
++
++                                            }
++                                            else if (proto == 6) { 
++                                                    if ((*pskb)->sk) {
++                                                            connection_sk = (*pskb)->sk;
++                                                            sock_hold(connection_sk);
++                                                    }
++                                                    else 
++                                                            connection_sk = inet_lookup_established(&tcp_hashinfo, src_ip, src_port, ip, port, dif);
++                                                            
++
++                                                    if (connection_sk) {
++                                                            if (connection_sk->sk_state == TCP_TIME_WAIT) {
++                                                                    inet_twsk_put(inet_twsk(connection_sk));
++                                                                    break;
++                                                            }
++                                                            connection_sk->sk_peercred.gid = connection_sk->sk_peercred.uid = ct->xid[dir];
++                                                            ct->xid[!dir]=connection_sk->sk_nid;
++                                                            if (connection_sk->sk_nid != 0) 
++                                                                    mark = connection_sk->sk_nid;
++                                                            sock_put(connection_sk);
++                                                    }
++                                                    else 
++                                                            mark = -1 ; 
++                                            }
++                                            break;
++      }
++      if (mark != -1) {
+       (*pskb)->mark = mark;
++      }
++
++      curtag=&__get_cpu_var(sknid_elevator);
++      if (mark > 0 && *curtag==-2) 
++      {
++              *curtag = mark;
++      }
        return XT_CONTINUE;
  }
  
-@@ -92,7 +182,8 @@ checkentry_v1(const char *tablename,
+-
+ static int
+ checkentry_v0(const char *tablename,
+             const void *entry,
+@@ -92,7 +215,8 @@
  
        if (markinfo->mode != XT_MARK_SET
            && markinfo->mode != XT_MARK_AND
@@ -499,9 +622,9 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_MARK.c linux-2.6.22.
                printk(KERN_WARNING "MARK: unknown mode %u\n",
                       markinfo->mode);
                return 0;
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_SETXID.c linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_SETXID.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_SETXID.c  1969-12-31 19:00:00.000000000 -0500
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_SETXID.c  2007-11-14 16:20:02.000000000 -0500
+diff -Nurb linux-2.6.22-510/net/netfilter/xt_SETXID.c linux-2.6.22-520/net/netfilter/xt_SETXID.c
+--- linux-2.6.22-510/net/netfilter/xt_SETXID.c 1969-12-31 19:00:00.000000000 -0500
++++ linux-2.6.22-520/net/netfilter/xt_SETXID.c 2008-06-06 17:07:56.000000000 -0400
 @@ -0,0 +1,79 @@
 +#include <linux/module.h>
 +#include <linux/skbuff.h>
@@ -582,9 +705,9 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_SETXID.c linux-2.6.2
 +
 +module_init(init);
 +module_exit(fini);
-diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/packet/af_packet.c linux-2.6.22.10-vs2.3.0.29-pl04/net/packet/af_packet.c
---- linux-2.6.22.10-vs2.3.0.29-pl03/net/packet/af_packet.c     2007-07-21 18:00:27.000000000 -0400
-+++ linux-2.6.22.10-vs2.3.0.29-pl04/net/packet/af_packet.c     2007-11-15 13:57:04.000000000 -0500
+diff -Nurb linux-2.6.22-510/net/packet/af_packet.c linux-2.6.22-520/net/packet/af_packet.c
+--- linux-2.6.22-510/net/packet/af_packet.c    2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22-520/net/packet/af_packet.c    2008-06-07 18:30:41.000000000 -0400
 @@ -78,6 +78,7 @@
  #include <linux/poll.h>
  #include <linux/module.h>
@@ -593,23 +716,89 @@ diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/packet/af_packet.c linux-2.6.22.1
  
  #ifdef CONFIG_INET
  #include <net/inet_common.h>
-@@ -420,6 +421,10 @@ static inline unsigned int run_filter(st
+@@ -246,10 +247,13 @@
+ static const struct proto_ops packet_ops_spkt;
++extern DEFINE_PER_CPU(int, sknid_elevator);
+ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev,  struct packet_type *pt, struct net_device *orig_dev)
+ {
+       struct sock *sk;
+       struct sockaddr_pkt *spkt;
++      int tag = skb->skb_tag;
++      int *elevator=&__get_cpu_var(sknid_elevator);
+       /*
+        *      When we registered the protocol we saved the socket in the data
+@@ -269,6 +273,22 @@
+        *      so that this procedure is noop.
+        */
++      /* 
++       * (18:05:41) daniel_hozac: where?
++       * (18:05:58) daniel_hozac: we already have filters on PF_PACKET, don't we?
++       * (18:05:58) er: in packet_rcv_skpt
++       * (18:07:33) daniel_hozac: oh, that's evil. 
++       */
++
++      if (sk->sk_nx_info && !(tag == 1 || sk->sk_nid == tag)) {
++              *elevator=-2;
++              goto out;
++      }
++      else if (!sk->sk_nx_info && *elevator) {
++              /* Root has already seen this packet */
++              goto out;
++      }
++
+       if (skb->pkt_type == PACKET_LOOPBACK)
+               goto out;
+@@ -324,6 +344,9 @@
+       __be16 proto=0;
+       int err;
++      if (!nx_capable(CAP_NET_RAW, NXC_RAW_SEND))
++              return -EPERM;
++
+       /*
+        *      Get and verify the address.
+        */
+@@ -420,6 +443,17 @@
                                      unsigned int res)
  {
        struct sk_filter *filter;
 +      int tag = skb->skb_tag;
++      int *elevator=&__get_cpu_var(sknid_elevator);
 +
-+      if (sk->sk_nx_info && !(tag == 1 || sk->sk_nid == tag))
++      if (sk->sk_nx_info && !(tag == 1 || sk->sk_nid == tag)) {
++              *elevator=-2;
++              return 0;
++      }
++      else if (!sk->sk_nx_info && *elevator) {
++              /* Root has already seen this packet */
 +              return 0;
++      }
  
        rcu_read_lock_bh();
        filter = rcu_dereference(sk->sk_filter);
-@@ -984,7 +989,7 @@ static int packet_create(struct socket *
+@@ -711,6 +745,9 @@
+       unsigned char *addr;
+       int ifindex, err, reserve = 0;
++      if (!nx_capable(CAP_NET_RAW, NXC_RAW_SEND)) 
++              return -EPERM;
++
+       /*
+        *      Get and verify the address.
+        */
+@@ -984,8 +1021,9 @@
        __be16 proto = (__force __be16)protocol; /* weird, but documented */
        int err;
  
 -      if (!capable(CAP_NET_RAW))
-+      if (!nx_capable(CAP_NET_RAW, NXC_RAW_SEND))
++      if (!nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET))
                return -EPERM;
++              
        if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW &&
            sock->type != SOCK_PACKET)
+               return -ESOCKTNOSUPPORT;