ip_auth.c (91478) | ip_auth.c (92685) |
---|---|
1/* 2 * Copyright (C) 1998-2001 by Darren Reed & Guido van Rooij. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 */ | 1/* 2 * Copyright (C) 1998-2001 by Darren Reed & Guido van Rooij. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 */ |
6#ifdef __sgi 7# include <sys/ptimers.h> 8#endif |
|
6#include <sys/errno.h> 7#include <sys/types.h> 8#include <sys/param.h> 9#include <sys/time.h> 10#include <sys/file.h> 11#if !defined(_KERNEL) && !defined(KERNEL) 12# include <stdio.h> 13# include <stdlib.h> 14# include <string.h> 15#endif 16#if (defined(KERNEL) || defined(_KERNEL)) && (__FreeBSD_version >= 220000) 17# include <sys/filio.h> 18# include <sys/fcntl.h> 19#else 20# include <sys/ioctl.h> 21#endif | 9#include <sys/errno.h> 10#include <sys/types.h> 11#include <sys/param.h> 12#include <sys/time.h> 13#include <sys/file.h> 14#if !defined(_KERNEL) && !defined(KERNEL) 15# include <stdio.h> 16# include <stdlib.h> 17# include <string.h> 18#endif 19#if (defined(KERNEL) || defined(_KERNEL)) && (__FreeBSD_version >= 220000) 20# include <sys/filio.h> 21# include <sys/fcntl.h> 22#else 23# include <sys/ioctl.h> 24#endif |
22#include <sys/uio.h> | |
23#ifndef linux 24# include <sys/protosw.h> 25#endif 26#include <sys/socket.h> 27#if (defined(_KERNEL) || defined(KERNEL)) && !defined(linux) 28# include <sys/systm.h> 29#endif 30#if !defined(__SVR4) && !defined(__svr4__) --- 67 unchanged lines hidden (view full) --- 98# if (defined(_KERNEL) || defined(KERNEL)) && !defined(IPFILTER_LKM) 99# include <sys/libkern.h> 100# include <sys/systm.h> 101# endif 102#endif 103 104#if !defined(lint) 105/* static const char rcsid[] = "@(#)$Id: ip_auth.c,v 2.11.2.12 2001/07/18 14:57:08 darrenr Exp $"; */ | 25#ifndef linux 26# include <sys/protosw.h> 27#endif 28#include <sys/socket.h> 29#if (defined(_KERNEL) || defined(KERNEL)) && !defined(linux) 30# include <sys/systm.h> 31#endif 32#if !defined(__SVR4) && !defined(__svr4__) --- 67 unchanged lines hidden (view full) --- 100# if (defined(_KERNEL) || defined(KERNEL)) && !defined(IPFILTER_LKM) 101# include <sys/libkern.h> 102# include <sys/systm.h> 103# endif 104#endif 105 106#if !defined(lint) 107/* static const char rcsid[] = "@(#)$Id: ip_auth.c,v 2.11.2.12 2001/07/18 14:57:08 darrenr Exp $"; */ |
106static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/ip_auth.c 91478 2002-02-28 09:56:31Z mike $"; | 108static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/ip_auth.c 92685 2002-03-19 11:44:16Z darrenr $"; |
107#endif 108 109 110#if (SOLARIS || defined(__sgi)) && defined(_KERNEL) 111extern KRWLOCK_T ipf_auth, ipf_mutex; 112extern kmutex_t ipf_authmx; 113# if SOLARIS 114extern kcondvar_t ipfauthwait; --- 191 unchanged lines hidden (view full) --- 306#endif 307 return 1; 308} 309 310 311int fr_auth_ioctl(data, mode, cmd, fr, frptr) 312caddr_t data; 313int mode; | 109#endif 110 111 112#if (SOLARIS || defined(__sgi)) && defined(_KERNEL) 113extern KRWLOCK_T ipf_auth, ipf_mutex; 114extern kmutex_t ipf_authmx; 115# if SOLARIS 116extern kcondvar_t ipfauthwait; --- 191 unchanged lines hidden (view full) --- 308#endif 309 return 1; 310} 311 312 313int fr_auth_ioctl(data, mode, cmd, fr, frptr) 314caddr_t data; 315int mode; |
314#if defined(__NetBSD__) || defined(__OpenBSD__) || (FreeBSD_version >= 300003) | 316#if defined(__NetBSD__) || defined(__OpenBSD__) || (__FreeBSD_version >= 300003) |
315u_long cmd; 316#else 317int cmd; 318#endif 319frentry_t *fr, **frptr; 320{ 321 mb_t *m; 322#if defined(_KERNEL) && !SOLARIS --- 54 unchanged lines hidden (view full) --- 377 SPL_X(s); 378 RWLOCK_EXIT(&ipf_auth); 379 } else 380 error = ENOMEM; 381 } else 382 error = EINVAL; 383 break; 384 case SIOCATHST: | 317u_long cmd; 318#else 319int cmd; 320#endif 321frentry_t *fr, **frptr; 322{ 323 mb_t *m; 324#if defined(_KERNEL) && !SOLARIS --- 54 unchanged lines hidden (view full) --- 379 SPL_X(s); 380 RWLOCK_EXIT(&ipf_auth); 381 } else 382 error = ENOMEM; 383 } else 384 error = EINVAL; 385 break; 386 case SIOCATHST: |
385 READ_ENTER(&ipf_auth); | |
386 fr_authstats.fas_faelist = fae_list; | 387 fr_authstats.fas_faelist = fae_list; |
387 RWLOCK_EXIT(&ipf_auth); | |
388 error = IWCOPYPTR((char *)&fr_authstats, data, 389 sizeof(fr_authstats)); 390 break; 391 case SIOCAUTHW: 392 if (!(mode & FWRITE)) { 393 error = EPERM; 394 break; 395 } --- 57 unchanged lines hidden (view full) --- 453 if (m && au->fra_info.fin_out) { 454# if SOLARIS 455 error = fr_qout(fra->fra_q, m); 456# else /* SOLARIS */ 457 struct route ro; 458 459 bzero((char *)&ro, sizeof(ro)); 460# if ((_BSDI_VERSION >= 199802) && (_BSDI_VERSION < 200005)) || \ | 388 error = IWCOPYPTR((char *)&fr_authstats, data, 389 sizeof(fr_authstats)); 390 break; 391 case SIOCAUTHW: 392 if (!(mode & FWRITE)) { 393 error = EPERM; 394 break; 395 } --- 57 unchanged lines hidden (view full) --- 453 if (m && au->fra_info.fin_out) { 454# if SOLARIS 455 error = fr_qout(fra->fra_q, m); 456# else /* SOLARIS */ 457 struct route ro; 458 459 bzero((char *)&ro, sizeof(ro)); 460# if ((_BSDI_VERSION >= 199802) && (_BSDI_VERSION < 200005)) || \ |
461 defined(__OpenBSD__) | 461 defined(__OpenBSD__) || (defined(IRIX) && (IRIX >= 605)) |
462 error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL, 463 NULL); 464# else 465 error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL); 466# endif 467 if (ro.ro_rt) { 468 RTFREE(ro.ro_rt); 469 } --- 51 unchanged lines hidden (view full) --- 521 default : 522 error = EINVAL; 523 break; 524 } 525 return error; 526} 527 528 | 462 error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL, 463 NULL); 464# else 465 error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL); 466# endif 467 if (ro.ro_rt) { 468 RTFREE(ro.ro_rt); 469 } --- 51 unchanged lines hidden (view full) --- 521 default : 522 error = EINVAL; 523 break; 524 } 525 return error; 526} 527 528 |
529#ifdef _KERNEL | |
530/* 531 * Free all network buffer memory used to keep saved packets. 532 */ 533void fr_authunload() 534{ 535 register int i; 536 register frauthent_t *fae, **faep; 537 frentry_t *fr, **frp; --- 44 unchanged lines hidden (view full) --- 582 */ 583void fr_authexpire() 584{ 585 register int i; 586 register frauth_t *fra; 587 register frauthent_t *fae, **faep; 588 register frentry_t *fr, **frp; 589 mb_t *m; | 529/* 530 * Free all network buffer memory used to keep saved packets. 531 */ 532void fr_authunload() 533{ 534 register int i; 535 register frauthent_t *fae, **faep; 536 frentry_t *fr, **frp; --- 44 unchanged lines hidden (view full) --- 581 */ 582void fr_authexpire() 583{ 584 register int i; 585 register frauth_t *fra; 586 register frauthent_t *fae, **faep; 587 register frentry_t *fr, **frp; 588 mb_t *m; |
590#if !SOLARIS | 589#if !SOLARIS && defined(_KERNEL) |
591 int s; 592#endif 593 594 if (fr_auth_lock) 595 return; 596 597 SPL_NET(s); 598 WRITE_ENTER(&ipf_auth); --- 22 unchanged lines hidden (view full) --- 621 *frp = fr->fr_next; 622 KFREE(fr); 623 } else 624 frp = &fr->fr_next; 625 } 626 RWLOCK_EXIT(&ipf_auth); 627 SPL_X(s); 628} | 590 int s; 591#endif 592 593 if (fr_auth_lock) 594 return; 595 596 SPL_NET(s); 597 WRITE_ENTER(&ipf_auth); --- 22 unchanged lines hidden (view full) --- 620 *frp = fr->fr_next; 621 KFREE(fr); 622 } else 623 frp = &fr->fr_next; 624 } 625 RWLOCK_EXIT(&ipf_auth); 626 SPL_X(s); 627} |
629#endif | |