Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys build pf module with WARNS=3, and remove the need for -W...



details:   https://anonhg.NetBSD.org/src/rev/47297692eaa5
branches:  trunk
changeset: 768921:47297692eaa5
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Aug 29 09:50:04 2011 +0000

description:
build pf module with WARNS=3, and remove the need for -Wno-shadow

diffstat:

 sys/dist/pf/net/pf.c       |  28 ++++++++--------
 sys/dist/pf/net/pf_ioctl.c |  69 +++++++++++++++++++++---------------------
 sys/dist/pf/net/pf_norm.c  |  74 +++++++++++++++++++++++-----------------------
 sys/modules/pf/Makefile    |   3 +-
 sys/net/files.pf           |   6 +---
 5 files changed, 87 insertions(+), 93 deletions(-)

diffs (truncated from 560 to 300 lines):

diff -r e728c73cca9d -r 47297692eaa5 sys/dist/pf/net/pf.c
--- a/sys/dist/pf/net/pf.c      Mon Aug 29 08:58:18 2011 +0000
+++ b/sys/dist/pf/net/pf.c      Mon Aug 29 09:50:04 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf.c,v 1.65 2011/05/03 18:28:45 dyoung Exp $   */
+/*     $NetBSD: pf.c,v 1.66 2011/08/29 09:50:04 jmcneill Exp $ */
 /*     $OpenBSD: pf.c,v 1.552.2.1 2007/11/27 16:37:57 henning Exp $ */
 
 /*
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.65 2011/05/03 18:28:45 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.66 2011/08/29 09:50:04 jmcneill Exp $");
 
 #include "pflog.h"
 
@@ -3436,14 +3436,14 @@
                    (r->rule_flag & PFRULE_RETURN)) &&
                    !(th->th_flags & TH_RST)) {
                        u_int32_t        ack = ntohl(th->th_seq) + pd->p_len;
-                       struct ip       *h = mtod(m, struct ip *);
+                       struct ip       *hip = mtod(m, struct ip *);
 
 #ifdef __NetBSD__
                        if (pf_check_proto_cksum(m, direction, off,
-                           ntohs(h->ip_len) - off, IPPROTO_TCP, AF_INET))
+                           ntohs(hip->ip_len) - off, IPPROTO_TCP, AF_INET))
 #else
                        if (pf_check_proto_cksum(m, off,
-                           ntohs(h->ip_len) - off, IPPROTO_TCP, AF_INET))
+                           ntohs(hip->ip_len) - off, IPPROTO_TCP, AF_INET))
 #endif /* !__NetBSD__ */
                                REASON_SET(&reason, PFRES_PROTCKSUM);
                        else {
@@ -3877,14 +3877,14 @@
                        (*state)->src.state = PF_TCPS_PROXY_DST;
        }
        if ((*state)->src.state == PF_TCPS_PROXY_DST) {
-               struct pf_state_host *src, *dst;
+               struct pf_state_host *psrc, *pdst;
 
                if (direction == PF_OUT) {
-                       src = &(*state)->state_key->gwy;
-                       dst = &(*state)->state_key->ext;
+                       psrc = &(*state)->state_key->gwy;
+                       pdst = &(*state)->state_key->ext;
                } else {
-                       src = &(*state)->state_key->ext;
-                       dst = &(*state)->state_key->lan;
+                       psrc = &(*state)->state_key->ext;
+                       pdst = &(*state)->state_key->lan;
                }
                if (direction == (*state)->state_key->direction) {
                        if (((th->th_flags & (TH_SYN|TH_ACK)) != TH_ACK) ||
@@ -3896,8 +3896,8 @@
                        (*state)->src.max_win = MAX(ntohs(th->th_win), 1);
                        if ((*state)->dst.seqhi == 1)
                                (*state)->dst.seqhi = htonl(arc4random());
-                       pf_send_tcp((*state)->rule.ptr, pd->af, &src->addr,
-                           &dst->addr, src->port, dst->port,
+                       pf_send_tcp((*state)->rule.ptr, pd->af, &psrc->addr,
+                           &pdst->addr, psrc->port, pdst->port,
                            (*state)->dst.seqhi, 0, TH_SYN, 0,
                            (*state)->src.mss, 0, 0, (*state)->tag, NULL, NULL);
                        REASON_SET(reason, PFRES_SYNPROXY);
@@ -3915,8 +3915,8 @@
                            ntohl(th->th_ack), ntohl(th->th_seq) + 1,
                            TH_ACK, (*state)->src.max_win, 0, 0, 0,
                            (*state)->tag, NULL, NULL);
-                       pf_send_tcp((*state)->rule.ptr, pd->af, &src->addr,
-                           &dst->addr, src->port, dst->port,
+                       pf_send_tcp((*state)->rule.ptr, pd->af, &psrc->addr,
+                           &pdst->addr, psrc->port, pdst->port,
                            (*state)->src.seqhi + 1, (*state)->src.seqlo + 1,
                            TH_ACK, (*state)->dst.max_win, 0, 0, 1,
                            0, NULL, NULL);
diff -r e728c73cca9d -r 47297692eaa5 sys/dist/pf/net/pf_ioctl.c
--- a/sys/dist/pf/net/pf_ioctl.c        Mon Aug 29 08:58:18 2011 +0000
+++ b/sys/dist/pf/net/pf_ioctl.c        Mon Aug 29 09:50:04 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf_ioctl.c,v 1.43 2011/01/19 19:58:02 drochner Exp $   */
+/*     $NetBSD: pf_ioctl.c,v 1.44 2011/08/29 09:50:04 jmcneill Exp $   */
 /*     $OpenBSD: pf_ioctl.c,v 1.182 2007/06/24 11:17:13 mcbride Exp $ */
 
 /*
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pf_ioctl.c,v 1.43 2011/01/19 19:58:02 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf_ioctl.c,v 1.44 2011/08/29 09:50:04 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1370,7 +1370,6 @@
                struct pfioc_rule       *pr = (struct pfioc_rule *)addr;
                struct pf_ruleset       *ruleset;
                struct pf_rule          *rule, *tail;
-               struct pf_pooladdr      *pa;
                int                      rs_num;
 
                pr->anchor[sizeof(pr->anchor) - 1] = 0;
@@ -1830,20 +1829,20 @@
        }
 
        case DIOCCLRSTATES: {
-               struct pf_state         *s, *nexts;
+               struct pf_state         *ps, *nexts;
                struct pfioc_state_kill *psk = (struct pfioc_state_kill *)addr;
                int                      killed = 0;
 
-               for (s = RB_MIN(pf_state_tree_id, &tree_id); s; s = nexts) {
-                       nexts = RB_NEXT(pf_state_tree_id, &tree_id, s);
+               for (ps = RB_MIN(pf_state_tree_id, &tree_id); ps; ps = nexts) {
+                       nexts = RB_NEXT(pf_state_tree_id, &tree_id, ps);
 
                        if (!psk->psk_ifname[0] || !strcmp(psk->psk_ifname,
-                           s->kif->pfik_name)) {
+                           ps->kif->pfik_name)) {
 #if NPFSYNC
                                /* don't send out individual delete messages */
-                               s->sync_flags = PFSTATE_NOSYNC;
+                               ps->sync_flags = PFSTATE_NOSYNC;
 #endif
-                               pf_unlink_state(s);
+                               pf_unlink_state(ps);
                                killed++;
                        }
                }
@@ -1855,16 +1854,16 @@
        }
 
        case DIOCKILLSTATES: {
-               struct pf_state         *s, *nexts;
+               struct pf_state         *ps, *nexts;
                struct pf_state_key     *sk;
                struct pf_state_host    *src, *dst;
                struct pfioc_state_kill *psk = (struct pfioc_state_kill *)addr;
                int                      killed = 0;
 
-               for (s = RB_MIN(pf_state_tree_id, &tree_id); s;
-                   s = nexts) {
-                       nexts = RB_NEXT(pf_state_tree_id, &tree_id, s);
-                       sk = s->state_key;
+               for (ps = RB_MIN(pf_state_tree_id, &tree_id); ps;
+                   ps = nexts) {
+                       nexts = RB_NEXT(pf_state_tree_id, &tree_id, ps);
+                       sk = ps->state_key;
 
                        if (sk->direction == PF_OUT) {
                                src = &sk->lan;
@@ -1893,13 +1892,13 @@
                            psk->psk_dst.port[0], psk->psk_dst.port[1],
                            dst->port)) &&
                            (!psk->psk_ifname[0] || !strcmp(psk->psk_ifname,
-                           s->kif->pfik_name))) {
+                           ps->kif->pfik_name))) {
 #if NPFSYNC > 0
                                /* send immediate delete of state */
-                               pfsync_delete_state(s);
-                               s->sync_flags |= PFSTATE_NOSYNC;
+                               pfsync_delete_state(ps);
+                               ps->sync_flags |= PFSTATE_NOSYNC;
 #endif
-                               pf_unlink_state(s);
+                               pf_unlink_state(ps);
                                killed++;
                        }
                }
@@ -1945,22 +1944,22 @@
 
        case DIOCGETSTATE: {
                struct pfioc_state      *ps = (struct pfioc_state *)addr;
-               struct pf_state         *s;
+               struct pf_state         *pfs;
                u_int32_t                nr;
 
                nr = 0;
-               RB_FOREACH(s, pf_state_tree_id, &tree_id) {
+               RB_FOREACH(pfs, pf_state_tree_id, &tree_id) {
                        if (nr >= ps->nr)
                                break;
                        nr++;
                }
-               if (s == NULL) {
+               if (pfs == NULL) {
                        error = EBUSY;
                        break;
                }
 
                pf_state_export((struct pfsync_state *)&ps->state,
-                   s->state_key, s);
+                   pfs->state_key, pfs);
                break;
        }
 
@@ -2006,9 +2005,9 @@
        }
 
        case DIOCGETSTATUS: {
-               struct pf_status *s = (struct pf_status *)addr;
-               bcopy(&pf_status, s, sizeof(struct pf_status));
-               pfi_fill_oldstatus(s);
+               struct pf_status *ps = (struct pf_status *)addr;
+               bcopy(&pf_status, ps, sizeof(struct pf_status));
+               pfi_fill_oldstatus(ps);
                break;
        }
 
@@ -3136,7 +3135,7 @@
 
        case DIOCKILLSRCNODES: {
                struct pf_src_node      *sn;
-               struct pf_state         *s;
+               struct pf_state         *ps;
                struct pfioc_src_node_kill *psnk = \
                        (struct pfioc_src_node_kill *) addr;
                int                     killed = 0;
@@ -3152,12 +3151,12 @@
                                      &sn->raddr, sn->af)) {
                                /* Handle state to src_node linkage */
                                if (sn->states != 0) {
-                                       RB_FOREACH(s, pf_state_tree_id, 
+                                       RB_FOREACH(ps, pf_state_tree_id, 
                                            &tree_id) {
-                                               if (s->src_node == sn)
-                                                       s->src_node = NULL;
-                                               if (s->nat_src_node == sn)
-                                                       s->nat_src_node = NULL;
+                                               if (ps->src_node == sn)
+                                                       ps->src_node = NULL;
+                                               if (ps->nat_src_node == sn)
+                                                       ps->nat_src_node = NULL;
                                        }
                                        sn->states = 0;
                                }
@@ -3174,12 +3173,12 @@
        }
 
        case DIOCSETHOSTID: {
-               u_int32_t       *hostid = (u_int32_t *)addr;
-
-               if (*hostid == 0)
+               u_int32_t       *hid = (u_int32_t *)addr;
+
+               if (*hid == 0)
                        pf_status.hostid = arc4random();
                else
-                       pf_status.hostid = *hostid;
+                       pf_status.hostid = *hid;
                break;
        }
 
diff -r e728c73cca9d -r 47297692eaa5 sys/dist/pf/net/pf_norm.c
--- a/sys/dist/pf/net/pf_norm.c Mon Aug 29 08:58:18 2011 +0000
+++ b/sys/dist/pf/net/pf_norm.c Mon Aug 29 09:50:04 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf_norm.c,v 1.24 2011/07/01 02:33:23 mrg Exp $ */
+/*     $NetBSD: pf_norm.c,v 1.25 2011/08/29 09:50:04 jmcneill Exp $    */
 /*     $OpenBSD: pf_norm.c,v 1.109 2007/05/28 17:16:39 henning Exp $ */
 
 /*
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pf_norm.c,v 1.24 2011/07/01 02:33:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf_norm.c,v 1.25 2011/08/29 09:50:04 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -365,7 +365,7 @@
        int              hlen = ip->ip_hl << 2;
        u_int16_t        off = (ntohs(ip->ip_off) & IP_OFFMASK) << 3;
        u_int16_t        ip_len = ntohs(ip->ip_len) - ip->ip_hl * 4;
-       u_int16_t        max = ip_len + off;
+       u_int16_t        frmax = ip_len + off;
 
        KASSERT(*frag == NULL || BUFFER_FRAGMENTS(*frag));
 
@@ -459,8 +459,8 @@
 
  insert:
        /* Update maximum data size */
-       if ((*frag)->fr_max < max)
-               (*frag)->fr_max = max;
+       if ((*frag)->fr_max < frmax)
+               (*frag)->fr_max = frmax;
        /* This is the last segment */
        if (!mff)
                (*frag)->fr_flags |= PFFRAG_SEENLAST;
@@ -564,7 +564,7 @@
        struct pf_frcache       *frp, *fra, *cur = NULL;
        int                      ip_len = ntohs(h->ip_len) - (h->ip_hl << 2);
        u_int16_t                off = ntohs(h->ip_off) << 3;
-       u_int16_t                max = ip_len + off;
+       u_int16_t                frmax = ip_len + off;
        int                      hosed = 0;



Home | Main Index | Thread Index | Old Index