ip_icmp.c (274359) | ip_icmp.c (274363) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/netinet/ip_icmp.c 274359 2014-11-10 23:10:01Z melifaro $"); | 33__FBSDID("$FreeBSD: head/sys/netinet/ip_icmp.c 274363 2014-11-11 02:52:40Z melifaro $"); |
34 35#include "opt_inet.h" 36#include "opt_ipsec.h" 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/mbuf.h> 41#include <sys/protosw.h> --- 68 unchanged lines hidden (view full) --- 110 111static VNET_DEFINE(u_int, icmpmaskfake) = 0; 112#define V_icmpmaskfake VNET(icmpmaskfake) 113SYSCTL_UINT(_net_inet_icmp, OID_AUTO, maskfake, CTLFLAG_VNET | CTLFLAG_RW, 114 &VNET_NAME(icmpmaskfake), 0, 115 "Fake reply to ICMP Address Mask Request packets."); 116 117VNET_DEFINE(int, drop_redirect) = 0; | 34 35#include "opt_inet.h" 36#include "opt_ipsec.h" 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/mbuf.h> 41#include <sys/protosw.h> --- 68 unchanged lines hidden (view full) --- 110 111static VNET_DEFINE(u_int, icmpmaskfake) = 0; 112#define V_icmpmaskfake VNET(icmpmaskfake) 113SYSCTL_UINT(_net_inet_icmp, OID_AUTO, maskfake, CTLFLAG_VNET | CTLFLAG_RW, 114 &VNET_NAME(icmpmaskfake), 0, 115 "Fake reply to ICMP Address Mask Request packets."); 116 117VNET_DEFINE(int, drop_redirect) = 0; |
118#define V_drop_redirect VNET(drop_redirect) 119SYSCTL_INT(_net_inet_icmp, OID_AUTO, drop_redirect, CTLFLAG_VNET | CTLFLAG_RW, 120 &VNET_NAME(drop_redirect), 0, "Ignore ICMP redirects"); |
|
118 119static VNET_DEFINE(int, log_redirect) = 0; 120#define V_log_redirect VNET(log_redirect) 121SYSCTL_INT(_net_inet_icmp, OID_AUTO, log_redirect, CTLFLAG_VNET | CTLFLAG_RW, 122 &VNET_NAME(log_redirect), 0, 123 "Log ICMP redirects to the console"); 124 125static VNET_DEFINE(char, reply_src[IFNAMSIZ]); --- 32 unchanged lines hidden (view full) --- 158int icmpprintfs = 0; 159#endif 160 161static void icmp_reflect(struct mbuf *); 162static void icmp_send(struct mbuf *, struct mbuf *); 163 164extern struct protosw inetsw[]; 165 | 121 122static VNET_DEFINE(int, log_redirect) = 0; 123#define V_log_redirect VNET(log_redirect) 124SYSCTL_INT(_net_inet_icmp, OID_AUTO, log_redirect, CTLFLAG_VNET | CTLFLAG_RW, 125 &VNET_NAME(log_redirect), 0, 126 "Log ICMP redirects to the console"); 127 128static VNET_DEFINE(char, reply_src[IFNAMSIZ]); --- 32 unchanged lines hidden (view full) --- 161int icmpprintfs = 0; 162#endif 163 164static void icmp_reflect(struct mbuf *); 165static void icmp_send(struct mbuf *, struct mbuf *); 166 167extern struct protosw inetsw[]; 168 |
166static int 167sysctl_net_icmp_drop_redir(SYSCTL_HANDLER_ARGS) 168{ 169 int error, new; 170 int i; 171 struct radix_node_head *rnh; 172 173 new = V_drop_redirect; 174 error = sysctl_handle_int(oidp, &new, 0, req); 175 if (error == 0 && req->newptr) { 176 new = (new != 0) ? 1 : 0; 177 178 if (new == V_drop_redirect) 179 return (0); 180 181 for (i = 0; i < rt_numfibs; i++) { 182 if ((rnh = rt_tables_get_rnh(i, AF_INET)) == NULL) 183 continue; 184 RADIX_NODE_HEAD_LOCK(rnh); 185 in_setmatchfunc(rnh, new); 186 RADIX_NODE_HEAD_UNLOCK(rnh); 187 } 188 189 V_drop_redirect = new; 190 } 191 192 return (error); 193} 194 195SYSCTL_PROC(_net_inet_icmp, OID_AUTO, drop_redirect, 196 CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW, 0, 0, 197 sysctl_net_icmp_drop_redir, "I", "Ignore ICMP redirects"); 198 | |
199/* 200 * Kernel module interface for updating icmpstat. The argument is an index 201 * into icmpstat treated as an array of u_long. While this encodes the 202 * general layout of icmpstat into the caller, it doesn't encode its 203 * location, so that future changes to add, for example, per-CPU stats 204 * support won't cause binary compatibility problems for kernel modules. 205 */ 206void --- 798 unchanged lines hidden --- | 169/* 170 * Kernel module interface for updating icmpstat. The argument is an index 171 * into icmpstat treated as an array of u_long. While this encodes the 172 * general layout of icmpstat into the caller, it doesn't encode its 173 * location, so that future changes to add, for example, per-CPU stats 174 * support won't cause binary compatibility problems for kernel modules. 175 */ 176void --- 798 unchanged lines hidden --- |