ip_id.c (249318) | ip_id.c (250300) |
---|---|
1 2/*- 3 * Copyright (c) 2008 Michael J. Silbersack. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1 2/*- 3 * Copyright (c) 2008 Michael J. Silbersack. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/netinet/ip_id.c 249318 2013-04-09 21:02:20Z andre $"); | 29__FBSDID("$FreeBSD: head/sys/netinet/ip_id.c 250300 2013-05-06 16:42:18Z andre $"); |
30 31/* 32 * IP ID generation is a fascinating topic. 33 * 34 * In order to avoid ID collisions during packet reassembly, common sense 35 * dictates that the period between reuse of IDs be as large as possible. 36 * This leads to the classic implementation of a system-wide counter, thereby 37 * ensuring that IDs repeat only once every 2^16 packets. --- 54 unchanged lines hidden (view full) --- 92static MALLOC_DEFINE(M_IPID, "ipid", "randomized ip id state"); 93 94static u_int16_t *id_array = NULL; 95static bitstr_t *id_bits = NULL; 96static int array_ptr = 0; 97static int array_size = 8192; 98static int random_id_collisions = 0; 99static int random_id_total = 0; | 30 31/* 32 * IP ID generation is a fascinating topic. 33 * 34 * In order to avoid ID collisions during packet reassembly, common sense 35 * dictates that the period between reuse of IDs be as large as possible. 36 * This leads to the classic implementation of a system-wide counter, thereby 37 * ensuring that IDs repeat only once every 2^16 packets. --- 54 unchanged lines hidden (view full) --- 92static MALLOC_DEFINE(M_IPID, "ipid", "randomized ip id state"); 93 94static u_int16_t *id_array = NULL; 95static bitstr_t *id_bits = NULL; 96static int array_ptr = 0; 97static int array_size = 8192; 98static int random_id_collisions = 0; 99static int random_id_total = 0; |
100static struct mtx_padalign ip_id_mtx; | 100static struct mtx ip_id_mtx; |
101 102static void ip_initid(void); 103static int sysctl_ip_id_change(SYSCTL_HANDLER_ARGS); 104 105MTX_SYSINIT(ip_id_mtx, &ip_id_mtx, "ip_id_mtx", MTX_DEF); 106 107SYSCTL_DECL(_net_inet_ip); 108SYSCTL_PROC(_net_inet_ip, OID_AUTO, random_id_period, CTLTYPE_INT|CTLFLAG_RW, --- 101 unchanged lines hidden --- | 101 102static void ip_initid(void); 103static int sysctl_ip_id_change(SYSCTL_HANDLER_ARGS); 104 105MTX_SYSINIT(ip_id_mtx, &ip_id_mtx, "ip_id_mtx", MTX_DEF); 106 107SYSCTL_DECL(_net_inet_ip); 108SYSCTL_PROC(_net_inet_ip, OID_AUTO, random_id_period, CTLTYPE_INT|CTLFLAG_RW, --- 101 unchanged lines hidden --- |