ip_fil.c (145554) | ip_fil.c (161357) |
---|---|
1/* $FreeBSD: head/contrib/ipfilter/ip_fil.c 145554 2005-04-26 15:18:45Z darrenr $ */ | 1/* $FreeBSD: head/contrib/ipfilter/ip_fil.c 161357 2006-08-16 12:23:02Z guido $ */ |
2 3/* 4 * Copyright (C) 1993-2001 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; | 2 3/* 4 * Copyright (C) 1993-2001 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; |
10static const char rcsid[] = "@(#)$Id: ip_fil.c,v 2.133.2.9 2005/01/08 14:22:18 darrenr Exp $"; | 10static const char rcsid[] = "@(#)$Id: ip_fil.c,v 2.133.2.11 2006/03/25 11:15:30 darrenr Exp $"; |
11#endif 12 13#ifndef SOLARIS 14#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) 15#endif 16 17#include <sys/param.h> 18#if defined(__FreeBSD__) && !defined(__FreeBSD_version) --- 114 unchanged lines hidden (view full) --- 133# include <sys/malloc.h> 134#endif 135#ifdef __hpux 136struct rtentry; 137#endif 138#include "md5.h" 139 140 | 11#endif 12 13#ifndef SOLARIS 14#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) 15#endif 16 17#include <sys/param.h> 18#if defined(__FreeBSD__) && !defined(__FreeBSD_version) --- 114 unchanged lines hidden (view full) --- 133# include <sys/malloc.h> 134#endif 135#ifdef __hpux 136struct rtentry; 137#endif 138#include "md5.h" 139 140 |
141#if !defined(__osf__) | 141#if !defined(__osf__) && !defined(__linux__) |
142extern struct protosw inetsw[]; 143#endif 144 145#include "ipt.h" 146static struct ifnet **ifneta = NULL; 147static int nifs = 0; 148 149static int frzerostats __P((caddr_t)); --- 563 unchanged lines hidden (view full) --- 713 714int fr_fastroute(m, mpp, fin, fdp) 715mb_t *m, **mpp; 716fr_info_t *fin; 717frdest_t *fdp; 718{ 719 struct ifnet *ifp = fdp->fd_ifp; 720 ip_t *ip = fin->fin_ip; | 142extern struct protosw inetsw[]; 143#endif 144 145#include "ipt.h" 146static struct ifnet **ifneta = NULL; 147static int nifs = 0; 148 149static int frzerostats __P((caddr_t)); --- 563 unchanged lines hidden (view full) --- 713 714int fr_fastroute(m, mpp, fin, fdp) 715mb_t *m, **mpp; 716fr_info_t *fin; 717frdest_t *fdp; 718{ 719 struct ifnet *ifp = fdp->fd_ifp; 720 ip_t *ip = fin->fin_ip; |
721 int error = 0; 722 frentry_t *fr; 723 void *sifp; |
|
721 722 if (!ifp) 723 return 0; /* no routing table out here */ 724 | 724 725 if (!ifp) 726 return 0; /* no routing table out here */ 727 |
725 ip->ip_len = htons((u_short)ip->ip_len); 726 ip->ip_off = htons((u_short)(ip->ip_off | IP_MF)); | 728 fr = fin->fin_fr; |
727 ip->ip_sum = 0; | 729 ip->ip_sum = 0; |
730 731 if (fin->fin_out == 0) { 732 sifp = fin->fin_ifp; 733 fin->fin_ifp = ifp; 734 fin->fin_out = 1; 735 (void) fr_acctpkt(fin, NULL); 736 fin->fin_fr = NULL; 737 if (!fr || !(fr->fr_flags & FR_RETMASK)) { 738 u_32_t pass; 739 740 (void) fr_checkstate(fin, &pass); 741 } 742 743 switch (fr_checknatout(fin, NULL)) 744 { 745 case 0 : 746 break; 747 case 1 : 748 ip->ip_sum = 0; 749 break; 750 case -1 : 751 error = -1; 752 goto done; 753 break; 754 } 755 756 fin->fin_ifp = sifp; 757 fin->fin_out = 0; 758 } 759 |
|
728#if defined(__sgi) && (IRIX < 60500) 729 (*ifp->if_output)(ifp, (void *)ip, NULL); 730# if TRU64 >= 1885 731 (*ifp->if_output)(ifp, (void *)m, NULL, 0, 0); 732# else 733 (*ifp->if_output)(ifp, (void *)m, NULL, 0); 734# endif 735#endif | 760#if defined(__sgi) && (IRIX < 60500) 761 (*ifp->if_output)(ifp, (void *)ip, NULL); 762# if TRU64 >= 1885 763 (*ifp->if_output)(ifp, (void *)m, NULL, 0, 0); 764# else 765 (*ifp->if_output)(ifp, (void *)m, NULL, 0); 766# endif 767#endif |
736 return 0; | 768done: 769 return error; |
737} 738 739 740int fr_send_reset(fin) 741fr_info_t *fin; 742{ 743 verbose("- TCP RST sent\n"); 744 return 0; --- 223 unchanged lines hidden --- | 770} 771 772 773int fr_send_reset(fin) 774fr_info_t *fin; 775{ 776 verbose("- TCP RST sent\n"); 777 return 0; --- 223 unchanged lines hidden --- |