[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.1.10.0807162344420.17284@titan.stealer.net>
Date: Thu, 17 Jul 2008 00:04:45 +0200 (CEST)
From: Sven Wegener <sven.wegener@...aler.net>
To: wensong@...ux-vs.org, horms@...ge.net.au, ja@....bg
cc: netdev@...r.kernel.org
Subject: [PATCH 1/5] ipvs: Initialize mcast addr at compile time
There's no need to do it at runtime, the values are constant.
Signed-off-by: Sven Wegener <sven.wegener@...aler.net>
---
net/ipv4/ipvs/ip_vs_sync.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
The hton* in the last version should be __constant_hton*. hton* normally
works for initialization in global scope, but the check for constant
values seems to be hidden in some ifdef and is not available in all cases.
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
index eff54ef..b889276 100644
--- a/net/ipv4/ipvs/ip_vs_sync.c
+++ b/net/ipv4/ipvs/ip_vs_sync.c
@@ -141,7 +141,11 @@ char ip_vs_master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
char ip_vs_backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
/* multicast addr */
-static struct sockaddr_in mcast_addr;
+static struct sockaddr_in mcast_addr = {
+ .sin_family = AF_INET,
+ .sin_port = __constant_htons(IP_VS_SYNC_PORT),
+ .sin_addr.s_addr = __constant_htonl(IP_VS_SYNC_GROUP),
+};
static inline void sb_queue_tail(struct ip_vs_sync_buff *sb)
@@ -864,11 +868,6 @@ static int sync_thread(void *startup)
/* set the maximum length of sync message */
set_sync_mesg_maxlen(state);
- /* set up multicast address */
- mcast_addr.sin_family = AF_INET;
- mcast_addr.sin_port = htons(IP_VS_SYNC_PORT);
- mcast_addr.sin_addr.s_addr = htonl(IP_VS_SYNC_GROUP);
-
add_wait_queue(&sync_wait, &wait);
set_sync_pid(state, task_pid_nr(current));
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists