summaryrefslogtreecommitdiffstats
path: root/libiptc
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2009-10-23 23:35:49 +0200
committerHarald Welte <laforge@gnumonks.org>2009-10-25 11:01:25 +0100
commit51651b64fffc58d4f58d005fa7dc0d9669147c57 (patch)
tree8545ab47492ea3a787960eac20cc54d55f3dc813 /libiptc
parenta9c79c7ba494b39bad959a0c833e58a343686272 (diff)
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>
Diffstat (limited to 'libiptc')
-rw-r--r--libiptc/libip4tc.c3
-rw-r--r--libiptc/libip6tc.c3
-rw-r--r--libiptc/libiptc.c10
3 files changed, 11 insertions, 5 deletions
diff --git a/libiptc/libip4tc.c b/libiptc/libip4tc.c
index 1f33f1c9..3c7b0738 100644
--- a/libiptc/libip4tc.c
+++ b/libiptc/libip4tc.c
@@ -154,7 +154,8 @@ dump_entry(STRUCT_ENTRY *e, struct iptc_handle *const handle)
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/libiptc/libip6tc.c b/libiptc/libip6tc.c
index 59668418..27fe4c4e 100644
--- a/libiptc/libip6tc.c
+++ b/libiptc/libip6tc.c
@@ -185,7 +185,8 @@ dump_entry(struct ip6t_entry *e, struct ip6tc_handle *const handle)
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/libiptc/libiptc.c b/libiptc/libiptc.c
index b445331e..670acf53 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -816,14 +816,16 @@ static void iptcc_delete_rule(struct rule_head *r)
* to be called from specific places within the parser */
static int __iptcc_p_del_policy(struct xtc_handle *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 =
@@ -1595,6 +1597,7 @@ const char *TC_GET_TARGET(const STRUCT_ENTRY *ce,
{
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;
@@ -1608,7 +1611,8 @@ const char *TC_GET_TARGET(const STRUCT_ENTRY *ce,
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;