* [PATCH] CLUSTERIP: iptables extension update
@ 2005-08-30 15:42 KOVACS Krisztian
2005-08-31 7:48 ` Harald Welte
2005-09-19 14:45 ` Harald Welte
0 siblings, 2 replies; 4+ messages in thread
From: KOVACS Krisztian @ 2005-08-30 15:42 UTC (permalink / raw)
To: netfilter-devel; +Cc: Harald Welte
Hi,
Some CLUSTERIP iptables extension updates:
* specifying random seed for the Jenkins hash works as documented
* iptables-save seems to work now
Harald, could you please review this patch and commit it to SVN if
you have no objections?
Index: extensions/libipt_CLUSTERIP.c
===================================================================
--- extensions/libipt_CLUSTERIP.c (revision 4244)
+++ extensions/libipt_CLUSTERIP.c (working copy)
@@ -32,17 +32,25 @@
" --clustermac <mac> Set clusterIP MAC address\n"
" --total-nodes <num> Set number of total nodes in cluster\n"
" --local-node <num> Set the local node number\n"
-" --hash-init\n"
+" --hash-init <num> Set init value of the Jenkins hash\n"
"\n",
IPTABLES_VERSION);
}
+#define PARAM_NEW 0x0001
+#define PARAM_HMODE 0x0002
+#define PARAM_MAC 0x0004
+#define PARAM_TOTALNODE 0x0008
+#define PARAM_LOCALNODE 0x0010
+#define PARAM_HASHINIT 0x0020
+
static struct option opts[] = {
{ "new", 0, 0, '1' },
{ "hashmode", 1, 0, '2' },
{ "clustermac", 1, 0, '3' },
{ "total-nodes", 1, 0, '4' },
{ "local-node", 1, 0, '5' },
+ { "hash-init", 1, 0, '6' },
{ 0 }
};
@@ -75,12 +83,6 @@
}
}
-#define PARAM_NEW 0x0001
-#define PARAM_HMODE 0x0002
-#define PARAM_MAC 0x0004
-#define PARAM_TOTALNODE 0x0008
-#define PARAM_LOCALNODE 0x0010
-
static int
parse(int c, char **argv, int invert, unsigned int *flags,
const struct ipt_entry *entry,
@@ -144,6 +146,16 @@
cipinfo->local_nodes[0] = (u_int16_t)num;
*flags |= PARAM_LOCALNODE;
break;
+ case '6':
+ if (!(*flags & PARAM_NEW))
+ exit_error(PARAMETER_PROBLEM, "Can only specify hash init value
combined with `--new'\n");
+ if (*flags & PARAM_HASHINIT)
+ exit_error(PARAMETER_PROBLEM, "Can specify hash init value only
once\n");
+ if (string_to_number(optarg, 0, UINT_MAX, &num) < 0)
+ exit_error(PARAMETER_PROBLEM, "Unable to parse `%s'\n", optarg);
+ cipinfo->hash_initval = num;
+ *flags |= PARAM_HASHINIT;
+ break;
default:
return 0;
}
@@ -157,7 +169,8 @@
if (flags == 0)
return;
- if (flags == (PARAM_NEW|PARAM_HMODE|PARAM_MAC|PARAM_TOTALNODE|
PARAM_LOCALNODE))
+ if (flags & (PARAM_NEW|PARAM_HMODE|PARAM_MAC|PARAM_TOTALNODE|
PARAM_LOCALNODE)
+ == (PARAM_NEW|PARAM_HMODE|PARAM_MAC|PARAM_TOTALNODE|PARAM_LOCALNODE))
return;
exit_error(PARAMETER_PROBLEM, "CLUSTERIP target: Invalid parameter
combination\n");
@@ -206,36 +219,32 @@
return;
}
- printf("CLUSTERIP hashmode=%s clustermac=%s total_nodes=%u
local_node=%u ",
+ printf("CLUSTERIP hashmode=%s clustermac=%s total_nodes=%u
local_node=%u hash_init=%u",
hashmode2str(cipinfo->hash_mode),
mac2str(cipinfo->clustermac),
cipinfo->num_total_nodes,
- cipinfo->local_nodes[0]);
+ cipinfo->local_nodes[0],
+ cipinfo->hash_initval);
}
/* Saves the union ipt_targinfo in parsable form to stdout. */
static void
save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
{
- /*
- const struct ipt_connmark_target_info *markinfo =
- (const struct ipt_connmark_target_info *)target->data;
+ const struct ipt_clusterip_tgt_info *cipinfo =
+ (const struct ipt_clusterip_tgt_info *)target->data;
- switch (markinfo->mode) {
- case IPT_CONNMARK_SET:
- printf("--set-mark 0x%lx ", markinfo->mark);
- break;
- case IPT_CONNMARK_SAVE:
- printf("--save-mark ");
- break;
- case IPT_CONNMARK_RESTORE:
- printf("--restore-mark ");
- break;
- default:
- printf("ERROR: UNKNOWN CONNMARK MODE ");
- break;
- }
- */
+ /* if this is not a new entry, we don't need to save target
+ * parameters */
+ if (!cipinfo->flags & CLUSTERIP_FLAG_NEW)
+ return;
+
+ printf("--new --hashmode %s --clustermac %s --total-nodes %d
--local-node %d --hash-init %u",
+ hashmode2str(cipinfo->hash_mode),
+ mac2str(cipinfo->clustermac),
+ cipinfo->num_total_nodes,
+ cipinfo->local_nodes[0],
+ cipinfo->hash_initval);
}
static struct iptables_target clusterip = {
--
Regards,
Krisztian Kovacs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] CLUSTERIP: iptables extension update
2005-08-30 15:42 [PATCH] CLUSTERIP: iptables extension update KOVACS Krisztian
@ 2005-08-31 7:48 ` Harald Welte
2005-08-31 8:01 ` KOVACS Krisztian
2005-09-19 14:45 ` Harald Welte
1 sibling, 1 reply; 4+ messages in thread
From: Harald Welte @ 2005-08-31 7:48 UTC (permalink / raw)
To: KOVACS Krisztian; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]
On Tue, Aug 30, 2005 at 05:42:08PM +0200, KOVACS Krisztian wrote:
>
> Hi,
>
> Some CLUSTERIP iptables extension updates:
>
> * specifying random seed for the Jenkins hash works as documented
> * iptables-save seems to work now
Thanks, Krisztian!
> Harald, could you please review this patch and commit it to SVN if
> you have no objections?
I have no objections to the patch, but to the line-wrapping or other
disturbance that your client inserted. At least for me, the patch
doesn't apply:
patch: **** malformed patch at line 79: combined with `--new'\n");
Please resend as mime attachment (which is my preferred
format anyway). Also (for future patches), please make it apply with
"-p1" to make my job a bit easier. Thanks!
--
- Harald Welte <laforge@netfilter.org> http://netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] CLUSTERIP: iptables extension update
2005-08-31 7:48 ` Harald Welte
@ 2005-08-31 8:01 ` KOVACS Krisztian
0 siblings, 0 replies; 4+ messages in thread
From: KOVACS Krisztian @ 2005-08-31 8:01 UTC (permalink / raw)
To: Harald Welte; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
Hi,
On Wednesday 31 August 2005 09.48, Harald Welte wrote:
> I have no objections to the patch, but to the line-wrapping or other
> disturbance that your client inserted. At least for me, the patch
> doesn't apply:
>
> Please resend as mime attachment (which is my preferred
> format anyway). Also (for future patches), please make it apply with
> "-p1" to make my job a bit easier. Thanks!
Sorry for the inconvenience, I've attached the hopefully fixed patch.
--
Regards,
Krisztian Kovacs
[-- Attachment #2: iptables.patch --]
[-- Type: text/x-diff, Size: 3764 bytes --]
Index: iptables/extensions/libipt_CLUSTERIP.c
===================================================================
--- iptables/extensions/libipt_CLUSTERIP.c (revision 4253)
+++ iptables/extensions/libipt_CLUSTERIP.c (working copy)
@@ -32,17 +32,25 @@
" --clustermac <mac> Set clusterIP MAC address\n"
" --total-nodes <num> Set number of total nodes in cluster\n"
" --local-node <num> Set the local node number\n"
-" --hash-init\n"
+" --hash-init <num> Set init value of the Jenkins hash\n"
"\n",
IPTABLES_VERSION);
}
+#define PARAM_NEW 0x0001
+#define PARAM_HMODE 0x0002
+#define PARAM_MAC 0x0004
+#define PARAM_TOTALNODE 0x0008
+#define PARAM_LOCALNODE 0x0010
+#define PARAM_HASHINIT 0x0020
+
static struct option opts[] = {
{ "new", 0, 0, '1' },
{ "hashmode", 1, 0, '2' },
{ "clustermac", 1, 0, '3' },
{ "total-nodes", 1, 0, '4' },
{ "local-node", 1, 0, '5' },
+ { "hash-init", 1, 0, '6' },
{ 0 }
};
@@ -75,12 +83,6 @@
}
}
-#define PARAM_NEW 0x0001
-#define PARAM_HMODE 0x0002
-#define PARAM_MAC 0x0004
-#define PARAM_TOTALNODE 0x0008
-#define PARAM_LOCALNODE 0x0010
-
static int
parse(int c, char **argv, int invert, unsigned int *flags,
const struct ipt_entry *entry,
@@ -144,6 +146,16 @@
cipinfo->local_nodes[0] = (u_int16_t)num;
*flags |= PARAM_LOCALNODE;
break;
+ case '6':
+ if (!(*flags & PARAM_NEW))
+ exit_error(PARAMETER_PROBLEM, "Can only specify hash init value combined with `--new'\n");
+ if (*flags & PARAM_HASHINIT)
+ exit_error(PARAMETER_PROBLEM, "Can specify hash init value only once\n");
+ if (string_to_number(optarg, 0, UINT_MAX, &num) < 0)
+ exit_error(PARAMETER_PROBLEM, "Unable to parse `%s'\n", optarg);
+ cipinfo->hash_initval = num;
+ *flags |= PARAM_HASHINIT;
+ break;
default:
return 0;
}
@@ -157,7 +169,8 @@
if (flags == 0)
return;
- if (flags == (PARAM_NEW|PARAM_HMODE|PARAM_MAC|PARAM_TOTALNODE|PARAM_LOCALNODE))
+ if (flags & (PARAM_NEW|PARAM_HMODE|PARAM_MAC|PARAM_TOTALNODE|PARAM_LOCALNODE)
+ == (PARAM_NEW|PARAM_HMODE|PARAM_MAC|PARAM_TOTALNODE|PARAM_LOCALNODE))
return;
exit_error(PARAMETER_PROBLEM, "CLUSTERIP target: Invalid parameter combination\n");
@@ -206,36 +219,32 @@
return;
}
- printf("CLUSTERIP hashmode=%s clustermac=%s total_nodes=%u local_node=%u ",
+ printf("CLUSTERIP hashmode=%s clustermac=%s total_nodes=%u local_node=%u hash_init=%u",
hashmode2str(cipinfo->hash_mode),
mac2str(cipinfo->clustermac),
cipinfo->num_total_nodes,
- cipinfo->local_nodes[0]);
+ cipinfo->local_nodes[0],
+ cipinfo->hash_initval);
}
/* Saves the union ipt_targinfo in parsable form to stdout. */
static void
save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
{
- /*
- const struct ipt_connmark_target_info *markinfo =
- (const struct ipt_connmark_target_info *)target->data;
+ const struct ipt_clusterip_tgt_info *cipinfo =
+ (const struct ipt_clusterip_tgt_info *)target->data;
- switch (markinfo->mode) {
- case IPT_CONNMARK_SET:
- printf("--set-mark 0x%lx ", markinfo->mark);
- break;
- case IPT_CONNMARK_SAVE:
- printf("--save-mark ");
- break;
- case IPT_CONNMARK_RESTORE:
- printf("--restore-mark ");
- break;
- default:
- printf("ERROR: UNKNOWN CONNMARK MODE ");
- break;
- }
- */
+ /* if this is not a new entry, we don't need to save target
+ * parameters */
+ if (!cipinfo->flags & CLUSTERIP_FLAG_NEW)
+ return;
+
+ printf("--new --hashmode %s --clustermac %s --total-nodes %d --local-node %d --hash-init %u",
+ hashmode2str(cipinfo->hash_mode),
+ mac2str(cipinfo->clustermac),
+ cipinfo->num_total_nodes,
+ cipinfo->local_nodes[0],
+ cipinfo->hash_initval);
}
static struct iptables_target clusterip = {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] CLUSTERIP: iptables extension update
2005-08-30 15:42 [PATCH] CLUSTERIP: iptables extension update KOVACS Krisztian
2005-08-31 7:48 ` Harald Welte
@ 2005-09-19 14:45 ` Harald Welte
1 sibling, 0 replies; 4+ messages in thread
From: Harald Welte @ 2005-09-19 14:45 UTC (permalink / raw)
To: KOVACS Krisztian; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 763 bytes --]
On Tue, Aug 30, 2005 at 05:42:08PM +0200, KOVACS Krisztian wrote:
>
> Hi,
>
> Some CLUSTERIP iptables extension updates:
>
> * specifying random seed for the Jenkins hash works as documented
> * iptables-save seems to work now
>
> Harald, could you please review this patch and commit it to SVN if
> you have no objections?
finally catching up, patch applied.
--
- Harald Welte <laforge@netfilter.org> http://netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-09-19 14:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-30 15:42 [PATCH] CLUSTERIP: iptables extension update KOVACS Krisztian
2005-08-31 7:48 ` Harald Welte
2005-08-31 8:01 ` KOVACS Krisztian
2005-09-19 14:45 ` Harald Welte
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.