Source-Changes-HG archive

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

[src/trunk]: src/sys/dist/pf/net remove no longer needed caddr_t casts to red...



details:   https://anonhg.NetBSD.org/src/rev/4dc2d9b686d4
branches:  trunk
changeset: 569828:4dc2d9b686d4
user:      yamt <yamt%NetBSD.org@localhost>
date:      Wed Sep 08 12:11:25 2004 +0000

description:
remove no longer needed caddr_t casts to reduce diffs from openbsd.

diffstat:

 sys/dist/pf/net/pf.c      |  72 ++++++++++++++++++++++------------------------
 sys/dist/pf/net/pf_norm.c |   8 ++--
 2 files changed, 38 insertions(+), 42 deletions(-)

diffs (252 lines):

diff -r 8f0358e0bdd4 -r 4dc2d9b686d4 sys/dist/pf/net/pf.c
--- a/sys/dist/pf/net/pf.c      Wed Sep 08 12:00:28 2004 +0000
+++ b/sys/dist/pf/net/pf.c      Wed Sep 08 12:11:25 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf.c,v 1.3 2004/06/22 18:37:49 martin Exp $    */
+/*     $NetBSD: pf.c,v 1.4 2004/09/08 12:11:25 yamt Exp $      */
 /*     $OpenBSD: pf.c,v 1.433 2004/03/26 22:20:57 dhartmei Exp $ */
 
 /*
@@ -2620,7 +2620,7 @@
 
        if (r->log) {
                if (rewrite)
-                       m_copyback(m, off, sizeof(*th), (caddr_t)th);
+                       m_copyback(m, off, sizeof(*th), th);
                PFLOG_PACKET(kif, h, m, af, direction, reason, r, a, ruleset);
        }
 
@@ -2846,7 +2846,7 @@
 
        /* copy back packet headers if we performed NAT operations */
        if (rewrite)
-               m_copyback(m, off, sizeof(*th), (caddr_t)th);
+               m_copyback(m, off, sizeof(*th), th);
 
        return (PF_PASS);
 }
@@ -2971,7 +2971,7 @@
 
        if (r->log) {
                if (rewrite)
-                       m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
+                       m_copyback(m, off, sizeof(*uh), uh);
                PFLOG_PACKET(kif, h, m, af, direction, reason, r, a, ruleset);
        }
 
@@ -3109,7 +3109,7 @@
 
        /* copy back packet headers if we performed NAT operations */
        if (rewrite)
-               m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
+               m_copyback(m, off, sizeof(*uh), uh);
 
        return (PF_PASS);
 }
@@ -3274,7 +3274,7 @@
 #ifdef INET6
                if (rewrite)
                        m_copyback(m, off, sizeof(struct icmp6_hdr),
-                           (caddr_t)pd->hdr.icmp6);
+                           pd->hdr.icmp6);
 #endif /* INET6 */
                PFLOG_PACKET(kif, h, m, af, direction, reason, r, a, ruleset);
        }
@@ -3386,7 +3386,7 @@
        /* copy back packet headers if we performed IPv6 NAT operations */
        if (rewrite)
                m_copyback(m, off, sizeof(struct icmp6_hdr),
-                   (caddr_t)pd->hdr.icmp6);
+                   pd->hdr.icmp6);
 #endif /* INET6 */
 
        return (PF_PASS);
@@ -4117,10 +4117,10 @@
                        pf_change_ap(pd->dst, &th->th_dport, pd->ip_sum,
                            &th->th_sum, &(*state)->lan.addr,
                            (*state)->lan.port, 0, pd->af);
-               m_copyback(m, off, sizeof(*th), (caddr_t)th);
+               m_copyback(m, off, sizeof(*th), th);
        } else if (copyback) {
                /* Copyback sequence modulation or stateful scrub changes */
-               m_copyback(m, off, sizeof(*th), (caddr_t)th);
+               m_copyback(m, off, sizeof(*th), th);
        }
 
        return (PF_PASS);
@@ -4181,7 +4181,7 @@
                        pf_change_ap(pd->dst, &uh->uh_dport, pd->ip_sum,
                            &uh->uh_sum, &(*state)->lan.addr,
                            (*state)->lan.port, 1, pd->af);
-               m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
+               m_copyback(m, off, sizeof(*uh), uh);
        }
 
        return (PF_PASS);
@@ -4271,7 +4271,7 @@
                                            &(*state)->gwy.addr, 0);
                                        m_copyback(m, off,
                                            sizeof(struct icmp6_hdr),
-                                           (caddr_t)pd->hdr.icmp6);
+                                           pd->hdr.icmp6);
                                        break;
 #endif /* INET6 */
                                }
@@ -4291,7 +4291,7 @@
                                            &(*state)->lan.addr, 0);
                                        m_copyback(m, off,
                                            sizeof(struct icmp6_hdr),
-                                           (caddr_t)pd->hdr.icmp6);
+                                           pd->hdr.icmp6);
                                        break;
 #endif /* INET6 */
                                }
@@ -4497,22 +4497,22 @@
 #ifdef INET
                                case AF_INET:
                                        m_copyback(m, off, ICMP_MINLEN,
-                                           (caddr_t)pd->hdr.icmp);
+                                           pd->hdr.icmp);
                                        m_copyback(m, ipoff2, sizeof(h2),
-                                           (caddr_t)&h2);
+                                           &h2);
                                        break;
 #endif /* INET */
 #ifdef INET6
                                case AF_INET6:
                                        m_copyback(m, off,
                                            sizeof(struct icmp6_hdr),
-                                           (caddr_t)pd->hdr.icmp6);
+                                           pd->hdr.icmp6);
                                        m_copyback(m, ipoff2, sizeof(h2_6),
-                                           (caddr_t)&h2_6);
+                                           &h2_6);
                                        break;
 #endif /* INET6 */
                                }
-                               m_copyback(m, off2, 8, (caddr_t)&th);
+                               m_copyback(m, off2, 8, &th);
                        }
 
                        return (PF_PASS);
@@ -4564,22 +4564,21 @@
 #ifdef INET
                                case AF_INET:
                                        m_copyback(m, off, ICMP_MINLEN,
-                                           (caddr_t)pd->hdr.icmp);
-                                       m_copyback(m, ipoff2, sizeof(h2),
-                                           (caddr_t)&h2);
+                                           pd->hdr.icmp);
+                                       m_copyback(m, ipoff2, sizeof(h2), &h2);
                                        break;
 #endif /* INET */
 #ifdef INET6
                                case AF_INET6:
                                        m_copyback(m, off,
                                            sizeof(struct icmp6_hdr),
-                                           (caddr_t)pd->hdr.icmp6);
+                                           pd->hdr.icmp6);
                                        m_copyback(m, ipoff2, sizeof(h2_6),
-                                           (caddr_t)&h2_6);
+                                           &h2_6);
                                        break;
 #endif /* INET6 */
                                }
-                               m_copyback(m, off2, sizeof(uh), (caddr_t)&uh);
+                               m_copyback(m, off2, sizeof(uh), &uh);
                        }
 
                        return (PF_PASS);
@@ -4628,10 +4627,9 @@
                                            pd2.ip_sum, icmpsum,
                                            pd->ip_sum, 0, AF_INET);
                                }
-                               m_copyback(m, off, ICMP_MINLEN,
-                                   (caddr_t)pd->hdr.icmp);
-                               m_copyback(m, ipoff2, sizeof(h2), (caddr_t)&h2);
-                               m_copyback(m, off2, ICMP_MINLEN, (caddr_t)&iih);
+                               m_copyback(m, off, ICMP_MINLEN, pd->hdr.icmp);
+                               m_copyback(m, ipoff2, sizeof(h2), &h2);
+                               m_copyback(m, off2, ICMP_MINLEN, &iih);
                        }
 
                        return (PF_PASS);
@@ -4682,11 +4680,10 @@
                                            pd->ip_sum, 0, AF_INET6);
                                }
                                m_copyback(m, off, sizeof(struct icmp6_hdr),
-                                   (caddr_t)pd->hdr.icmp6);
-                               m_copyback(m, ipoff2, sizeof(h2_6),
-                                   (caddr_t)&h2_6);
+                                   pd->hdr.icmp6);
+                               m_copyback(m, ipoff2, sizeof(h2_6), &h2_6);
                                m_copyback(m, off2, sizeof(struct icmp6_hdr),
-                                   (caddr_t)&iih);
+                                   &iih);
                        }
 
                        return (PF_PASS);
@@ -4730,18 +4727,17 @@
 #ifdef INET
                                case AF_INET:
                                        m_copyback(m, off, ICMP_MINLEN,
-                                           (caddr_t)pd->hdr.icmp);
-                                       m_copyback(m, ipoff2, sizeof(h2),
-                                           (caddr_t)&h2);
+                                           pd->hdr.icmp);
+                                       m_copyback(m, ipoff2, sizeof(h2), &h2);
                                        break;
 #endif /* INET */
 #ifdef INET6
                                case AF_INET6:
                                        m_copyback(m, off,
                                            sizeof(struct icmp6_hdr),
-                                           (caddr_t)pd->hdr.icmp6);
+                                           pd->hdr.icmp6);
                                        m_copyback(m, ipoff2, sizeof(h2_6),
-                                           (caddr_t)&h2_6);
+                                           &h2_6);
                                        break;
 #endif /* INET6 */
                                }
@@ -5051,9 +5047,9 @@
                }
        }
 #else
-       m_copydata(m0, sizeof(*ip), sizeof(th), (caddr_t)&th);
+       m_copydata(m0, sizeof(*ip), sizeof(th), &th);
        th.th_sum = 0;
-       m_copyback(m0, sizeof(*ip), sizeof(th), (caddr_t)&th);
+       m_copyback(m0, sizeof(*ip), sizeof(th), &th);
        in4_cksum(m0, IPPROTO_TCP, sizeof(*ip), m0->m_pkthdr.len - sizeof(*ip));
 #endif
 
diff -r 8f0358e0bdd4 -r 4dc2d9b686d4 sys/dist/pf/net/pf_norm.c
--- a/sys/dist/pf/net/pf_norm.c Wed Sep 08 12:00:28 2004 +0000
+++ b/sys/dist/pf/net/pf_norm.c Wed Sep 08 12:11:25 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf_norm.c,v 1.3 2004/06/29 04:42:55 itojun Exp $       */
+/*     $NetBSD: pf_norm.c,v 1.4 2004/09/08 12:11:25 yamt Exp $ */
 /*     $OpenBSD: pf_norm.c,v 1.80 2004/03/09 21:44:41 mcbride Exp $ */
 
 /*
@@ -1327,7 +1327,7 @@
 
        /* copy back packet headers if we sanitized */
        if (rewrite)
-               m_copyback(m, off, sizeof(*th), (caddr_t)th);
+               m_copyback(m, off, sizeof(*th), th);
 
        return (PF_PASS);
 
@@ -1519,8 +1519,8 @@
                        /* Copyback the options, caller copys back header */
                        *writeback = 1;
                        m_copyback(m, off + sizeof(struct tcphdr),
-                           (th->th_off << 2) - sizeof(struct tcphdr),
-                           (caddr_t)hdr + sizeof(struct tcphdr));
+                           (th->th_off << 2) - sizeof(struct tcphdr), hdr +
+                           sizeof(struct tcphdr));
                }
        }
 



Home | Main Index | Thread Index | Old Index