···1406{1407 int ret;14080001409 switch(cmd) {1410 case EBT_SO_SET_ENTRIES:1411 ret = do_replace(sock_net(sk), user, len);···1427 int ret;1428 struct ebt_replace tmp;1429 struct ebt_table *t;00014301431 if (copy_from_user(&tmp, user, sizeof(tmp)))1432 return -EFAULT;
···1406{1407 int ret;14081409+ if (!capable(CAP_NET_ADMIN))1410+ return -EPERM;1411+1412 switch(cmd) {1413 case EBT_SO_SET_ENTRIES:1414 ret = do_replace(sock_net(sk), user, len);···1424 int ret;1425 struct ebt_replace tmp;1426 struct ebt_table *t;1427+1428+ if (!capable(CAP_NET_ADMIN))1429+ return -EPERM;14301431 if (copy_from_user(&tmp, user, sizeof(tmp)))1432 return -EFAULT;
+2-1
net/netfilter/ipvs/Kconfig
···112 module, choose M here. If unsure, say N.113114config IP_VS_WRR115- tristate "weighted round-robin scheduling" 0116 ---help---117 The weighted robin-robin scheduling algorithm directs network118 connections to different real servers based on server weights
···112 module, choose M here. If unsure, say N.113114config IP_VS_WRR115+ tristate "weighted round-robin scheduling"116+ select GCD117 ---help---118 The weighted robin-robin scheduling algorithm directs network119 connections to different real servers based on server weights
+13-1
net/netfilter/ipvs/ip_vs_ctl.c
···2077 if (!capable(CAP_NET_ADMIN))2078 return -EPERM;207900002080 if (len != set_arglen[SET_CMDID(cmd)]) {2081 pr_err("set_ctl: len %u != %u\n",2082 len, set_arglen[SET_CMDID(cmd)]);···2356{2357 unsigned char arg[128];2358 int ret = 0;023592360 if (!capable(CAP_NET_ADMIN))2361 return -EPERM;00023622363 if (*len < get_arglen[GET_CMDID(cmd)]) {2364 pr_err("get_ctl: len %u < %u\n",···2370 return -EINVAL;2371 }23722373- if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0)00002374 return -EFAULT;23752376 if (mutex_lock_interruptible(&__ip_vs_mutex))
···2077 if (!capable(CAP_NET_ADMIN))2078 return -EPERM;20792080+ if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_SET_MAX)2081+ return -EINVAL;2082+ if (len < 0 || len > MAX_ARG_LEN)2083+ return -EINVAL;2084 if (len != set_arglen[SET_CMDID(cmd)]) {2085 pr_err("set_ctl: len %u != %u\n",2086 len, set_arglen[SET_CMDID(cmd)]);···2352{2353 unsigned char arg[128];2354 int ret = 0;2355+ unsigned int copylen;23562357 if (!capable(CAP_NET_ADMIN))2358 return -EPERM;2359+2360+ if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_GET_MAX)2361+ return -EINVAL;23622363 if (*len < get_arglen[GET_CMDID(cmd)]) {2364 pr_err("get_ctl: len %u < %u\n",···2362 return -EINVAL;2363 }23642365+ copylen = get_arglen[GET_CMDID(cmd)];2366+ if (copylen > 128)2367+ return -EINVAL;2368+2369+ if (copy_from_user(arg, user, copylen) != 0)2370 return -EFAULT;23712372 if (mutex_lock_interruptible(&__ip_vs_mutex))
+1-14
net/netfilter/ipvs/ip_vs_wrr.c
···24#include <linux/module.h>25#include <linux/kernel.h>26#include <linux/net.h>02728#include <net/ip_vs.h>29···38 int di; /* decreasing interval */39};4041-42-/*43- * Get the gcd of server weights44- */45-static int gcd(int a, int b)46-{47- int c;48-49- while ((c = a % b)) {50- a = b;51- b = c;52- }53- return b;54-}5556static int ip_vs_wrr_gcd_weight(struct ip_vs_service *svc)57{
···24#include <linux/module.h>25#include <linux/kernel.h>26#include <linux/net.h>27+#include <linux/gcd.h>2829#include <net/ip_vs.h>30···37 int di; /* decreasing interval */38};39000000000000004041static int ip_vs_wrr_gcd_weight(struct ip_vs_service *svc)42{
+9-9
net/netfilter/nf_conntrack_ftp.c
···323 struct nf_ct_ftp_master *info, int dir,324 struct sk_buff *skb)325{326- unsigned int i, oldest = NUM_SEQ_TO_REMEMBER;327328 /* Look for oldest: if we find exact match, we're done. */329 for (i = 0; i < info->seq_aft_nl_num[dir]; i++) {330 if (info->seq_aft_nl[dir][i] == nl_seq)331 return;332-333- if (oldest == info->seq_aft_nl_num[dir] ||334- before(info->seq_aft_nl[dir][i],335- info->seq_aft_nl[dir][oldest]))336- oldest = i;337 }338339 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) {340 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq;341- } else if (oldest != NUM_SEQ_TO_REMEMBER &&342- after(nl_seq, info->seq_aft_nl[dir][oldest])) {343- info->seq_aft_nl[dir][oldest] = nl_seq;00000344 }345}346
···323 struct nf_ct_ftp_master *info, int dir,324 struct sk_buff *skb)325{326+ unsigned int i, oldest;327328 /* Look for oldest: if we find exact match, we're done. */329 for (i = 0; i < info->seq_aft_nl_num[dir]; i++) {330 if (info->seq_aft_nl[dir][i] == nl_seq)331 return;00000332 }333334 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) {335 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq;336+ } else {337+ if (before(info->seq_aft_nl[dir][0], info->seq_aft_nl[dir][1]))338+ oldest = 0;339+ else340+ oldest = 1;341+342+ if (after(nl_seq, info->seq_aft_nl[dir][oldest]))343+ info->seq_aft_nl[dir][oldest] = nl_seq;344 }345}346