交流


交流趋使世界文明进步。(请使用谷歌浏览器/Please use CHROME browser)
https://twitter.com/nankezhou
各位作者原创之文章已经注明各自之作者,均各自获得其著作权与版权保护。

Translate

著作权和版权声明

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 4.0 International License. Chinese (CC BY 4.0) .

2019年的春节时间是下月5日 Today Developer Calendar

2018年2月5日 星期一

prefixpolicy排序BAT判断命令DOS OR MINGW32


::版本判断 原创
::Copyright (c) Microsoft Corporation. All rights reserved. :: by https://twitter.com/nankezhou
:: by https://gotovpn.blogspot.com


if /I "%osver%"=="1" (


netsh int ipv6 set prefixpolicy ::1/128       50 0
echo. ::1/128是本地网关localhost的解析地址,通常获得默认常规“0”优先。


netsh int ipv6 set prefixpolicy ::/0          40 1
echo. ::/0是本地localhost默认的IPV6解析地址,通常获得第40 1 级优先。

netsh int ipv6 set prefixpolicy 2002::/16     30 1
echo. 2002::/16是IPv6到IPV4的接口,通常获得30 1类优先。


netsh int ipv6 set prefixpolicy ::/96         20 3
echo. ::/96 是IPv4的兼容性接口,通常获得20 3级优先。

netsh int ipv6 set prefixpolicy ::ffff:0:0/96 10 4
echo. ::ffff:0:0/96 是IPv4的兼容性接口长地址,通常获得10 4级优先。


netsh int ipv6 set prefixpolicy 2001::/32 5 1
echo. 2001::/32 是IPv6的teredo隧道解析,通常获得5 1级优先。这里我们把它设置为第1位(1)级优先。

) else (
netsh int ipv6 add prefixpolicy 2001::/32      15 1 persistent
netsh int ipv6 add prefixpolicy ::ffff:0:0/96    20 2
netsh int ipv6 add prefixpolicy ::/96              25 3
netsh int ipv6 add prefixpolicy 2002::/16      30 1

netsh int ipv6 add prefixpolicy ::/0                35 5
netsh int ipv6 add prefixpolicy ::1/128          40 6
netsh int ipv6 add prefixpolicy 2001::/16      45 7
netsh int ipv6 add prefixpolicy 3ffe::/16        50 8
netsh int ipv6 add prefixpolicy fec0::/10       55 9
netsh int ipv6 add prefixpolicy fc00::/7         60 10
)



netsh int ipv6 add prefixpolicy 2001::/32      15 1 persistent
netsh int ipv6 add prefixpolicy ::ffff:0:0/96    20 2
netsh int ipv6 add prefixpolicy ::/96              25 3
netsh int ipv6 add prefixpolicy 2002::/16      30 1

netsh int ipv6 add prefixpolicy ::/0                35 5
netsh int ipv6 add prefixpolicy ::1/128          40 6
netsh int ipv6 add prefixpolicy 2001::/16      45 7
netsh int ipv6 add prefixpolicy 3ffe::/16        50 8
netsh int ipv6 add prefixpolicy fec0::/10       55 9
netsh int ipv6 add prefixpolicy fc00::/7         60 10






2018年2月4日 星期日

Solve most important issues for NSS


Have you encountered such a problem for the  NSS software Installation on Windows NT ?
?

fatal error C1083Cannot open include file: 'pcap/pcap.h': No such file or directory


You must modify the environment variables.

Add an announcement for environment variables in the “PATH”


X: \......\ security\nss\lib\util\pcap

it is your installation folder for the NSS


Of course, this folder is not empty ,I'm on going to work for it ... please your close attention to here ....



first step: Change in secasn1.h

—————————————————————————————

#define WIN32  

#include "pcap.h"  



/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*
 * Support for encoding/decoding of ASN.1 using BER/DER (Basic/Distinguished
 * Encoding Rules).  The routines are found in and used extensively by the
 * security library, but exported for other use.
 *
 * $Id: secasn1.h,v 1.18 2012/04/25 14:50:16 gerv%gerv.net Exp $
 */

#ifndef _SECASN1_H_
#define _SECASN1_H_

#include "utilrename.h"
#include "plarena.h"

#include "seccomon.h"
#include "secasn1t.h"


/************************************************************************/
SEC_BEGIN_PROTOS

/*
 * XXX These function prototypes need full, explanatory comments.
 */

/*
** Decoding.
*/

extern SEC_ASN1DecoderContext *SEC_ASN1DecoderStart(PLArenaPool *pool,
    void *dest,
    const SEC_ASN1Template *t);

/* XXX char or unsigned char? */
extern SECStatus SEC_ASN1DecoderUpdate(SEC_ASN1DecoderContext *cx,
       const char *buf,
       unsigned long len);

extern SECStatus SEC_ASN1DecoderFinish(SEC_ASN1DecoderContext *cx);

/* Higher level code detected an error, abort the rest of the processing */
extern void SEC_ASN1DecoderAbort(SEC_ASN1DecoderContext *cx, int error);

extern void SEC_ASN1DecoderSetFilterProc(SEC_ASN1DecoderContext *cx,
SEC_ASN1WriteProc fn,
void *arg, PRBool no_store);

extern void SEC_ASN1DecoderClearFilterProc(SEC_ASN1DecoderContext *cx);

extern void SEC_ASN1DecoderSetNotifyProc(SEC_ASN1DecoderContext *cx,
SEC_ASN1NotifyProc fn,
void *arg);

extern void SEC_ASN1DecoderClearNotifyProc(SEC_ASN1DecoderContext *cx);

extern SECStatus SEC_ASN1Decode(PLArenaPool *pool, void *dest,
const SEC_ASN1Template *t,
const char *buf, long len);

/* Both classic ASN.1 and QuickDER have a feature that removes leading zeroes
   out of SEC_ASN1_INTEGER if the caller sets siUnsignedInteger in the type
   field of the target SECItem prior to calling the decoder. Otherwise, the
   type field is ignored and untouched. For SECItem that are dynamically
   allocated (from POINTER, SET OF, SEQUENCE OF) the decoder sets the type
   field to siBuffer. */

extern SECStatus SEC_ASN1DecodeItem(PLArenaPool *pool, void *dest,
    const SEC_ASN1Template *t,
    const SECItem *src);

extern SECStatus SEC_QuickDERDecodeItem(PLArenaPool* arena, void* dest,
                     const SEC_ASN1Template* templateEntry,
                     const SECItem* src);

/*
** Encoding.
*/

extern SEC_ASN1EncoderContext *SEC_ASN1EncoderStart(const void *src,
    const SEC_ASN1Template *t,
    SEC_ASN1WriteProc fn,
    void *output_arg);

/* XXX char or unsigned char? */
extern SECStatus SEC_ASN1EncoderUpdate(SEC_ASN1EncoderContext *cx,
       const char *buf,
       unsigned long len);

extern void SEC_ASN1EncoderFinish(SEC_ASN1EncoderContext *cx);

/* Higher level code detected an error, abort the rest of the processing */
extern void SEC_ASN1EncoderAbort(SEC_ASN1EncoderContext *cx, int error);

extern void SEC_ASN1EncoderSetNotifyProc(SEC_ASN1EncoderContext *cx,
SEC_ASN1NotifyProc fn,
void *arg);

extern void SEC_ASN1EncoderClearNotifyProc(SEC_ASN1EncoderContext *cx);

extern void SEC_ASN1EncoderSetStreaming(SEC_ASN1EncoderContext *cx);

extern void SEC_ASN1EncoderClearStreaming(SEC_ASN1EncoderContext *cx);

extern void sec_ASN1EncoderSetDER(SEC_ASN1EncoderContext *cx);

extern void sec_ASN1EncoderClearDER(SEC_ASN1EncoderContext *cx);

extern void SEC_ASN1EncoderSetTakeFromBuf(SEC_ASN1EncoderContext *cx);

extern void SEC_ASN1EncoderClearTakeFromBuf(SEC_ASN1EncoderContext *cx);

extern SECStatus SEC_ASN1Encode(const void *src, const SEC_ASN1Template *t,
SEC_ASN1WriteProc output_proc,
void *output_arg);

/*
 * If both pool and dest are NULL, the caller should free the returned SECItem
 * with a SECITEM_FreeItem(..., PR_TRUE) call.  If pool is NULL but dest is
 * not NULL, the caller should free the data buffer pointed to by dest with a
 * SECITEM_FreeItem(dest, PR_FALSE) or PORT_Free(dest->data) call.
 */
extern SECItem * SEC_ASN1EncodeItem(PLArenaPool *pool, SECItem *dest,
    const void *src, const SEC_ASN1Template *t);

extern SECItem * SEC_ASN1EncodeInteger(PLArenaPool *pool,
       SECItem *dest, long value);

extern SECItem * SEC_ASN1EncodeUnsignedInteger(PLArenaPool *pool,
       SECItem *dest,
       unsigned long value);

extern SECStatus SEC_ASN1DecodeInteger(SECItem *src,
       unsigned long *value);

/*
** Utilities.
*/

/*
 * We have a length that needs to be encoded; how many bytes will the
 * encoding take?
 */
extern int SEC_ASN1LengthLength (unsigned long len);

/* encode the length and return the number of bytes we encoded. Buffer
 * must be pre allocated  */
extern int SEC_ASN1EncodeLength(unsigned char *buf,int value);

/*
 * Find the appropriate subtemplate for the given template.
 * This may involve calling a "chooser" function, or it may just
 * be right there.  In either case, it is expected to *have* a
 * subtemplate; this is asserted in debug builds (in non-debug
 * builds, NULL will be returned).
 *
 * "thing" is a pointer to the structure being encoded/decoded
 * "encoding", when true, means that we are in the process of encoding
 * (as opposed to in the process of decoding)
 */
extern const SEC_ASN1Template *
SEC_ASN1GetSubtemplate (const SEC_ASN1Template *inTemplate, void *thing,
PRBool encoding);

/* whether the template is for a primitive type or a choice of
 * primitive types
 */
extern PRBool SEC_ASN1IsTemplateSimple(const SEC_ASN1Template *theTemplate);

/************************************************************************/

/*
 * Generic Templates
 * One for each of the simple types, plus a special one for ANY, plus:
 * - a pointer to each one of those
 * - a set of each one of those
 * - a sequence of each one of those
 *
 * Note that these are alphabetical (case insensitive); please add new
 * ones in the appropriate place.
 */

extern const SEC_ASN1Template SEC_AnyTemplate[];
extern const SEC_ASN1Template SEC_BitStringTemplate[];
extern const SEC_ASN1Template SEC_BMPStringTemplate[];
extern const SEC_ASN1Template SEC_BooleanTemplate[];
extern const SEC_ASN1Template SEC_EnumeratedTemplate[];
extern const SEC_ASN1Template SEC_GeneralizedTimeTemplate[];
extern const SEC_ASN1Template SEC_IA5StringTemplate[];
extern const SEC_ASN1Template SEC_IntegerTemplate[];
extern const SEC_ASN1Template SEC_NullTemplate[];
extern const SEC_ASN1Template SEC_ObjectIDTemplate[];
extern const SEC_ASN1Template SEC_OctetStringTemplate[];
extern const SEC_ASN1Template SEC_PrintableStringTemplate[];
extern const SEC_ASN1Template SEC_T61StringTemplate[];
extern const SEC_ASN1Template SEC_UniversalStringTemplate[];
extern const SEC_ASN1Template SEC_UTCTimeTemplate[];
extern const SEC_ASN1Template SEC_UTF8StringTemplate[];
extern const SEC_ASN1Template SEC_VisibleStringTemplate[];

extern const SEC_ASN1Template SEC_PointerToAnyTemplate[];
extern const SEC_ASN1Template SEC_PointerToBitStringTemplate[];
extern const SEC_ASN1Template SEC_PointerToBMPStringTemplate[];
extern const SEC_ASN1Template SEC_PointerToBooleanTemplate[];
extern const SEC_ASN1Template SEC_PointerToEnumeratedTemplate[];
extern const SEC_ASN1Template SEC_PointerToGeneralizedTimeTemplate[];
extern const SEC_ASN1Template SEC_PointerToIA5StringTemplate[];
extern const SEC_ASN1Template SEC_PointerToIntegerTemplate[];
extern const SEC_ASN1Template SEC_PointerToNullTemplate[];
extern const SEC_ASN1Template SEC_PointerToObjectIDTemplate[];
extern const SEC_ASN1Template SEC_PointerToOctetStringTemplate[];
extern const SEC_ASN1Template SEC_PointerToPrintableStringTemplate[];
extern const SEC_ASN1Template SEC_PointerToT61StringTemplate[];
extern const SEC_ASN1Template SEC_PointerToUniversalStringTemplate[];
extern const SEC_ASN1Template SEC_PointerToUTCTimeTemplate[];
extern const SEC_ASN1Template SEC_PointerToUTF8StringTemplate[];
extern const SEC_ASN1Template SEC_PointerToVisibleStringTemplate[];

extern const SEC_ASN1Template SEC_SequenceOfAnyTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfBitStringTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfBMPStringTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfBooleanTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfEnumeratedTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfGeneralizedTimeTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfIA5StringTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfIntegerTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfNullTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfObjectIDTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfOctetStringTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfPrintableStringTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfT61StringTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfUniversalStringTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfUTCTimeTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfUTF8StringTemplate[];
extern const SEC_ASN1Template SEC_SequenceOfVisibleStringTemplate[];

extern const SEC_ASN1Template SEC_SetOfAnyTemplate[];
extern const SEC_ASN1Template SEC_SetOfBitStringTemplate[];
extern const SEC_ASN1Template SEC_SetOfBMPStringTemplate[];
extern const SEC_ASN1Template SEC_SetOfBooleanTemplate[];
extern const SEC_ASN1Template SEC_SetOfEnumeratedTemplate[];
extern const SEC_ASN1Template SEC_SetOfGeneralizedTimeTemplate[];
extern const SEC_ASN1Template SEC_SetOfIA5StringTemplate[];
extern const SEC_ASN1Template SEC_SetOfIntegerTemplate[];
extern const SEC_ASN1Template SEC_SetOfNullTemplate[];
extern const SEC_ASN1Template SEC_SetOfObjectIDTemplate[];
extern const SEC_ASN1Template SEC_SetOfOctetStringTemplate[];
extern const SEC_ASN1Template SEC_SetOfPrintableStringTemplate[];
extern const SEC_ASN1Template SEC_SetOfT61StringTemplate[];
extern const SEC_ASN1Template SEC_SetOfUniversalStringTemplate[];
extern const SEC_ASN1Template SEC_SetOfUTCTimeTemplate[];
extern const SEC_ASN1Template SEC_SetOfUTF8StringTemplate[];
extern const SEC_ASN1Template SEC_SetOfVisibleStringTemplate[];

/*
 * Template for skipping a subitem; this only makes sense when decoding.
 */
extern const SEC_ASN1Template SEC_SkipTemplate[];

/* These functions simply return the address of the above-declared templates.
** This is necessary for Windows DLLs.  Sigh.
*/
SEC_ASN1_CHOOSER_DECLARE(SEC_AnyTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_BMPStringTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_BooleanTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_BitStringTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_GeneralizedTimeTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_IA5StringTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_IntegerTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_NullTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_ObjectIDTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_OctetStringTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_UTCTimeTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_UTF8StringTemplate)

SEC_ASN1_CHOOSER_DECLARE(SEC_PointerToAnyTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_PointerToOctetStringTemplate)

SEC_ASN1_CHOOSER_DECLARE(SEC_SetOfAnyTemplate)

SEC_ASN1_CHOOSER_DECLARE(SEC_EnumeratedTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_PointerToEnumeratedTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_SequenceOfAnyTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_SequenceOfObjectIDTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_SkipTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_UniversalStringTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_PrintableStringTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_T61StringTemplate)
SEC_ASN1_CHOOSER_DECLARE(SEC_PointerToGeneralizedTimeTemplate)
SEC_END_PROTOS
#endif /* _SECASN1_H_ */

—————————————————————————————


The second step: Modify the code for the“pcap.h” file

—————————————————————————————



 * Copyright (c) 1993, 1994, 1995, 1996, 1997
 * The Regents of the University of California.  All rights reserved.
 *      Modify the code for the“pcap.h”file by gotovpn.blogspot.com

/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */

 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 * This product includes software developed by the Computer Systems
 * Engineering Group at Lawrence Berkeley Laboratory.
 * 4. Neither the name of the University nor of the Laboratory may be used
 *    to endorse or promote products derived from this software without
 *    specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006/10/04 18:09:22 guy Exp $ (LBL)
 */

/*
 * For backwards compatibility.
 *
 * Note to OS vendors: do NOT get rid of this file!  Many applications
 * expect to be able to include <pcap.h>, and at least some of them
 * go through contortions in their configure scripts to try to detect
 * OSes that have "helpfully" moved pcap.h to <pcap/pcap.h> without
 * leaving behind a <pcap.h> file.
 */


 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 * This product includes software developed by the Computer Systems
 * Engineering Group at Lawrence Berkeley Laboratory.
 * 4. Neither the name of the University nor of the Laboratory may be used
 *    to endorse or promote products derived from this software without
 *    specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * @(#) $Header: /tcpdump/master/libpcap/pcap/pcap.h,v 1.4.2.11 2008-10-06 15:38:39 gianluca Exp $ (LBL)
 */

#ifndef lib_pcap_pcap_h
#define lib_pcap_pcap_h

#if defined(WIN32)
  #include <pcap-stdinc.h>
#elif defined(MSDOS)
  #include <sys/types.h>
  #include <sys/socket.h>  /* u_int, u_char etc. */
#else /* UN*X */
  #include <sys/types.h>
  #include <sys/time.h>
#endif /* WIN32/MSDOS/UN*X */

#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H
#include <pcap/bpf.h>
#endif

#include <stdio.h>

#ifdef HAVE_REMOTE
// We have to define the SOCKET here, although it has been defined in sockutils.h
// This is to avoid the distribution of the 'sockutils.h' file around
// (for example in the WinPcap developer's pack)
#ifndef SOCKET
#ifdef WIN32
#define SOCKET unsigned int
#else
#define SOCKET int
#endif
#endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

#define PCAP_VERSION_MAJOR 2
#define PCAP_VERSION_MINOR 4

#define PCAP_ERRBUF_SIZE 256

/*
 * Compatibility for systems that have a bpf.h that
 * predates the bpf typedefs for 64-bit support.
 */
#if BPF_RELEASE - 0 < 199406
typedef int bpf_int32;
typedef u_int bpf_u_int32;
#endif

typedef struct pcap pcap_t;
typedef struct pcap_dumper pcap_dumper_t;
typedef struct pcap_if pcap_if_t;
typedef struct pcap_addr pcap_addr_t;

/*
 * The first record in the file contains saved values for some
 * of the flags used in the printout phases of tcpdump.
 * Many fields here are 32 bit ints so compilers won't insert unwanted
 * padding; these files need to be interchangeable across architectures.
 *
 * Do not change the layout of this structure, in any way (this includes
 * changes that only affect the length of fields in this structure).
 *
 * Also, do not change the interpretation of any of the members of this
 * structure, in any way (this includes using values other than
 * LINKTYPE_ values, as defined in "savefile.c", in the "linktype"
 * field).
 *
 * Instead:
 *
 * introduce a new structure for the new format, if the layout
 * of the structure changed;
 *
 * send mail to "tcpdump-workers@lists.tcpdump.org", requesting
 * a new magic number for your new capture file format, and, when
 * you get the new magic number, put it in "savefile.c";
 *
 * use that magic number for save files with the changed file
 * header;
 *
 * make the code in "savefile.c" capable of reading files with
 * the old file header as well as files with the new file header
 * (using the magic number to determine the header format).
 *
 * Then supply the changes as a patch at
 *
 * http://sourceforge.net/projects/libpcap/
 *
 * so that future versions of libpcap and programs that use it (such as
 * tcpdump) will be able to read your new capture file format.
 */
struct pcap_file_header {
bpf_u_int32 magic;
u_short version_major;
u_short version_minor;
bpf_int32 thiszone; /* gmt to local correction */
bpf_u_int32 sigfigs; /* accuracy of timestamps */
bpf_u_int32 snaplen; /* max length saved portion of each pkt */
bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */
};

/*
 * Macros for the value returned by pcap_datalink_ext().
 *
 * If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro
 * gives the FCS length of packets in the capture.
 */
#define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000)
#define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28)
#define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000)

typedef enum {
       PCAP_D_INOUT = 0,
       PCAP_D_IN,
       PCAP_D_OUT
} pcap_direction_t;

/*
 * Generic per-packet information, as supplied by libpcap.
 *
 * The time stamp can and should be a "struct timeval", regardless of
 * whether your system supports 32-bit tv_sec in "struct timeval",
 * 64-bit tv_sec in "struct timeval", or both if it supports both 32-bit
 * and 64-bit applications.  The on-disk format of savefiles uses 32-bit
 * tv_sec (and tv_usec); this structure is irrelevant to that.  32-bit
 * and 64-bit versions of libpcap, even if they're on the same platform,
 * should supply the appropriate version of "struct timeval", even if
 * that's not what the underlying packet capture mechanism supplies.
 */
struct pcap_pkthdr {
struct timeval ts; /* time stamp */
bpf_u_int32 caplen; /* length of portion present */
bpf_u_int32 len; /* length this packet (off wire) */
};

/*
 * As returned by the pcap_stats()
 */
struct pcap_stat {
u_int ps_recv; /* number of packets received */
u_int ps_drop; /* number of packets dropped */
u_int ps_ifdrop; /* drops by interface XXX not yet supported */
#ifdef HAVE_REMOTE
u_int ps_capt; /* number of packets that are received by the application; please get rid off the Win32 ifdef */
u_int ps_sent; /* number of packets sent by the server on the network */
u_int ps_netdrop; /* number of packets lost on the network */
#endif /* HAVE_REMOTE */
};

#ifdef MSDOS
/*
 * As returned by the pcap_stats_ex()
 */
struct pcap_stat_ex {
       u_long  rx_packets;        /* total packets received       */
       u_long  tx_packets;        /* total packets transmitted    */
       u_long  rx_bytes;          /* total bytes received         */
       u_long  tx_bytes;          /* total bytes transmitted      */
       u_long  rx_errors;         /* bad packets received         */
       u_long  tx_errors;         /* packet transmit problems     */
       u_long  rx_dropped;        /* no space in Rx buffers       */
       u_long  tx_dropped;        /* no space available for Tx    */
       u_long  multicast;         /* multicast packets received   */
       u_long  collisions;

       /* detailed rx_errors: */
       u_long  rx_length_errors;
       u_long  rx_over_errors;    /* receiver ring buff overflow  */
       u_long  rx_crc_errors;     /* recv'd pkt with crc error    */
       u_long  rx_frame_errors;   /* recv'd frame alignment error */
       u_long  rx_fifo_errors;    /* recv'r fifo overrun          */
       u_long  rx_missed_errors;  /* recv'r missed packet         */

       /* detailed tx_errors */
       u_long  tx_aborted_errors;
       u_long  tx_carrier_errors;
       u_long  tx_fifo_errors;
       u_long  tx_heartbeat_errors;
       u_long  tx_window_errors;
     };
#endif

/*
 * Item in a list of interfaces.
 */
struct pcap_if {
struct pcap_if *next;
char *name; /* name to hand to "pcap_open_live()" */
char *description; /* textual description of interface, or NULL */
struct pcap_addr *addresses;
bpf_u_int32 flags; /* PCAP_IF_ interface flags */
};

#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */

/*
 * Representation of an interface address.
 */
struct pcap_addr {
struct pcap_addr *next;
struct sockaddr *addr; /* address */
struct sockaddr *netmask; /* netmask for that address */
struct sockaddr *broadaddr; /* broadcast address for that address */
struct sockaddr *dstaddr; /* P2P destination address for that address */
};

typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
     const u_char *);

/*
 * Error codes for the pcap API.
 * These will all be negative, so you can check for the success or
 * failure of a call that returns these codes by checking for a
 * negative value.
 */
#define PCAP_ERROR -1 /* generic error code */
#define PCAP_ERROR_BREAK -2 /* loop terminated by pcap_breakloop */
#define PCAP_ERROR_NOT_ACTIVATED -3 /* the capture needs to be activated */
#define PCAP_ERROR_ACTIVATED -4 /* the operation can't be performed on already activated captures */
#define PCAP_ERROR_NO_SUCH_DEVICE -5 /* no such device exists */
#define PCAP_ERROR_RFMON_NOTSUP -6 /* this device doesn't support rfmon (monitor) mode */
#define PCAP_ERROR_NOT_RFMON -7 /* operation supported only in monitor mode */
#define PCAP_ERROR_PERM_DENIED -8 /* no permission to open the device */
#define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */

/*
 * Warning codes for the pcap API.
 * These will all be positive and non-zero, so they won't look like
 * errors.
 */
#define PCAP_WARNING 1 /* generic warning code */
#define PCAP_WARNING_PROMISC_NOTSUP 2 /* this device doesn't support promiscuous mode */

char *pcap_lookupdev(char *);
int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);

pcap_t *pcap_create(const char *, char *);
int pcap_set_snaplen(pcap_t *, int);
int pcap_set_promisc(pcap_t *, int);
int pcap_can_set_rfmon(pcap_t *);
int pcap_set_rfmon(pcap_t *, int);
int pcap_set_timeout(pcap_t *, int);
int pcap_set_buffer_size(pcap_t *, int);
int pcap_activate(pcap_t *);

pcap_t *pcap_open_live(const char *, int, int, int, char *);
pcap_t *pcap_open_dead(int, int);
pcap_t *pcap_open_offline(const char *, char *);
#if defined(WIN32)
pcap_t  *pcap_hopen_offline(intptr_t, char *);
#if !defined(LIBPCAP_EXPORTS)
#define pcap_fopen_offline(f,b) \
pcap_hopen_offline(_get_osfhandle(_fileno(f)), b)
#else /*LIBPCAP_EXPORTS*/
static pcap_t *pcap_fopen_offline(FILE *, char *);
#endif
#else /*WIN32*/
pcap_t *pcap_fopen_offline(FILE *, char *);
#endif /*WIN32*/

void pcap_close(pcap_t *);
int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
const u_char*
pcap_next(pcap_t *, struct pcap_pkthdr *);
int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
void pcap_breakloop(pcap_t *);
int pcap_stats(pcap_t *, struct pcap_stat *);
int pcap_setfilter(pcap_t *, struct bpf_program *);
int pcap_setdirection(pcap_t *, pcap_direction_t);
int pcap_getnonblock(pcap_t *, char *);
int pcap_setnonblock(pcap_t *, int, char *);
int pcap_inject(pcap_t *, const void *, size_t);
int pcap_sendpacket(pcap_t *, const u_char *, int);
const char *pcap_statustostr(int);
const char *pcap_strerror(int);
char *pcap_geterr(pcap_t *);
void pcap_perror(pcap_t *, char *);
int pcap_compile(pcap_t *, struct bpf_program *, const char *, int,
    bpf_u_int32);
int pcap_compile_nopcap(int, int, struct bpf_program *,
    const char *, int, bpf_u_int32);
void pcap_freecode(struct bpf_program *);
int pcap_offline_filter(struct bpf_program *, const struct pcap_pkthdr *,
    const u_char *);
int pcap_datalink(pcap_t *);
int pcap_datalink_ext(pcap_t *);
int pcap_list_datalinks(pcap_t *, int **);
int pcap_set_datalink(pcap_t *, int);
void pcap_free_datalinks(int *);
int pcap_datalink_name_to_val(const char *);
const char *pcap_datalink_val_to_name(int);
const char *pcap_datalink_val_to_description(int);
int pcap_snapshot(pcap_t *);
int pcap_is_swapped(pcap_t *);
int pcap_major_version(pcap_t *);
int pcap_minor_version(pcap_t *);

/* XXX */
FILE *pcap_file(pcap_t *);
int pcap_fileno(pcap_t *);

pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp);
FILE *pcap_dump_file(pcap_dumper_t *);
long pcap_dump_ftell(pcap_dumper_t *);
int pcap_dump_flush(pcap_dumper_t *);
void pcap_dump_close(pcap_dumper_t *);
void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);

int pcap_findalldevs(pcap_if_t **, char *);
void pcap_freealldevs(pcap_if_t *);

const char *pcap_lib_version(void);

/* XXX this guy lives in the bpf tree */
u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
int bpf_validate(const struct bpf_insn *f, int len);
char *bpf_image(const struct bpf_insn *, int);
void bpf_dump(const struct bpf_program *, int);

#if defined(WIN32)

/*
 * Win32 definitions
 */

int pcap_setbuff(pcap_t *p, int dim);
int pcap_setmode(pcap_t *p, int mode);
int pcap_setmintocopy(pcap_t *p, int size);

#ifdef WPCAP
/* Include file with the wpcap-specific extensions */
#include <Win32-Extensions.h>
#endif /* WPCAP */

#define MODE_CAPT 0
#define MODE_STAT 1
#define MODE_MON 2

#elif defined(MSDOS)

/*
 * MS-DOS definitions
 */

int  pcap_stats_ex (pcap_t *, struct pcap_stat_ex *);
void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait);
u_long pcap_mac_packets (void);

#else /* UN*X */

/*
 * UN*X definitions
 */

int pcap_get_selectable_fd(pcap_t *);

#endif /* WIN32/MSDOS/UN*X */

#ifdef HAVE_REMOTE
/* Includes most of the public stuff that is needed for the remote capture */
#include <remote-ext.h>
#endif /* HAVE_REMOTE */

#ifdef __cplusplus
}
#endif

#endif


2018年2月3日 星期六

IPV6的管理员命令行配置代码

保存为×××.bat文件运行

@echo off
title 纪念1989—反对网络封锁!
echo
echo
cls

@echo  信息是自由的,就像空气,这是文明国家的基本原则。

chcp 936>nul
mode concols=80lines=330

echo install IPV6 &color 0a&


::WINDOWS版本定义区

set oss=Win XP3 & echo XP SP3: Microsoft Windows XP [Version 5.1.2600]

set oss=Win2003 sp2 & echo Win2003 SP2: Microsoft Windows [Version 5.2.3790]

set oss=Win2003 R2 SP2& echo Win2003 R2 SP2: Microsoft Windows [Version 5.2.3790]

set oss=win Vista SP2 & echo Vista SP2: Microsoft Windows [Version 6.0.6002]

set oss=win7 & echo Win7: Microsoft Windows [Version 6.1.7600]

set oss=win xp3 & echo XP SP3: Microsoft Windows XP [版本 5.1.2600]

:end



@echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
@echo ※                                                                          ※
@echo ※                     【 IPv6安装配置工具】                            ※
@echo ※                                                                          ※
@echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※

@echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
@echo ※                                                                          ※
@echo ※                                                                          ※
@echo ※   信息和知识是抵达真理的源泉!信息和知识的自由是孕育源泉的最佳母腹!     ※
@echo ※                                                                          ※
@echo ※                                                                          ※
@echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※






     
@echo off
echo Get Admin
::ver|findstr "[6,10]\.[0-9]\.[0-9][0-9]*" > nul && (goto Main)
::ver|findstr "[3-5]\.[0-9]\.[0-9][0-9]*" > nul && (goto isBelowNT6)

:: :isBelowNT6

:Main
@echo off
cd /d "%~dp0"
cacls.exe "%SystemDrive%\System Volume Information" >nul 2>nul
if %errorlevel%==0 goto Admin
if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"
echo Set RequestUAC = CreateObject^("Shell.Application"^)>"%temp%\getadmin.vbs"
echo RequestUAC.ShellExecute "%~s0","","","runas",1 >>"%temp%\getadmin.vbs"
echo WScript.Quit >>"%temp%\getadmin.vbs"
"%temp%\getadmin.vbs" /f
if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"
exit

:Admin
@echo off


@echo off




@echo 配置RpcEptMapper自动服务

sc config RpcEptMapper start=auto

sc start RpcEptMapper


@echo 配置DcomLaunch自动服务
sc config DcomLaunch start=auto

sc start DcomLaunch


@echo 配置RpcSs自动服务
sc config RpcSs start=auto

sc start RpcSs


@echo 配置nsi自动服务
sc config nsi start=auto

sc start nsi

sc config Wingmt start=auto

sc start Winmgmt


@echo 配置Dhcp 自动服务
sc config Dhcp start=auto

sc start Dhcp


@echo 配置WinHttpAutoProxySvc自动服务
sc config WinHttpAutoProxySvc start=auto

sc start WinHttpAutoProxySvc



@echo 配置并启动iphlpsvc 自动服务
sc config iphlpsvc start=auto

sc start iphlpsvc

@echo 配置ipv6 恢复服务
netsh int ipv6 reset


@echo 配置teredo 默认服务
netsh int teredo set state default


@echo 配置6to4默认服务

netsh int 6to4 set state default

@echo 配置isatap默认服务

netsh int isatap set state default

@echo 配置teredo.remlab.net默认服务

netsh int teredo set state server=teredo.remlab.net


@echo 配置 teredo为natawareclient类型

netsh int ipv6 set teredo natawareclient

@echo 配置 teredo 类型 状态

netsh int ter set state natawareclient

@echo 删除route端口

route DELETE ::/0

@echo 为ipv6增加route端口

netsh int ipv6 add route ::/0 "Teredo Tunneling Pseudo-Interface"

@echo 为ipv6的prefix 进行优先排序

netsh int ipv6 set prefix 2002::/16 30 1

netsh int ipv6 set prefix 2001::/32 5 1

@echo 修改注册表增加Dnscache缓存的 AddrConfigControl值

Reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Dnscache\Parameters /v AddrConfigControl /t REG_DWORD /d 0 /f


@echo 修改注册表增加Tcpip6的系统 DisabledComponents 值
Reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters /v DisabledComponents /t REG_DWORD /d 0 /f


@echo 在注册表中修改组策略增加v6Transition值以控制刷新时间——必须访问组策略实现
:: Set Group Policy

:: HKLM\Software\Policies\Microsoft\Windows\TCPIP\v6Transition -Name Teredo_DefaultQualified 

:: HKLM\Software\Policies\Microsoft\Windows\TCPIP\v6Transition -Name Teredo_State 





@echo 设定teredo状态


netsh int teredo set state default


@echo 设定6to4状态


netsh int 6to4 set state default

@echo 设定 isatap 状态

netsh int isatap set state default


@echo 设定teredo服务器为teredo.remlab.net


netsh int teredo set state server=teredo.remlab.net

@echo 在注册表中修改端口和刷新时间(这里是60秒/1分钟)


set state natawareclient teredo.remlab.net. 60 443


@echo 设定teredo服务器为natawareclient类型

netsh int ipv6 set teredo natawareclient

@echo 为teredo服务器的natawareclient类型设置natawareclient状态


netsh int ter set state natawareclient


@echo 为 ipv6设端口::/0链接到Teredo


netsh int ipv6 add route ::/0 "Teredo Tunneling Pseudo-Interface"

@echo 为ipv6 的prefix 排序

netsh int ipv6 set prefix 2002::/16 30 1

netsh int ipv6 set prefix 2001::/32 5 1



@echo 刷新 DNS 解析缓存。


ipconfig /flushdns


@echo 更换IP

netsh
interface ipv6
set privacy enabled

ping -t bt.neu6.edu.cn

@echo 每隔2分钟切换临时IP
netsh int ipv6 set privacy maxpreferredlifetime=120s maxrandomtime=1s store=active

@echo 激活IP更换
netsh int ipv6 set privacy maxpreferredlifetime=1d maxrandomtime=10m store=active


@echo 参考:

@echo https://en.wikipedia.org/wiki/IPv6_address




set time=%date:~0,4%-%date:~5,2%-%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2%

@call :output>ipv6time.txt 

exit



:output

@echo 显示配置

@echo off

netstat -a -n -y -s -q -x -b

ipconfig /all

netsh int ipv6 show teredo

netsh int ipv6 show route

netsh int ipv6 show int

netsh int ipv6 show prefix

netsh int ipv6 show address

route print

notepad >config.txt

2018年2月2日 星期五

IPV6访问的关键“服务”设定



这里是一个研究模式的多项选择的服务设定指导,并非单一选项的安装说明。





检查命令:

netstat -a -n -y -s -q -x -b

netsh int ipv6 show teredo state

netsh int ipv6 show teredo

netsh int ipv6 show route

netsh int ipv6 show int

netsh int ipv6 show prefix

netsh int ipv6 show address



IPV6访问的关键四个“服务”设定:
登陆——本地系统账户——确定

必须同时打开服务中的
RemoteAccess
Routing and Remote Access
设置为:自动启动



PNRP Machine Name Publication Service
(PNRPAutoReg)


Peer Name Resolution Protocol
(PNRPsvc)

Peer Networking Grouping
(p2psvc)

Peer Networking Identity Manager
(p2pimsvc)


LocalServicePeerNet
PNRPSvc
p2pimsvc
p2psvc
PnrpAutoReg



二,注册表修改:

它们的启动项位于注册表:svchost 必须修改值为:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost] "LocalServicePeerNet"=hex(7):50,00,4e,00,52,00,50,00,53,00,76,00,63,00,00,00, 70,00,32,00,70,00,69,00,6d,00,73,00,76,00,63,00,00,00,70,00,32,00,70,00,73, 00,76,00,63,00,00,00,50,00,6e,00,72,00,70,00,41,00,75,00,74,00,6f,00,52,00, 65,00,67,00,00,00,00,00

三,关联“服务”PNRP

要想启动此服务,必须开启PNRP对等网络服务:

默认情况下,PNRP 并不安装于 Windows XP 之上。要进行安装,请启动控制面板中的“添加/删除程序”小程序,选择“添加/删除 Windows 组件”,然后选择“网络服务”。接下来,单击“详细信息”按钮,然后选中“对等网络”复选框并选择“确定”/“下一步”。这些步骤会安装几个 P2P Windows 服务(PNRP 是其中的一个),但不会将其配置为自动启动。要启动 PNRP,请转到“服务控制管理器”并启动“对等网络”服务。这也会启动 PNRP 服务。
P2P 应用程序可以注册许多具有 PNRP 服务的节点,PNRP 网格中的每个节点均由一个 P2P 名称和一个 PRNP ID 组成。一般说来,“P2P 名称”表示一个网格名称(如 PeerChannel 应用程序中的网格名)并由 P2P 应用程序指定,而 PNRP ID 则是由 PNRP 基础结构分配给注册节点的。PNRP 网格旨在用于定向消息传送,并使用 PNRP ID 来构建网格。



虽然 PNM 包含一个可执行程序,但是若要利用其功能,需要另外一个应用程序。下面的方案说明了 PictureViewer 如何使用 PNM 来提供协作功能:



  1. Tom 在其运行 Windows Vista 的新笔记本式计算机上安装 PictureViewer。安装者使用 PNM 注册 PictureViewer。
  2. Tom 携带着笔记本式计算机来到一家咖啡店,然后登录至 PNM。在他登录时,p2phost.exe 开始在 PNM 网格中查找其他节点。
  3. Harry 也安装了 PictureViewer,并且也携带着他的笔记本式计算机来到这家咖啡店。在 Harry 登录至 PNM 时,他的 p2phost.exe 实例开始在 PNM 网格中查找其他节点。
  4. Harry 和 Tom 是高中同学,彼此已经多年没有见过面。他们在屋内认出了对方,并开始交谈。Harry 试图向 Tom 展示其家人的照片。
  5. 当正在搜索照片时,Harry 意识到他还没有将其家人最新拍摄的照片从相机上下载下来,因此他希望以后再给 Tom 看这些照片。
  6. Tom 决定请 Harry 看一看他的家人的一些照片,于是启动了 PictureViewer。由于 PictureViewer 是与 PNM 相集成的,因此他邀请 Harry 通过 PictureViewer 来欣赏其家人的照片。
  7. Tom 向 Harry 发出邀请之后,Harry 在任务栏上收到了一个 Tom 邀请他启动 PictureViewer 的通知。
  8. Harry 接受了邀请,随后 PNM 启动 PictureViewer。PictureViewer 启动完毕之后,Tom 家人的照片便显示在 Harry 的 PictureViewer 实例之上。
  9. Harry 答应以后通过 PictureViewer 向 Tom 展示其家人的照片。为此,Harry 通过选择 PictureViewer 中的菜单项,将 Tom 加入到他的联系人列表中。而 Tom 也以同样的方式将 Harry 加入到自己的联系人列表中。
  10. 后来有一天,Harry 和 Tom 去不同的城市出差。Harry 登录到 PNM 并打开 PictureViewer。他立即发现 Tom 也已登录到 PNM。
  11. 因为 Harry 已经下载了他家人最近拍摄的照片,因此邀请 Tom 通过 PictureViewer 来欣赏这些照片。
  12. Tom 收到并接受了 Harry 的邀请。在 Tom 接受邀请之后,PNM 即开始启动 PictureViewer 应用程序。PictureViewer 启动完毕之后,Tom 便看到了期待已久的 Harry 家人的照片。
  13. 尽管 PictureViewer 可能不是共享照片的最有效方式,但是这个故事充分地说明了 PNM 的情况。在这些步骤的每一个步骤中,PictureViewer 都利用了 PNM API 的不同部分。


四,6to4

设置6to4 中继名称解析间隔

IPV6的几种客户端类型:

client: 启用 Teredo 客户端。 
enterpriseclient: 跳过受管理的网络检测。 
natawareclient: 启用 Teredo 客户端并标识 NAT 类型。 
server: 启用 Teredo 服务器。 
default: 默认状态为 client。

                        
(1)
set state type=natawareclient 

nat aware client =natawareclient 
enterprise client=enterprise client

命令行工具(依次敲入的cmd命令。可以复制为.BAT):

IPV6服务类型:
--------------------------------------
netsh 
interface 
teredo
set state type=natawareclient
----------------------------------------------
/OR/
set state type=enterpriseclient
/OR/
set state type=server
----------------------------------------------

IPV6服务类型通讯端口设置:

netsh 
interface 
teredo
set state clientport=443
----------------------------------------------
/OR/
其它端口
----------------------------------------------


DOS配置微软IPV6命令:teredo+6to4



netsh 
interface 
teredo
set state natawareclient win10.ipv6.microsoft.com. 60 443
..
6to4
set relay 6to4.ipv6.microsoft.com enabled
set routing routing=enabled sitelocals=enabled
set state state=enabled undoonstop=disabled



----------------------------------------------
类型和端口同时设置命令:
netsh 
interface 
teredo
set state clientport=443
set state type=natawareclient 


servername=terdoServerName (win10.ipv6.microsoft.com etc.....







用法: set state [[type]=disabled|client|enterpriseclient|natawareclient|server|default]
             [[servername=]<hostname>|<IPv4 address>|default]
             [[refreshinterval=]<integer>|default]
             [[clientport=]<integer>|default]
             [[servervirtualip=]<IPv4 address>|default]

参数:

       标记                值
       type              - 为以下值之一:
                           disabled: 禁用 Teredo 服务。
                           client: 启用 Teredo 客户端。
                           enterpriseclient: 跳过受管理的网络检测。
                           natawareclient: 启用 Teredo 客户端并标识 NAT 类型。
                           server: 启用 Teredo 服务器。
                           default: 默认状态为 client。
       servername        - Teredo 服务器的名称或 IPv4 地址。
       refreshinterval   - 客户端刷新间隔(以秒计)。
       clientport        - 客户端 UDP 端口(或者由系统选择)。
       servervirtualip   - 服务器虚拟 IP 的 IPv4 地址。
                           如果以 teredo 客户端的身份运行则不适用。

备注: 设置 Teredo 状态。
      参数的值 "default" 可将其设置为系统默认值。
      "type=server" 选项仅适用于服务器 SKU。

示例:

       set state disable
       set state client teredo.ipv6.microsoft.com. 60 34567




CMD命令:

netsh 
int 
teredo 
set state default
..
6to4 set state default
..
int

isatap 
set state default
..
ipv6 
set teredo natawareclient
..
int ter 
set state natawareclient win10.ipv6.microsoft.com. 60 443
..
int 
6to4 set state enable 
set relay 6to4.ipv6.microsoft.com enabled

或者 netsh int 6to4 set state automatic





五,工具:

微软提供

IP Translation Configuration Service - Windows 10 Service

http://batcmd.com/windows/10/services/ipxlatcfgsvc/


如何在Windows中启用或者禁用IPv6或其组件

https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows

六,安全问题
--------------------------------------------------------------------------------------
IPV6加强安全服务的注册表值:
https://msdn.microsoft.com/en-us/library/ff648853.aspx

IPv4和IPv6可配置注册表设置
https://msdn.microsoft.com/en-us/library/dn167252.aspx
--------------------------------------------------------------------------------------

七,关于IP转发的注册表修改:

Windows中IP路由转发功能缺省是关闭的。 

关闭的话

1) 打开注册表编辑器。 

2) 在注册表编辑器中,定位以下注册表项: 

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/ Services/Tcpip 

/Parameters 

选择下面的项目: 

IPEnableRouter:REG_DWORD:0xff 

正确的值应为0xff。 

3) 要对该计算机安装和使用的所有网络连接都启用 IP 转发,请指定值为 1。 

   要对该计算机安装和使用的所有网络连接都关闭 IP 转发,请指定值为 0。 

 



注:必须以管理员或管理组成员的身份登录才能完成该过程。 默认情况下,将禁用 IP 转发。 

根据:https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows


八,优先IPV6前缀问题
netsh int ipv6 sho prefix
访问:
https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows

--------------------------------------------------------------------------------------

隧道适配器 isatap.{3880EF05-203A-4D72-91B4-83DB18E30893}:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Microsoft ISATAP Adapter
   物理地址. . . . . . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是
   本地链接 IPv6 地址. . . . . . . . : fe80::5efe:192.168.1.103%23(首选)
   默认网关. . . . . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 385875968
   DHCPv6 客户端 DUID  . . . . . . . : 00-01-00-01-21-FD-7F-87-50-E5-49-AB-F0-A6
   DNS 服务器  . . . . . . . . . . . : 2001:4860:4860::8888
                                       2001:4860:4860::8844
                                       8.8.8.8
                                       8.8.4.4
  隧道适配器 isatap. TCPIP 上的 NetBIOS  . . . . . . . : 已禁用



IPV6的IPV4地址服务器PING通

C:\WINDOWS\system32>ping 171.**.***.**

正在 Ping 171.***.***.** 具有 32 字节的数据:
来自171.***.***.**的回复: 字节=32 时间=1ms TTL=64
来自171.***.***.** 的回复: 字节=32 时间<1ms TTL=64
来自171.***.***.**的回复: 字节=32 时间<1ms TTL=64
来自171.***.***.** 的回复: 字节=32 时间=1ms TTL=64

171.125.***.**的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 0ms,最长 = 1ms,平均 = 0ms


C:\WINDOWS\system32>


九,IP help IPV6地址转换服务宕机问题


第一步先了解你的windows版本和型号:

把下列代码存为BAT文件运行,看到版本显示即可进行下一步。

title APP AUTO TOOL
@echo off
cls
color 0a


chcp 65001 > nul
set PYTHONIOENCODING=utf-8
set font=Lucida Console
set LINE=Some localized OEM text
set FILE=test.txt

@chcp 65001 > nul
@set PYTHONIOENCODING=utf-8
set LINE=Some localized OEM text
set FILE=test.txt
CHCP 65001|>>%FILE% Echo %LINE%&CHCP 936
(for /f "delims=" %%a in  ('type utf8.txt') do echo.%%a
)>oem.txt


第二步:

IP Translation Configuration Service 

请访问微软官方下载解决方案软件:https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows


win10解决方案——配置  IpxlatCfgSvc

@echo off
sc config IpxlatCfgSvc start= Auto
sc config IpxlatCfgSvc start= Auto
exit

Start C:\Windows\System32\svchost.exe sc config IpxlatCfgSvc start= Auto
svchost.exe sc config IpxlatCfgSvc start= Auto
sc config IpxlatCfgSvc start= Auto


sc ("service control") will do that; 
note the space between "start=" and the option
Automatic start:
sc config <ServiceName> start= auto
Manual start:
sc config <ServiceName> start= demand
Disabled:
sc config <ServiceName> start= disabled




配置  IpxlatCfgSvc

C:\WINDOWS\system32>svchost.exe sc config IpxlatCfgSvc start= Auto

--------------------------------------------------------------------------
C:\WINDOWS\system32>



一种配置:跳过受管理的网络检测

sc config IpxlatCfgSvc start= Auto  
netsh interface teredo set state enterpriseclient server=default

另一种配置:启用 Teredo 客户端并标识 NAT 类型。

sc config IpxlatCfgSvc start= Auto  

netsh interface teredo set state natawareclient server=default



enterpriseclient: 跳过受管理的网络检测。 

natawareclient: 启用 Teredo 客户端并标识 NAT 类型。

--------------------------------------------------------------------------
类型                    : natawareclient /OR/ enterpriseclient
服务器名称              : ×××.×××.×××.com. (Group Policy)
客户端刷新间隔          : 30 秒  (Group Policy)
客户端端口                : ×××× (Group Policy)
状态                    : qualified
客户端类型              : teredo client
网络                    : managed
NAT                     : restricted (port)
NAT 特殊行为   : UPNP: 否,PortPreserving: 是
本地映射           : 192.168.1.103:443

外部 NAT 映射    : ×××.×××.×××.×××:443


--------------------------------------------------------------------------


描述:
        在注册表和服务数据库中修改服务项。
用法:
        sc <server> config [服务名称] <option1> <option2>...

选项:
注意: 选项名称包括等号。
      等号和值之间需要一个空格。
      要删除依赖关系,请使用单个“/”表示依赖关系值。
 type= <own|share|interact|kernel|filesys|rec|adapt|userown|usershare>
 start= <boot|system|auto|demand|disabled|delayed-auto>
 error= <normal|severe|critical|ignore>
 binPath= <.exe 文件的 BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <依赖关系(以 / (正斜杠)分隔)>
 obj= <AccountName|ObjectName>
 DisplayName= <显示名称>
 password= <密码>


C:\WINDOWS\system32>

--------------------------------------------------------------------------

c:\windows\system32\iphlpsvc.dll
%SystemRoot%\System32\iphlpsvc.dll"
HKLM\System\CurrentControlSet\Services\IpxlatCfgSvc",
IP Translation Configuration Service
Configures and enables translation from v4 to v6 and vice c:\windows\system32\ipxlatcfg.dll
%SystemRoot%\System32\IpxlatCfg.dll

HKLM\System\CurrentControlSet\Services",

--------------------------------------------------------------------------



(R=Running, S=Stopped, 0=Boot, 1=System, 2=Auto, 3=Demand, 4=Disabled


十:更换IP


netsh
interface ipv6
set privacy enabled

ping -t bt.neu6.edu.cn

每隔2分钟切换临时IP
netsh int ipv6 set privacy maxpreferredlifetime=120s maxrandomtime=1s store=active

激活IP更换
netsh int ipv6 set privacy maxpreferredlifetime=1d maxrandomtime=10m store=active


参考:
https://en.wikipedia.org/wiki/IPv6_address








十一,一些误读和存疑的再解读:以微软官方公布技术答案为准。


这里很正规
https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows


mportant Internet Protocol version 6 (IPv6) is a mandatory part of Windows Vista and later versions of Windows. We do not recommend that you disable IPv6 or its components. If you do, some Windows components may not function. Additionally, system startup will be delayed for 5 seconds if IPv6 is disabled by incorrectly, setting the DisabledComponents registry setting to a value of 0xfffffff. The correct value should be 0xff. 


上面的0xff值与下面的说法保持矛盾。以微软官方的公布为主。因而忽略以下说法。

How to back up and restore the registry in Windows

1. Click Start , type regedit in Start Search Bar and hit Enter.

Note: If you are prompted for an administrator password or confirmation, type your password or click Continue.

2. Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters

3. Check whether DisabledComponents registry key exists. If yes, let's proceed to the next step.

4. Double click the DisabledComponents registry key and modify the value to 0 .

If the DisabledComponents entry is unavailable, you must create it. To do this, follow these steps:

   1. In the Edit menu, point to New , and then click DWORD (32-bit) Value .
   2. Type DisabledComponents , and then press ENTER.
   3. Double-click DisabledComponents .

Type 0 to enable all IPv6 components.

5. Exit Registry Editor, and then restart the computer.