summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0b02f79)
raw | patch | inline | side by side (parent: 0b02f79)
author | Jan Engelhardt <jengelh@medozas.de> | |
Tue, 16 Feb 2010 20:16:47 +0000 (21:16 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 9 Mar 2010 15:59:38 +0000 (16:59 +0100) |
libiptc: avoid strict-aliasing warnings
In file included from libiptc/libip4tc.c:117:0:
libiptc/libiptc.c: In function ‘__iptcc_p_del_policy’:
libiptc/libiptc.c:826:4: warning: dereferencing type-punned pointer will break
strict-aliasing rules
libiptc/libiptc.c: In function ‘iptc_get_target’:
libiptc/libiptc.c:1650:4: warning: dereferencing type-punned pointer will break
strict-aliasing rules
libiptc/libip4tc.c: In function ‘dump_entry’:
libiptc/libip4tc.c:157:3: warning: dereferencing type-punned pointer will break
strict-aliasing rules
CC libiptc/libip6tc.lo
In file included from libiptc/libip6tc.c:112:0:
libiptc/libiptc.c: In function ‘__iptcc_p_del_policy’:
libiptc/libiptc.c:826:4: warning: dereferencing type-punned pointer will break
strict-aliasing rules
libiptc/libiptc.c: In function ‘ip6tc_get_target’:
libiptc/libiptc.c:1650:4: warning: dereferencing type-punned pointer will break
strict-aliasing rules
libiptc/libip6tc.c: In function ‘dump_entry’:
libiptc/libip6tc.c:188:3: warning: dereferencing type-punned pointer will break
strict-aliasing rules
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Rebased for collectd/src/owniptc: Alan Pevec <apevec@gmail.com>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
In file included from libiptc/libip4tc.c:117:0:
libiptc/libiptc.c: In function ‘__iptcc_p_del_policy’:
libiptc/libiptc.c:826:4: warning: dereferencing type-punned pointer will break
strict-aliasing rules
libiptc/libiptc.c: In function ‘iptc_get_target’:
libiptc/libiptc.c:1650:4: warning: dereferencing type-punned pointer will break
strict-aliasing rules
libiptc/libip4tc.c: In function ‘dump_entry’:
libiptc/libip4tc.c:157:3: warning: dereferencing type-punned pointer will break
strict-aliasing rules
CC libiptc/libip6tc.lo
In file included from libiptc/libip6tc.c:112:0:
libiptc/libiptc.c: In function ‘__iptcc_p_del_policy’:
libiptc/libiptc.c:826:4: warning: dereferencing type-punned pointer will break
strict-aliasing rules
libiptc/libiptc.c: In function ‘ip6tc_get_target’:
libiptc/libiptc.c:1650:4: warning: dereferencing type-punned pointer will break
strict-aliasing rules
libiptc/libip6tc.c: In function ‘dump_entry’:
libiptc/libip6tc.c:188:3: warning: dereferencing type-punned pointer will break
strict-aliasing rules
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Rebased for collectd/src/owniptc: Alan Pevec <apevec@gmail.com>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/owniptc/libip4tc.c | patch | blob | history | |
src/owniptc/libip6tc.c | patch | blob | history | |
src/owniptc/libiptc.c | patch | blob | history |
diff --git a/src/owniptc/libip4tc.c b/src/owniptc/libip4tc.c
index 66abb44c2f3d1718b05956b23b9aac95183e9653..bf7327cd87936fb07ec6b18d241d0fe8cffe1333 100644 (file)
--- a/src/owniptc/libip4tc.c
+++ b/src/owniptc/libip4tc.c
t = GET_TARGET(e);
printf("Target name: `%s' [%u]\n", t->u.user.name, t->u.target_size);
if (strcmp(t->u.user.name, STANDARD_TARGET) == 0) {
- int pos = *(int *)t->data;
+ const unsigned char *data = t->data;
+ int pos = *(const int *)data;
if (pos < 0)
printf("verdict=%s\n",
pos == -NF_ACCEPT-1 ? "NF_ACCEPT"
diff --git a/src/owniptc/libip6tc.c b/src/owniptc/libip6tc.c
index 276b7af8fa3769eee00157277d3f887e1e7628d0..672dae12d289b49692d9642fe8849295278fdaee 100644 (file)
--- a/src/owniptc/libip6tc.c
+++ b/src/owniptc/libip6tc.c
t = ip6t_get_target(e);
printf("Target name: `%s' [%u]\n", t->u.user.name, t->u.target_size);
if (strcmp(t->u.user.name, IP6T_STANDARD_TARGET) == 0) {
- int pos = *(int *)t->data;
+ const unsigned char *data = t->data;
+ int pos = *(const int *)data;
if (pos < 0)
printf("verdict=%s\n",
pos == -NF_ACCEPT-1 ? "NF_ACCEPT"
diff --git a/src/owniptc/libiptc.c b/src/owniptc/libiptc.c
index 5e5fde083cdbed549fa5fe439e8f9dc49b810700..8f0b0f0972e1cdfaa4d0346c9141d3f65e98ffab 100644 (file)
--- a/src/owniptc/libiptc.c
+++ b/src/owniptc/libiptc.c
* to be called from specific places within the parser */
static int __iptcc_p_del_policy(TC_HANDLE_T h, unsigned int num)
{
+ const unsigned char *data;
+
if (h->chain_iterator_cur) {
/* policy rule is last rule */
struct rule_head *pr = (struct rule_head *)
h->chain_iterator_cur->rules.prev;
/* save verdict */
- h->chain_iterator_cur->verdict =
- *(int *)GET_TARGET(pr->entry)->data;
+ data = GET_TARGET(pr->entry)->data;
+ h->chain_iterator_cur->verdict = *(const int *)data;
/* save counter and counter_map information */
h->chain_iterator_cur->counter_map.maptype =
{
STRUCT_ENTRY *e = (STRUCT_ENTRY *)ce;
struct rule_head *r = container_of(e, struct rule_head, entry[0]);
+ const unsigned char *data;
iptc_fn = TC_GET_TARGET;
return r->jump->name;
break;
case IPTCC_R_STANDARD:
- spos = *(int *)GET_TARGET(e)->data;
+ data = GET_TARGET(e)->data;
+ spos = *(const int *)data;
DEBUGP("r=%p, spos=%d'\n", r, spos);
return standard_target_map(spos);
break;