Deleted Added
full compact
ip6_id.c (120652) ip6_id.c (133720)
1/* $KAME: ip6_id.c,v 1.13 2003/09/16 09:11:19 itojun Exp $ */
2/* $OpenBSD: ip_id.c,v 1.6 2002/03/15 18:19:52 millert Exp $ */
1/* $KAME: ip6_id.c,v 1.13 2003/09/16 09:11:19 itojun Exp $ */
2/* $OpenBSD: ip_id.c,v 1.6 2002/03/15 18:19:52 millert Exp $ */
3/* $FreeBSD: head/sys/netinet6/ip6_id.c 120652 2003-10-01 21:45:57Z ume $ */
3/* $FreeBSD: head/sys/netinet6/ip6_id.c 133720 2004-08-14 15:32:40Z dwmalone $ */
4
5/*
6 * Copyright (C) 2003 WIDE Project.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:

--- 69 unchanged lines hidden (view full) ---

81 * The transaction id is determined by:
82 * id[n] = seed xor (g^X[n] mod n)
83 *
84 * Effectivly the id is restricted to the lower (bits - 1) bits, thus
85 * yielding two different cycles by toggling the msb on and off.
86 * This avoids reuse issues caused by reseeding.
87 */
88
4
5/*
6 * Copyright (C) 2003 WIDE Project.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:

--- 69 unchanged lines hidden (view full) ---

81 * The transaction id is determined by:
82 * id[n] = seed xor (g^X[n] mod n)
83 *
84 * Effectivly the id is restricted to the lower (bits - 1) bits, thus
85 * yielding two different cycles by toggling the msb on and off.
86 * This avoids reuse issues caused by reseeding.
87 */
88
89#include "opt_random_ip_id.h"
90
91#include <sys/types.h>
92#include <sys/param.h>
93#include <sys/kernel.h>
94#include <sys/socket.h>
95#include <sys/libkern.h>
96
97#include <net/if.h>
98#include <net/route.h>
99#include <netinet/in.h>
100#include <netinet/ip6.h>
101#include <netinet6/ip6_var.h>
102
89#include <sys/types.h>
90#include <sys/param.h>
91#include <sys/kernel.h>
92#include <sys/socket.h>
93#include <sys/libkern.h>
94
95#include <net/if.h>
96#include <net/route.h>
97#include <netinet/in.h>
98#include <netinet/ip6.h>
99#include <netinet6/ip6_var.h>
100
103#ifdef RANDOM_IP_ID
104
105#ifndef INT32_MAX
106#define INT32_MAX 0x7fffffffU
107#endif
108
109struct randomtab {
110 const int ru_bits; /* resulting bits */
111 const long ru_out; /* Time after wich will be reseeded */
112 const u_int32_t ru_max; /* Uniq cycle, avoid blackjack prediction */

--- 149 unchanged lines hidden (view full) ---

262}
263
264u_int32_t
265ip6_randomflowlabel(void)
266{
267
268 return randomid(&randomtab_20) & 0xfffff;
269}
101#ifndef INT32_MAX
102#define INT32_MAX 0x7fffffffU
103#endif
104
105struct randomtab {
106 const int ru_bits; /* resulting bits */
107 const long ru_out; /* Time after wich will be reseeded */
108 const u_int32_t ru_max; /* Uniq cycle, avoid blackjack prediction */

--- 149 unchanged lines hidden (view full) ---

258}
259
260u_int32_t
261ip6_randomflowlabel(void)
262{
263
264 return randomid(&randomtab_20) & 0xfffff;
265}
270
271#endif /* RANDOM_IP_ID */