Skip to content

Commit 7532e8d

Browse files
committed
IPVS: Add sysctl_sync_ver()
In preparation for not including sysctl_sync_ver in struct netns_ipvs when CONFIG_SYCTL is not defined. Signed-off-by: Simon Horman <horms@verge.net.au>
1 parent 59e0350 commit 7532e8d

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎include/net/ip_vs.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ struct netns_ipvs {
911911

912912
#define DEFAULT_SYNC_THRESHOLD 3
913913
#define DEFAULT_SYNC_PERIOD 50
914+
#define DEFAULT_SYNC_VER 1
914915

915916
#ifdef CONFIG_SYSCTL
916917

@@ -924,6 +925,11 @@ static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
924925
return ipvs->sysctl_sync_threshold[1];
925926
}
926927

928+
static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
929+
{
930+
return ipvs->sysctl_sync_ver;
931+
}
932+
927933
#else
928934

929935
static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
@@ -936,6 +942,11 @@ static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
936942
return DEFAULT_SYNC_PERIOD;
937943
}
938944

945+
static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
946+
{
947+
return DEFAULT_SYNC_VER;
948+
}
949+
939950
#endif
940951

941952
/*

‎net/netfilter/ipvs/ip_vs_sync.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ void ip_vs_sync_switch_mode(struct net *net, int mode)
394394

395395
if (!(ipvs->sync_state & IP_VS_STATE_MASTER))
396396
return;
397-
if (mode == ipvs->sysctl_sync_ver || !ipvs->sync_buff)
397+
if (mode == sysctl_sync_ver(ipvs) || !ipvs->sync_buff)
398398
return;
399399

400400
spin_lock_bh(&ipvs->sync_buff_lock);
@@ -521,7 +521,7 @@ void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp)
521521
unsigned int len, pe_name_len, pad;
522522

523523
/* Handle old version of the protocol */
524-
if (ipvs->sysctl_sync_ver == 0) {
524+
if (sysctl_sync_ver(ipvs) == 0) {
525525
ip_vs_sync_conn_v0(net, cp);
526526
return;
527527
}

0 commit comments

Comments
 (0)