Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/ipf/netinet Make ipf compile even without I...



details:   https://anonhg.NetBSD.org/src/rev/8fe4f7f0105a
branches:  trunk
changeset: 780596:8fe4f7f0105a
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon Jul 30 19:27:46 2012 +0000

description:
Make ipf compile even without INET6 support.

Changes have been fed upstream (to darrenr@)

diffstat:

 sys/external/bsd/ipf/netinet/ip_ftp_pxy.c  |  11 +++++++----
 sys/external/bsd/ipf/netinet/ip_nat.c      |  22 ++++++----------------
 sys/external/bsd/ipf/netinet/ip_rcmd_pxy.c |  10 +++++++---
 sys/external/bsd/ipf/netinet/ip_tftp_pxy.c |   8 +++++---
 4 files changed, 25 insertions(+), 26 deletions(-)

diffs (194 lines):

diff -r 9644c6bcbcfd -r 8fe4f7f0105a sys/external/bsd/ipf/netinet/ip_ftp_pxy.c
--- a/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c Mon Jul 30 19:03:39 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c Mon Jul 30 19:27:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_ftp_pxy.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $   */
+/*     $NetBSD: ip_ftp_pxy.c,v 1.4 2012/07/30 19:27:46 pgoyette Exp $  */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -12,7 +12,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ip_ftp_pxy.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ip_ftp_pxy.c,v 1.4 2012/07/30 19:27:46 pgoyette Exp $");
 
 #define        IPF_FTP_PROXY
 
@@ -834,7 +834,7 @@
        ipnat_t *ipn;
        fr_info_t fi;
        ftpside_t *f;
-       nat_t *nat2;
+       nat_t *nat2 = NULL;
        mb_t *m;
 
        softc = fin->fin_main_soft;
@@ -1669,8 +1669,10 @@
        if (f->ftps_rptr[5] == f->ftps_rptr[7]) {
                if (f->ftps_rptr[6] == '1' && nat->nat_v[0] == 4)
                        return ipf_p_ftp_eprt4(softf, fin, ip, nat, ftp, dlen);
+#ifdef USE_INET6
                if (f->ftps_rptr[6] == '2' && nat->nat_v[0] == 6)
                        return ipf_p_ftp_eprt6(softf, fin, ip, nat, ftp, dlen);
+#endif
        }
        return 0;
 }
@@ -1902,7 +1904,7 @@
                                   newbuf, s);
 }
 
-
+#ifdef USE_INET6
 int
 ipf_p_ftp_eprt6(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip,
        nat_t *nat, ftpinfo_t *ftp, int dlen)
@@ -2107,3 +2109,4 @@
        f->ftps_cmd = FTPXY_C_EPRT;
        return ipf_p_ftp_addport(softf, fin, ip, nat, ftp, dlen, port, inc);
 }
+#endif /* USE_INET6 */
diff -r 9644c6bcbcfd -r 8fe4f7f0105a sys/external/bsd/ipf/netinet/ip_nat.c
--- a/sys/external/bsd/ipf/netinet/ip_nat.c     Mon Jul 30 19:03:39 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_nat.c     Mon Jul 30 19:27:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_nat.c,v 1.5 2012/07/22 16:40:40 darrenr Exp $       */
+/*     $NetBSD: ip_nat.c,v 1.6 2012/07/30 19:27:46 pgoyette Exp $      */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -113,7 +113,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.5 2012/07/22 16:40:40 darrenr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.6 2012/07/30 19:27:46 pgoyette Exp $");
 #else
 static const char sccsid[] = "@(#)ip_nat.c     1.11 6/5/96 (C) 1995 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_nat.c,v 1.1.1.2 2012/07/22 13:45:27 darrenr Exp";
@@ -2531,9 +2531,11 @@
                        case 4 :
                                ipf_nat_delrdr(softn, np);
                                break;
+#ifdef USE_INET6
                        case 6 :
                                ipf_nat6_delrdr(softn, np);
                                break;
+#endif
                        }
                }
                if (np->in_redir & (NAT_MAPBLK|NAT_MAP)) {
@@ -2542,9 +2544,11 @@
                        case 4 :
                                ipf_nat_delmap(softn, np);
                                break;
+#ifdef USE_INET6
                        case 6 :
                                ipf_nat6_delmap(softn, np);
                                break;
+#endif
                        }
                }
        }
@@ -7969,18 +7973,6 @@
        }
        softn->ipf_nat_stats.ns_side[1].ns_bucketlen = bucketlens[1];
 
-       if (softn->ipf_nat_stats.ns_side6[0].ns_bucketlen != NULL) {
-               KFREES(softn->ipf_nat_stats.ns_side6[0].ns_bucketlen,
-                      softn->ipf_nat_table_sz * sizeof(u_int));
-       }
-       softn->ipf_nat_stats.ns_side6[0].ns_bucketlen = bucketlens[0];
-
-       if (softn->ipf_nat_stats.ns_side6[1].ns_bucketlen != NULL) {
-               KFREES(softn->ipf_nat_stats.ns_side6[1].ns_bucketlen,
-                      softn->ipf_nat_table_sz * sizeof(u_int));
-       }
-       softn->ipf_nat_stats.ns_side6[1].ns_bucketlen = bucketlens[1];
-
        softn->ipf_nat_maxbucket = maxbucket;
        softn->ipf_nat_table_sz = newsize;
        /*
@@ -7990,8 +7982,6 @@
         */
        softn->ipf_nat_stats.ns_side[0].ns_inuse = 0;
        softn->ipf_nat_stats.ns_side[1].ns_inuse = 0;
-       softn->ipf_nat_stats.ns_side6[0].ns_inuse = 0;
-       softn->ipf_nat_stats.ns_side6[1].ns_inuse = 0;
 
        for (nat = softn->ipf_nat_instances; nat != NULL; nat = nat->nat_next) {
                nat->nat_hnext[0] = NULL;
diff -r 9644c6bcbcfd -r 8fe4f7f0105a sys/external/bsd/ipf/netinet/ip_rcmd_pxy.c
--- a/sys/external/bsd/ipf/netinet/ip_rcmd_pxy.c        Mon Jul 30 19:03:39 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_rcmd_pxy.c        Mon Jul 30 19:27:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_rcmd_pxy.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $  */
+/*     $NetBSD: ip_rcmd_pxy.c,v 1.4 2012/07/30 19:27:47 pgoyette Exp $ */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -12,7 +12,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ip_rcmd_pxy.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ip_rcmd_pxy.c,v 1.4 2012/07/30 19:27:47 pgoyette Exp $");
 
 #define        IPF_RCMD_PROXY
 
@@ -145,9 +145,11 @@
        fr_info_t fi;
        u_short sp;
        nat_t *nat2;
+#ifdef USE_INET6
        ip6_t *ip6;
+#endif
        int tcpsz;
-       int slen;
+       int slen = 0;
        ip_t *ip;
        mb_t *m;
 
@@ -156,7 +158,9 @@
        m = fin->fin_m;
        ip = fin->fin_ip;
        tcpsz = TCP_OFF(tcp) << 2;
+#ifdef USE_INET6
        ip6 = (ip6_t *)fin->fin_ip;
+#endif
        softc = fin->fin_main_soft;
        softn = softc->ipf_nat_soft;
        off = (char *)tcp - (char *)ip + tcpsz + fin->fin_ipoff;
diff -r 9644c6bcbcfd -r 8fe4f7f0105a sys/external/bsd/ipf/netinet/ip_tftp_pxy.c
--- a/sys/external/bsd/ipf/netinet/ip_tftp_pxy.c        Mon Jul 30 19:03:39 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_tftp_pxy.c        Mon Jul 30 19:27:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_tftp_pxy.c,v 1.4 2012/07/22 16:43:59 darrenr Exp $  */
+/*     $NetBSD: ip_tftp_pxy.c,v 1.5 2012/07/30 19:27:47 pgoyette Exp $ */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -279,8 +279,8 @@
        tftpinfo_t *ti;
        udphdr_t udp;
        fr_info_t fi;
-       u_short slen;
-       nat_t *nat2;
+       u_short slen = 0;
+       nat_t *nat2 = NULL;
        int nflags;
        ip_t *ip;
        int dir;
@@ -347,8 +347,10 @@
        MUTEX_ENTER(&softn->ipf_nat_new);
        if (nat->nat_v[0] == 4)
                nat2 = ipf_nat_add(&fi, ti->ti_rule, NULL, nflags, dir);
+#ifdef USE_INET6
        else
                nat2 = ipf_nat6_add(&fi, ti->ti_rule, NULL, nflags, dir);
+#endif
        MUTEX_EXIT(&softn->ipf_nat_new);
        if (nat2 != NULL) {
                (void) ipf_nat_proto(&fi, nat2, IPN_UDP);



Home | Main Index | Thread Index | Old Index