⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spi.c

📁 FREESWAN VPN源代码包
💻 C
📖 第 1 页 / 共 5 页
字号:
				exit(1);			default:				fprintf(stderr, "unknown error:%d\n", error);				exit(1);		}	}#endif#if 0	sleep (1); /* wait for errors to come back through signal handling */	read(pfkey_sock, &pfkey_buf, sizeof(pfkey_msg) );	fprintf(stdout, "%s: pfkey_buf read.\n", program_name);	/* fprintf(stdout, "%s: press a key to close pfkey socket.\n", program_name); */	/* getchar(); */ /* RGB wait for keystroke to exit (debug) */	fprintf(stdout, "%s: sleeping 2 seconds to allow return messages.\n", program_name);	sleep(1); /* wait for errors to come back through signal handling */	fprintf(stdout, "%s: pfkey_sig_handler called.\n", program_name);	pfkey_sig_handler(0); /* solicit upmsg */#endif	if(pfkey_msg) {		pfkey_extensions_free(extensions);		pfkey_msg_free(&pfkey_msg);	}	if(debug) {		fprintf(stdout, "%s: pfkey message buffer freed.\n",			program_name);	}	(void) close(pfkey_sock);  /* close the socket */	if(authkey) {		memset((caddr_t)authkey, 0, authkeylen);		free(authkey);	}	if(enckey) {		memset((caddr_t)enckey, 0, enckeylen);		free(enckey);	}	if(iv) {		memset((caddr_t)iv, 0, ivlen);		free(iv);	}	exit(0);}/* * $Log: spi.c,v $ * Revision 1.5  2003/05/26 12:47:12  ken * Relocate "; so GCC 3.3 is happier * * Revision 1.4  2003/04/14 16:08:37  jjo * . 1DES manual mode fix * * Revision 1.3  2003/03/11 14:49:29  jjo * . manual mode (spi) ESP_NULL relaxed checks * * Revision 1.2.4.1  2003/03/05 20:29:13  jjo * . missing changes for manual ESP_NULL support in spi.c * * Revision 1.2  2002/09/05 03:27:09  ken * Applied freeswan-alg-0.8.0-BASE-klips.diff * * Revision 1.1.1.1  2002/09/05 03:13:19  ken * 1.98b * * Revision 1.84  2002/03/08 21:44:04  rgb * Update for all GNU-compliant --version strings. * * Revision 1.83  2002/02/20 00:01:53  rgb * Cleaned out unused code. * * Revision 1.82  2001/11/09 02:16:37  rgb * Fixed bug that erroneously required explicit af parameter for --said. * Fixed missing SA message on delete. * * Revision 1.81  2001/11/06 20:18:47  rgb * Added lifetime parameters. * * Revision 1.80  2001/10/25 06:57:10  rgb * Added space as legal delimiter in lifetime parameter list. * * Revision 1.79  2001/10/24 03:23:55  rgb * Moved lifetime option parsing to a seperate function and allowed for * comma-seperated lists of lifetime parameters. * Moved SATYPE registrations to a seperate function. * * Revision 1.78  2001/10/22 19:49:35  rgb * Added lifetime parameter capabilities. * * Revision 1.77  2001/10/02 17:17:17  rgb * Check error return for all "tto*" calls and report errors.  This, in * conjuction with the fix to "tto*" will detect AF not set. * * Revision 1.76  2001/09/08 21:13:35  rgb * Added pfkey ident extension support for ISAKMPd. (NetCelo) * * Revision 1.75  2001/09/07 22:24:42  rgb * Added EAFNOSUPPORT socket open error code in case KLIPS is not loaded. * * Revision 1.74  2001/06/14 19:35:14  rgb * Update copyright date. * * Revision 1.73  2001/05/30 08:14:05  rgb * Removed vestiges of esp-null transforms. * * Revision 1.72  2001/05/21 02:02:55  rgb * Eliminate 1-letter options. * * Revision 1.71  2001/05/16 05:07:20  rgb * Fixed --label option in KLIPS manual utils to add the label to the * command name rather than replace it in error text. * Fix 'print table' non-option in KLIPS manual utils to deal with --label * and --debug options. * * Revision 1.70  2000/11/06 04:36:57  rgb * Display conversion on replay_window failure. * Don't register SATYPEs for manual. * * Revision 1.69  2000/09/28 00:37:20  rgb * Swapped order of pfkey_registration of IPCOMP and IPIP. * * Revision 1.68  2000/09/17 18:56:48  rgb * Added IPCOMP support. * * Revision 1.67  2000/09/12 22:36:45  rgb * Gerhard's IPv6 support. * * Revision 1.66  2000/09/08 19:17:31  rgb * Removed all references to CONFIG_IPSEC_PFKEYv2. * * Revision 1.65  2000/08/30 05:34:54  rgb * Minor clean-up. * * Revision 1.64  2000/08/27 01:50:51  rgb * Update copyright dates and fix replay window endian bug. * * Revision 1.63  2000/08/18 21:19:27  rgb * Removed no longer used resolve_ip() code. * * Revision 1.62  2000/08/01 14:51:53  rgb * Removed _all_ remaining traces of DES. * * Revision 1.61  2000/07/26 20:48:42  rgb * Fixed typo that caused compile failure. * * Revision 1.60  2000/07/26 03:41:46  rgb * Changed all printf's to fprintf's.  Fixed tncfg's usage to stderr. * * Revision 1.59  2000/06/21 16:51:27  rgb * Added no additional argument option to usage text. * * Revision 1.58  2000/03/16 06:40:49  rgb * Hardcode PF_KEYv2 support. * * Revision 1.57  2000/01/22 23:22:46  rgb * Use new function proto2satype(). * * Revision 1.56  2000/01/21 09:42:32  rgb * Replace resolve_ip() with atoaddr() from freeswanlib. * * Revision 1.55  2000/01/21 06:24:57  rgb * Blasted any references in usage and code to deleted algos. * Removed DES usage. * Changed usage of memset on extensions to pfkey_extensions_init(). * * Revision 1.54  1999/12/29 21:17:41  rgb * Changed pfkey_msg_build() I/F to include a struct sadb_msg** * parameter for cleaner manipulation of extensions[] and to guard * against potential memory leaks. * Changed the I/F to pfkey_msg_free() for the same reason. * * Revision 1.53  1999/12/10 17:35:37  rgb * Added address debugging. * Fixed undetected spi followed by said sanity check bug. * Fixed unset spi and edst using said bug. * * Revision 1.52  1999/12/09 23:13:53  rgb * Added argument to pfkey_sa_build() to do eroutes. * * Revision 1.51  1999/12/07 18:29:13  rgb * Converted local functions to static to limit scope. * Removed unused cruft. * Changed types to unsigned to quiet compiler. * Cleaned up compiler directives. * * Revision 1.50  1999/12/01 22:19:04  rgb * Change pfkey_sa_build to accept an SPI in network byte order. * Minor reformatting. * Close socket after cleanup. * Moved pfkey_lib_debug variable into the library. * * Revision 1.49  1999/11/27 11:53:56  rgb * Fix pfkey_v2_parse calls. * Add argument to pfkey_msg_parse() for direction. * Move parse-after-build check inside pfkey_msg_build(). * * Revision 1.48  1999/11/25 19:05:12  rgb * Add parser calls to parse newly built message and disabled signal * handler. * Zapped all manual pfkey assignment code in favour of build library * calls. * Clean out other unused code. * * Revision 1.47  1999/11/25 09:08:46  rgb * Turn debug compiler directive into command line switch. * Fix unused argument bug in usage. * Delete unused variables and code. * Add default to alg switch to catch algo not set. * Added error return checking from pfkey_build routines. * Clarified assignment in conditional with parens. * Fixed extension pointer bugs passing args to pfkey_build routines. * * Revision 1.46  1999/11/24 17:22:25  rgb * Fix PFKEY_BUILD_LIB compiler directives. * Fix bug in memset(extensions) size argument. * Fix bug in extensions type and calling style. * Fix PFKEY_BUILD_LIB ifdef boundary bug. * * Revision 1.45  1999/11/23 23:11:18  rgb * Added pfkey_v2_build calls. * Sort out pfkey and freeswan headers, putting them in a library path. * Corrected a couple of bugs in as-yet-inactive code. * Clarified indention of pfkey_msg assembly code. * * Revision 1.44  1999/11/18 04:56:07  rgb * Change expected signal type comment. * Add signal handler degugging code. * Temporarily remove select() code for signal debugging. * Fix minor sequence number bug. * * Revision 1.43  1999/10/27 20:01:01  rgb * Enabled the signal handler. * Changed pfkey_seq from post-increment to pre-increment. * * Revision 1.42  1999/10/16 00:26:34  rgb * Add to pfkey lifetime support. * Attempt to add pfkey socket receive support. * Change to more intuitive name of pfkey socket variable. * * Revision 1.41  1999/07/08 19:18:33  rgb * Shut off debugging by default. * * Revision 1.40  1999/06/10 16:12:53  rgb * Add autoconf to use pfkey. * Add error return code description. * * Revision 1.39  1999/04/29 15:26:54  rgb * Debug pfkey support. * Add debugging instrumentation. * Add error return code checks. * Add support for DELETE and CLR messages. * Add support for IPPROTO_IPIP. * Copy in src address. * Set sin_zero properly. * Add ident_d support(untested). * Fix msg header copy length bug. * Add kludge to support FLUSH. * * Revision 1.38  1999/04/15 15:37:28  rgb * Forward check changes from POST1_00 branch. * * Revision 1.34.2.2  1999/04/13 20:58:10  rgb * Add argc==1 --> /proc/net/ipsec_*. * * Revision 1.34.2.1  1999/03/30 17:07:04  rgb * Make main() return type explicit. * Add pfkey code. * OOO window size htons bugfix. * * Revision 1.37  1999/04/11 00:12:08  henry * GPL boilerplate * * Revision 1.36  1999/04/06 04:54:38  rgb * Fix/Add RCSID Id: and Log: bits to make PHMDs happy.  This includes * patch shell fixes. * * Revision 1.35  1999/03/17 15:40:07  rgb * Make explicit main() return type of int. * Fix memory clear bug in spi.c. * * Revision 1.34  1999/02/16 05:20:49  rgb * Fix memory clear bugs just prior to normal exit that were causing ipsec * manual scripts to fail and potentially leaving large core files. * * Revision 1.33  1999/02/09 00:13:16  rgb * Fix replay window htonl bug. * * Revision 1.32  1999/01/22 06:35:54  rgb * 64-bit clean-up. * Added algorithm switch code. * Removed IV requirement, now an option (kept code for back-compat). * Cruft clean-out. * Add error-checking. * Removed PFKEY code, will re-add later. * * Revision 1.31  1998/11/12 21:08:04  rgb * Add --label option to identify caller from scripts. * * Revision 1.30  1998/11/11 18:34:12  rgb * Fixed #includes for RH5.1. * * Revision 1.29  1998/11/11 07:14:18  rgb * #include cleanup to hopefully compile under RH5.1. * * Revision 1.28  1998/11/10 05:34:11  rgb * Add support for SA direction flag. * Add more specific error output messages. * * Revision 1.27  1998/10/27 00:31:12  rgb * Set replay structure flag to 0 (not used). * * Revision 1.26  1998/10/26 01:28:38  henry * use SA_* protocol names, not IPPROTO_*, to avoid compile problems * * Revision 1.25  1998/10/25 02:45:39  rgb * Change program to program_name to bring in line with other utils. * Added debugging code to find null proto bug, premature exit on hex info bug. * Fixed premature exit on hex info bug. * * Revision 1.24  1998/10/22 06:34:16  rgb * Fixed bad stucture pointer. * Fixed unknown var (cut and paste error). * * Revision 1.23  1998/10/19 18:56:24  rgb * Added inclusion of freeswan.h. * sa_id structure implemented and used: now includes protocol. * Start to add some inactive pfkey2 code. * * Revision 1.22  1998/10/09 18:47:30  rgb * Add 'optionfrom' to get more options from a named file. * * Revision 1.21  1998/10/09 04:36:03  rgb * Standardise on '-96' notation for AH transforms. * * Revision 1.20  1998/09/03 01:29:32  henry * improve atodata()-failed error messages a bit * * Revision 1.19  1998/09/02 03:14:33  henry * no point in printing zero lengths used as error returns * * Revision 1.18  1998/09/02 03:12:08  henry * --help output goes on stdout, not stderr * * Revision 1.17  1998/09/01 19:50:50  henry * fix operator-precedence bug that often messed up --ah SPI creation * minor cleanup * * Revision 1.16  1998/08/28 03:14:12  rgb * Simplify/Clarify usage text. * * Revision 1.15  1998/08/12 00:16:46  rgb * Removed a lot of old cruft that was commented out. * Updated usage text. * Added config options for new xforms. * * Revision 1.14  1998/08/05 22:24:45  rgb * Change includes to accomodate RH5.x * * Revision 1.13  1998/07/29 21:41:17  rgb * Fix spi bug, add hexadecimal value entry debugging. * * Revision 1.12  1998/07/28 00:14:24  rgb * Convert from positional parameters to long options. * Add --clean option. * Add hostname lookup support. * * Revision 1.11  1998/07/14 18:15:55  rgb * Fix undetected bug using AH-SHA1 with manual keying:  The key was * truncated by the data structure used to get it to the kernel. * * Revision 1.10  1998/07/09 18:14:11  rgb * Added error checking to IP's and keys. * Made most error messages more specific rather than spamming usage text. * Added more descriptive kernel error return codes and messages. * Converted all spi translations to unsigned. * Removed all invocations of perror. * * Revision 1.9  1998/06/30 18:04:31  rgb * Fix compiler warning: couldn't find 'struct option' prototype. * * Revision 1.8  1998/06/11 05:40:04  rgb * Make usage text more concise WRT replay window sizes and defaults. * Make error reporting more concise WRT exact IV and key lengths supported * and their units. * * Revision 1.7  1998/06/08 17:54:58  rgb * Fixed string escape code in usage. * * Revision 1.6  1998/06/05 02:22:49  rgb * Clarify usage text and update for key splitting and i/r removal. * Require keys of exact length. * * Revision 1.5  1998/05/27 20:54:11  rgb * Added --help and --version directives.  Separated auth and encr keys. * * Revision 1.4  1998/05/18 21:12:13  rgb * Clean up debugging code, clean up after keys, cleaner options setting. * * Revision 1.3  1998/05/06 03:37:11  rgb * Fixed incorrect signed interpretation of command line spi to unsigned long. * It prevented deletion of ~spi values generated by pluto. * * Revision 1.2  1998/05/01 23:34:01  rgb * Clarified the usage text. * * Revision 1.1.1.1  1998/04/08 05:35:10  henry * RGB's ipsec-0.8pre2.tar.gz ipsec-0.8 * * Revision 0.5  1997/06/03 04:31:55  ji * Added esp 3des-md5-96 * * Revision 0.4  1997/01/15 01:37:54  ji * New program in this release, replaces set* programs. * * */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -