Merge branch 'e1000-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[pandora-kernel.git] / net / sched / act_gact.c
index 6cff566..7517f37 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/socket.h>
@@ -29,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/proc_fs.h>
+#include <net/netlink.h>
 #include <net/sock.h>
 #include <net/pkt_sched.h>
 #include <linux/tc_act/tc_gact.h>
@@ -48,14 +48,14 @@ static struct tcf_hashinfo gact_hash_info = {
 #ifdef CONFIG_GACT_PROB
 static int gact_net_rand(struct tcf_gact *gact)
 {
-       if (net_random() % gact->tcfg_pval)
+       if (!gact->tcfg_pval || net_random() % gact->tcfg_pval)
                return gact->tcf_action;
        return gact->tcfg_paction;
 }
 
 static int gact_determ(struct tcf_gact *gact)
 {
-       if (gact->tcf_bstats.packets % gact->tcfg_pval)
+       if (!gact->tcfg_pval || gact->tcf_bstats.packets % gact->tcfg_pval)
                return gact->tcf_action;
        return gact->tcfg_paction;
 }
@@ -65,7 +65,7 @@ static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ };
 #endif /* CONFIG_GACT_PROB */
 
 static int tcf_gact_init(struct rtattr *rta, struct rtattr *est,
-                         struct tc_action *a, int ovr, int bind)
+                        struct tc_action *a, int ovr, int bind)
 {
        struct rtattr *tb[TCA_GACT_MAX];
        struct tc_gact *parm;
@@ -156,7 +156,7 @@ static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result
 
 static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_gact opt;
        struct tcf_gact *gact = a->priv;
        struct tcf_t t;
@@ -182,7 +182,7 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
        return skb->len;
 
 rtattr_failure:
-       skb_trim(skb, b - skb->data);
+       nlmsg_trim(skb, b);
        return -1;
 }