Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/netinet Pull up revisions 1.6-1.9 (requested by mar...



details:   https://anonhg.NetBSD.org/src/rev/706b3f0649ec
branches:  netbsd-1-5
changeset: 492702:706b3f0649ec
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 09 16:56:35 2002 +0000

description:
Pull up revisions 1.6-1.9 (requested by martti):
  Updated IPFilter to 3.4.23

diffstat:

 sys/netinet/ip_rcmd_pxy.c |  34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diffs (91 lines):

diff -r e01b368a5081 -r 706b3f0649ec sys/netinet/ip_rcmd_pxy.c
--- a/sys/netinet/ip_rcmd_pxy.c Sat Feb 09 16:56:32 2002 +0000
+++ b/sys/netinet/ip_rcmd_pxy.c Sat Feb 09 16:56:35 2002 +0000
@@ -1,7 +1,10 @@
-/*     $NetBSD: ip_rcmd_pxy.c,v 1.4.4.1 2000/08/31 14:49:50 veego Exp $        */
+/*     $NetBSD: ip_rcmd_pxy.c,v 1.4.4.2 2002/02/09 16:56:35 he Exp $   */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(1, "$NetBSD: ip_rcmd_pxy.c,v 1.4.4.2 2002/02/09 16:56:35 he Exp $");
 
 /*
- * Id: ip_rcmd_pxy.c,v 1.4.2.2 2000/07/15 12:38:30 darrenr Exp
+ * Id: ip_rcmd_pxy.c,v 1.4.2.5 2001/10/30 16:38:14 darrenr Exp
  */
 /*
  * Simple RCMD transparent proxy for in-kernel use.  For use with the NAT
@@ -65,8 +68,8 @@
 u_short ipf_rcmd_atoi(ptr)
 char *ptr;
 {
-       char *s = ptr, c;
-       u_short i = 0;
+       register char *s = ptr, c;
+       register u_short i = 0;
 
        while ((c = *s++) && isdigit(c)) {
                i *= 10;
@@ -84,10 +87,10 @@
 {
        char portbuf[8], *s;
        struct in_addr swip;
-       u_short sp, dp;
        int off, dlen;
        tcphdr_t *tcp, tcph, *tcp2 = &tcph;
        fr_info_t fi;
+       u_short sp;
        nat_t *ipn;
        mb_t *m;
 #if    SOLARIS
@@ -105,7 +108,7 @@
            (tcp->th_seq != *(u_32_t *)aps->aps_data))
                return 0;
 
-       off = (ip->ip_hl << 2) + (tcp->th_off << 2);
+       off = fin->fin_hlen + (tcp->th_off << 2);
 
 #if    SOLARIS
        m = fin->fin_qfm;
@@ -130,32 +133,33 @@
         * Add skeleton NAT entry for connection which will come back the
         * other way.
         */
-       sp = htons(sp);
-       dp = htons(fin->fin_data[1]);
-       ipn = nat_outlookup(fin->fin_ifp, IPN_TCP, nat->nat_p, nat->nat_inip,
-                           ip->ip_dst, (dp << 16) | sp);
+       bcopy((char *)fin, (char *)&fi, sizeof(fi));
+       fi.fin_data[0] = sp;
+       fi.fin_data[1] = fin->fin_data[1];
+       ipn = nat_outlookup(&fi, IPN_TCP, nat->nat_p, nat->nat_inip,
+                           ip->ip_dst, 0);
        if (ipn == NULL) {
                int slen;
 
                slen = ip->ip_len;
                ip->ip_len = fin->fin_hlen + sizeof(*tcp);
-               bcopy((char *)fin, (char *)&fi, sizeof(fi));
                bzero((char *)tcp2, sizeof(*tcp2));
                tcp2->th_win = htons(8192);
-               tcp2->th_sport = sp;
+               tcp2->th_sport = htons(sp);
                tcp2->th_dport = 0; /* XXX - don't specify remote port */
                tcp2->th_off = 5;
-               fi.fin_data[0] = ntohs(sp);
                fi.fin_data[1] = 0;
                fi.fin_dp = (char *)tcp2;
+               fi.fin_dlen = sizeof(*tcp2);
                swip = ip->ip_src;
                ip->ip_src = nat->nat_inip;
-               ipn = nat_new(nat->nat_ptr, ip, &fi, IPN_TCP|FI_W_DPORT,
+               ipn = nat_new(&fi, ip, nat->nat_ptr, NULL, IPN_TCP|FI_W_DPORT,
                              NAT_OUTBOUND);
                if (ipn != NULL) {
                        ipn->nat_age = fr_defnatage;
                        fi.fin_fr = &rcmdfr;
-                       (void) fr_addstate(ip, &fi, FI_W_DPORT);
+                       (void) fr_addstate(ip, &fi, NULL,
+                                          FI_W_DPORT|FI_IGNOREPKT);
                }
                ip->ip_len = slen;
                ip->ip_src = swip;



Home | Main Index | Thread Index | Old Index