Print this page
5007142 Add ntohll and htonll to sys/byteorder.h
6717509 Need to use bswap/bswapq for byte swap of 64-bit integer on x32/x64
PSARC 2008/474

*** 20,31 **** * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" - #include <unistd.h> #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <sys/sysconf.h> --- 20,29 ----
*** 374,427 **** {"stats", IKE_SVC_GET_STATS}, {"p1", IKE_SVC_GET_P1}, {"rule", IKE_SVC_GET_RULE}, {"preshared", IKE_SVC_GET_PS}, {"defaults", IKE_SVC_GET_DEFS}, ! {NULL, IKE_SVC_ERROR}, } }, {"set", IKE_SVC_ERROR, { {"debug", IKE_SVC_SET_DBG}, {"priv", IKE_SVC_SET_PRIV}, ! {NULL, IKE_SVC_ERROR}, } }, {"add", IKE_SVC_ERROR, { {"rule", IKE_SVC_NEW_RULE}, {"preshared", IKE_SVC_NEW_PS}, ! {NULL, IKE_SVC_ERROR}, } }, {"del", IKE_SVC_ERROR, { {"p1", IKE_SVC_DEL_P1}, {"rule", IKE_SVC_DEL_RULE}, {"preshared", IKE_SVC_DEL_PS}, ! {NULL, IKE_SVC_ERROR}, } }, {"dump", IKE_SVC_ERROR, { {"p1", IKE_SVC_DUMP_P1S}, {"rule", IKE_SVC_DUMP_RULES}, {"preshared", IKE_SVC_DUMP_PS}, ! {NULL, IKE_SVC_ERROR}, } }, {"flush", IKE_SVC_ERROR, { {"p1", IKE_SVC_FLUSH_P1S}, ! {NULL, IKE_SVC_ERROR}, } }, {"read", IKE_SVC_ERROR, { {"rule", IKE_SVC_READ_RULES}, {"preshared", IKE_SVC_READ_PS}, ! {NULL, IKE_SVC_ERROR}, } }, {"write", IKE_SVC_ERROR, { {"rule", IKE_SVC_WRITE_RULES}, {"preshared", IKE_SVC_WRITE_PS}, ! {NULL, IKE_SVC_ERROR}, } }, {"help", IKEADM_HELP_GENERAL, { {"get", IKEADM_HELP_GET}, {"set", IKEADM_HELP_SET}, --- 372,425 ---- {"stats", IKE_SVC_GET_STATS}, {"p1", IKE_SVC_GET_P1}, {"rule", IKE_SVC_GET_RULE}, {"preshared", IKE_SVC_GET_PS}, {"defaults", IKE_SVC_GET_DEFS}, ! {NULL, IKE_SVC_ERROR} } }, {"set", IKE_SVC_ERROR, { {"debug", IKE_SVC_SET_DBG}, {"priv", IKE_SVC_SET_PRIV}, ! {NULL, IKE_SVC_ERROR} } }, {"add", IKE_SVC_ERROR, { {"rule", IKE_SVC_NEW_RULE}, {"preshared", IKE_SVC_NEW_PS}, ! {NULL, IKE_SVC_ERROR} } }, {"del", IKE_SVC_ERROR, { {"p1", IKE_SVC_DEL_P1}, {"rule", IKE_SVC_DEL_RULE}, {"preshared", IKE_SVC_DEL_PS}, ! {NULL, IKE_SVC_ERROR} } }, {"dump", IKE_SVC_ERROR, { {"p1", IKE_SVC_DUMP_P1S}, {"rule", IKE_SVC_DUMP_RULES}, {"preshared", IKE_SVC_DUMP_PS}, ! {NULL, IKE_SVC_ERROR} } }, {"flush", IKE_SVC_ERROR, { {"p1", IKE_SVC_FLUSH_P1S}, ! {NULL, IKE_SVC_ERROR} } }, {"read", IKE_SVC_ERROR, { {"rule", IKE_SVC_READ_RULES}, {"preshared", IKE_SVC_READ_PS}, ! {NULL, IKE_SVC_ERROR} } }, {"write", IKE_SVC_ERROR, { {"rule", IKE_SVC_WRITE_RULES}, {"preshared", IKE_SVC_WRITE_PS}, ! {NULL, IKE_SVC_ERROR} } }, {"help", IKEADM_HELP_GENERAL, { {"get", IKEADM_HELP_GET}, {"set", IKEADM_HELP_SET},
*** 430,459 **** {"dump", IKEADM_HELP_DUMP}, {"flush", IKEADM_HELP_FLUSH}, {"read", IKEADM_HELP_READ}, {"write", IKEADM_HELP_WRITE}, {"help", IKEADM_HELP_HELP}, ! {NULL, IKE_SVC_ERROR}, } }, {"exit", IKEADM_EXIT, { ! {NULL, IKE_SVC_ERROR}, } }, {"quit", IKEADM_EXIT, { ! {NULL, IKE_SVC_ERROR}, } }, {"dbg", IKE_SVC_ERROR, { {"rbdump", IKE_SVC_DBG_RBDUMP}, ! {NULL, IKE_SVC_ERROR}, } }, {NULL, IKE_SVC_ERROR, { ! {NULL, IKE_SVC_ERROR}, } ! }, }; struct cmdtbl *ct = table; struct objtbl *ot; if (cmdstr == NULL) { --- 428,457 ---- {"dump", IKEADM_HELP_DUMP}, {"flush", IKEADM_HELP_FLUSH}, {"read", IKEADM_HELP_READ}, {"write", IKEADM_HELP_WRITE}, {"help", IKEADM_HELP_HELP}, ! {NULL, IKE_SVC_ERROR} } }, {"exit", IKEADM_EXIT, { ! {NULL, IKE_SVC_ERROR} } }, {"quit", IKEADM_EXIT, { ! {NULL, IKE_SVC_ERROR} } }, {"dbg", IKE_SVC_ERROR, { {"rbdump", IKE_SVC_DBG_RBDUMP}, ! {NULL, IKE_SVC_ERROR} } }, {NULL, IKE_SVC_ERROR, { ! {NULL, IKE_SVC_ERROR} } ! } }; struct cmdtbl *ct = table; struct objtbl *ot; if (cmdstr == NULL) {
*** 1136,1170 **** *presharedpp = NULL; return (-1); } - /* stolen from libdhcputil (dhcp_inittab.c) */ - static uint64_t - ike_ntohll(uint64_t nll) - { - #ifdef _LITTLE_ENDIAN - return ((uint64_t)ntohl(nll & 0xffffffff) << 32 | ntohl(nll >> 32)); - #else - return (nll); - #endif - } - /* * Printing functions * * A potential point of confusion here is that the ikeadm-specific string- * producing functions do not match the ipsec_util.c versions in style: the * ikeadm-specific functions return a string (and are named foostr), while * the ipsec_util.c functions actually print the string to the file named * in the second arg to the function (and are named dump_foo). * ! * The reason for this is that in the context of the ikeadm output, it ! * seemed like the localization of the text would be more straightforward ! * (and could more easily accomodate non-english grammar!) if more complete ! * phrases were being translated, rather than a bit of a phrase followed by ! * a call to dump_foo() followed by more of the phrase. */ static char * errstr(int err) { --- 1134,1156 ---- *presharedpp = NULL; return (-1); } /* * Printing functions * * A potential point of confusion here is that the ikeadm-specific string- * producing functions do not match the ipsec_util.c versions in style: the * ikeadm-specific functions return a string (and are named foostr), while * the ipsec_util.c functions actually print the string to the file named * in the second arg to the function (and are named dump_foo). * ! * Localization for ikeadm seems more straightforward when complete ! * phrases are translated rather than: a part of a phrase, a call to ! * dump_foo(), and more of the phrase. It could also accommodate ! * non-English grammar more easily. */ static char * errstr(int err) {
*** 1391,1402 **** static void print_hdr(char *prefix, ike_p1_hdr_t *hdrp) { (void) printf( gettext("%s Cookies: Initiator 0x%llx Responder 0x%llx\n"), ! prefix, ike_ntohll(hdrp->p1hdr_cookies.cky_i), ! ike_ntohll(hdrp->p1hdr_cookies.cky_r)); (void) printf(gettext("%s The local host is the %s.\n"), prefix, hdrp->p1hdr_isinit ? gettext("initiator") : gettext("responder")); (void) printf(gettext("%s ISAKMP version %d.%d; %s exchange\n"), prefix, hdrp->p1hdr_major, hdrp->p1hdr_minor, xchgstr(hdrp->p1hdr_xchg)); (void) printf(gettext("%s Current state is %s"), prefix, --- 1377,1388 ---- static void print_hdr(char *prefix, ike_p1_hdr_t *hdrp) { (void) printf( gettext("%s Cookies: Initiator 0x%llx Responder 0x%llx\n"), ! prefix, ntohll(hdrp->p1hdr_cookies.cky_i), ! ntohll(hdrp->p1hdr_cookies.cky_r)); (void) printf(gettext("%s The local host is the %s.\n"), prefix, hdrp->p1hdr_isinit ? gettext("initiator") : gettext("responder")); (void) printf(gettext("%s ISAKMP version %d.%d; %s exchange\n"), prefix, hdrp->p1hdr_major, hdrp->p1hdr_minor, xchgstr(hdrp->p1hdr_xchg)); (void) printf(gettext("%s Current state is %s"), prefix,