ip_auth.c (153084) | ip_auth.c (153876) |
---|---|
1/* $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_auth.c 153084 2005-12-04 10:06:06Z ru $ */ | 1/* $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_auth.c 153876 2005-12-30 11:32:23Z guido $ */ |
2 3/* 4 * Copyright (C) 1998-2003 by Darren Reed & Guido van Rooij. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if defined(KERNEL) || defined(_KERNEL) 9# undef KERNEL --- 105 unchanged lines hidden (view full) --- 115# if defined(_KERNEL) && !defined(IPFILTER_LKM) 116# include <sys/libkern.h> 117# include <sys/systm.h> 118# endif 119#endif 120/* END OF INCLUDES */ 121 122#if !defined(lint) | 2 3/* 4 * Copyright (C) 1998-2003 by Darren Reed & Guido van Rooij. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if defined(KERNEL) || defined(_KERNEL) 9# undef KERNEL --- 105 unchanged lines hidden (view full) --- 115# if defined(_KERNEL) && !defined(IPFILTER_LKM) 116# include <sys/libkern.h> 117# include <sys/systm.h> 118# endif 119#endif 120/* END OF INCLUDES */ 121 122#if !defined(lint) |
123static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/ip_auth.c 153084 2005-12-04 10:06:06Z ru $"; | 123static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/ip_auth.c 153876 2005-12-30 11:32:23Z guido $"; |
124/* static const char rcsid[] = "@(#)Id: ip_auth.c,v 2.73.2.3 2004/08/26 11:25:21 darrenr Exp"; */ 125#endif 126 127 128#if SOLARIS 129extern kcondvar_t ipfauthwait; 130#endif /* SOLARIS */ 131#if defined(linux) && defined(_KERNEL) --- 233 unchanged lines hidden (view full) --- 365caddr_t data; 366ioctlcmd_t cmd; 367int mode; 368{ 369 mb_t *m; 370#if defined(_KERNEL) && !defined(MENTAT) && !defined(linux) && \ 371 (!defined(__FreeBSD_version) || (__FreeBSD_version < 501000)) 372 struct ifqueue *ifq; | 124/* static const char rcsid[] = "@(#)Id: ip_auth.c,v 2.73.2.3 2004/08/26 11:25:21 darrenr Exp"; */ 125#endif 126 127 128#if SOLARIS 129extern kcondvar_t ipfauthwait; 130#endif /* SOLARIS */ 131#if defined(linux) && defined(_KERNEL) --- 233 unchanged lines hidden (view full) --- 365caddr_t data; 366ioctlcmd_t cmd; 367int mode; 368{ 369 mb_t *m; 370#if defined(_KERNEL) && !defined(MENTAT) && !defined(linux) && \ 371 (!defined(__FreeBSD_version) || (__FreeBSD_version < 501000)) 372 struct ifqueue *ifq; |
373# ifdef USE_SPL 374 int s; 375# endif /* USE_SPL */ | 373 SPL_INT(s); |
376#endif 377 frauth_t auth, *au = &auth, *fra; 378 int i, error = 0, len; 379 char *t; 380 381 switch (cmd) 382 { 383 case SIOCSTLCK : --- 120 unchanged lines hidden (view full) --- 504 fra->fra_pass = au->fra_pass; 505 fr_authpkts[i] = NULL; 506 RWLOCK_EXIT(&ipf_auth); 507#ifdef _KERNEL 508 if ((m != NULL) && (au->fra_info.fin_out != 0)) { 509# ifdef MENTAT 510 error = !putq(fra->fra_q, m); 511# else /* MENTAT */ | 374#endif 375 frauth_t auth, *au = &auth, *fra; 376 int i, error = 0, len; 377 char *t; 378 379 switch (cmd) 380 { 381 case SIOCSTLCK : --- 120 unchanged lines hidden (view full) --- 502 fra->fra_pass = au->fra_pass; 503 fr_authpkts[i] = NULL; 504 RWLOCK_EXIT(&ipf_auth); 505#ifdef _KERNEL 506 if ((m != NULL) && (au->fra_info.fin_out != 0)) { 507# ifdef MENTAT 508 error = !putq(fra->fra_q, m); 509# else /* MENTAT */ |
512# ifdef linux | 510# if defined(linux) || defined(AIX) |
513# else 514# if (defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802) || \ 515 (defined(__OpenBSD__)) || \ 516 (defined(__sgi) && (IRIX >= 60500) || \ 517 (defined(__FreeBSD__) && (__FreeBSD_version >= 470102))) 518 error = ip_output(m, NULL, NULL, IP_FORWARDING, NULL, 519 NULL); 520# else --- 4 unchanged lines hidden (view full) --- 525 if (error != 0) 526 fr_authstats.fas_sendfail++; 527 else 528 fr_authstats.fas_sendok++; 529 } else if (m) { 530# ifdef MENTAT 531 error = !putq(fra->fra_q, m); 532# else /* MENTAT */ | 511# else 512# if (defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802) || \ 513 (defined(__OpenBSD__)) || \ 514 (defined(__sgi) && (IRIX >= 60500) || \ 515 (defined(__FreeBSD__) && (__FreeBSD_version >= 470102))) 516 error = ip_output(m, NULL, NULL, IP_FORWARDING, NULL, 517 NULL); 518# else --- 4 unchanged lines hidden (view full) --- 523 if (error != 0) 524 fr_authstats.fas_sendfail++; 525 else 526 fr_authstats.fas_sendok++; 527 } else if (m) { 528# ifdef MENTAT 529 error = !putq(fra->fra_q, m); 530# else /* MENTAT */ |
533# ifdef linux | 531# if defined(linux) || defined(AIX) |
534# else | 532# else |
535# if __FreeBSD_version >= 501000 | 533# if (__FreeBSD_version >= 501000) |
536 netisr_dispatch(NETISR_IP, m); 537# else | 534 netisr_dispatch(NETISR_IP, m); 535# else |
538# if IRIX >= 60516 | 536# if (IRIX >= 60516) |
539 ifq = &((struct ifnet *)fra->fra_info.fin_ifp)->if_snd; 540# else 541 ifq = &ipintrq; 542# endif 543 if (IF_QFULL(ifq)) { 544 IF_DROP(ifq); 545 FREE_MB_T(m); 546 error = ENOBUFS; --- 114 unchanged lines hidden (view full) --- 661 */ 662void fr_authexpire() 663{ 664 register int i; 665 register frauth_t *fra; 666 register frauthent_t *fae, **faep; 667 register frentry_t *fr, **frp; 668 mb_t *m; | 537 ifq = &((struct ifnet *)fra->fra_info.fin_ifp)->if_snd; 538# else 539 ifq = &ipintrq; 540# endif 541 if (IF_QFULL(ifq)) { 542 IF_DROP(ifq); 543 FREE_MB_T(m); 544 error = ENOBUFS; --- 114 unchanged lines hidden (view full) --- 659 */ 660void fr_authexpire() 661{ 662 register int i; 663 register frauth_t *fra; 664 register frauthent_t *fae, **faep; 665 register frentry_t *fr, **frp; 666 mb_t *m; |
669# if !defined(MENAT) && defined(_KERNEL) && defined(USE_SPL) 670 int s; 671# endif | 667 SPL_INT(s); |
672 673 if (fr_auth_lock) 674 return; 675 676 SPL_NET(s); 677 WRITE_ENTER(&ipf_auth); 678 for (i = 0, fra = fr_auth; i < fr_authsize; i++, fra++) { 679 fra->fra_age--; --- 32 unchanged lines hidden (view full) --- 712} 713 714int fr_preauthcmd(cmd, fr, frptr) 715ioctlcmd_t cmd; 716frentry_t *fr, **frptr; 717{ 718 frauthent_t *fae, **faep; 719 int error = 0; | 668 669 if (fr_auth_lock) 670 return; 671 672 SPL_NET(s); 673 WRITE_ENTER(&ipf_auth); 674 for (i = 0, fra = fr_auth; i < fr_authsize; i++, fra++) { 675 fra->fra_age--; --- 32 unchanged lines hidden (view full) --- 708} 709 710int fr_preauthcmd(cmd, fr, frptr) 711ioctlcmd_t cmd; 712frentry_t *fr, **frptr; 713{ 714 frauthent_t *fae, **faep; 715 int error = 0; |
720# if !defined(MENAT) && defined(_KERNEL) && defined(USE_SPL) 721 int s; 722#endif | 716 SPL_INT(s); |
723 724 if ((cmd != SIOCADAFR) && (cmd != SIOCRMAFR)) 725 return EIO; 726 727 for (faep = &fae_list; ((fae = *faep) != NULL); ) { 728 if (&fae->fae_fr == fr) 729 break; 730 else --- 77 unchanged lines hidden --- | 717 718 if ((cmd != SIOCADAFR) && (cmd != SIOCRMAFR)) 719 return EIO; 720 721 for (faep = &fae_list; ((fae = *faep) != NULL); ) { 722 if (&fae->fae_fr == fr) 723 break; 724 else --- 77 unchanged lines hidden --- |