···112112 module, choose M here. If unsure, say N.113113114114config IP_VS_WRR115115- tristate "weighted round-robin scheduling" 115115+ tristate "weighted round-robin scheduling"116116+ select GCD116117 ---help---117118 The weighted robin-robin scheduling algorithm directs network118119 connections to different real servers based on server weights
+13-1
net/netfilter/ipvs/ip_vs_ctl.c
···20772077 if (!capable(CAP_NET_ADMIN))20782078 return -EPERM;2079207920802080+ if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_SET_MAX)20812081+ return -EINVAL;20822082+ if (len < 0 || len > MAX_ARG_LEN)20832083+ return -EINVAL;20802084 if (len != set_arglen[SET_CMDID(cmd)]) {20812085 pr_err("set_ctl: len %u != %u\n",20822086 len, set_arglen[SET_CMDID(cmd)]);···23562352{23572353 unsigned char arg[128];23582354 int ret = 0;23552355+ unsigned int copylen;2359235623602357 if (!capable(CAP_NET_ADMIN))23612358 return -EPERM;23592359+23602360+ if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_GET_MAX)23612361+ return -EINVAL;2362236223632363 if (*len < get_arglen[GET_CMDID(cmd)]) {23642364 pr_err("get_ctl: len %u < %u\n",···23702362 return -EINVAL;23712363 }2372236423732373- if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0)23652365+ copylen = get_arglen[GET_CMDID(cmd)];23662366+ if (copylen > 128)23672367+ return -EINVAL;23682368+23692369+ if (copy_from_user(arg, user, copylen) != 0)23742370 return -EFAULT;2375237123762372 if (mutex_lock_interruptible(&__ip_vs_mutex))
+1-14
net/netfilter/ipvs/ip_vs_wrr.c
···2424#include <linux/module.h>2525#include <linux/kernel.h>2626#include <linux/net.h>2727+#include <linux/gcd.h>27282829#include <net/ip_vs.h>2930···3837 int di; /* decreasing interval */3938};40394141-4242-/*4343- * Get the gcd of server weights4444- */4545-static int gcd(int a, int b)4646-{4747- int c;4848-4949- while ((c = a % b)) {5050- a = b;5151- b = c;5252- }5353- return b;5454-}55405641static int ip_vs_wrr_gcd_weight(struct ip_vs_service *svc)5742{
+9-9
net/netfilter/nf_conntrack_ftp.c
···323323 struct nf_ct_ftp_master *info, int dir,324324 struct sk_buff *skb)325325{326326- unsigned int i, oldest = NUM_SEQ_TO_REMEMBER;326326+ unsigned int i, oldest;327327328328 /* Look for oldest: if we find exact match, we're done. */329329 for (i = 0; i < info->seq_aft_nl_num[dir]; i++) {330330 if (info->seq_aft_nl[dir][i] == nl_seq)331331 return;332332-333333- if (oldest == info->seq_aft_nl_num[dir] ||334334- before(info->seq_aft_nl[dir][i],335335- info->seq_aft_nl[dir][oldest]))336336- oldest = i;337332 }338333339334 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) {340335 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq;341341- } else if (oldest != NUM_SEQ_TO_REMEMBER &&342342- after(nl_seq, info->seq_aft_nl[dir][oldest])) {343343- info->seq_aft_nl[dir][oldest] = nl_seq;336336+ } else {337337+ if (before(info->seq_aft_nl[dir][0], info->seq_aft_nl[dir][1]))338338+ oldest = 0;339339+ else340340+ oldest = 1;341341+342342+ if (after(nl_seq, info->seq_aft_nl[dir][oldest]))343343+ info->seq_aft_nl[dir][oldest] = nl_seq;344344 }345345}346346