亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? proxyarplib.c

?? vxwork源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
     */    pArp = mtod (pMbuf, struct ether_arp *);    arpOp = ntohs (pArp->arp_op);    bcopy (pArp->arp_spa, (char *)&srcAddr, sizeof (srcAddr));    bcopy (pArp->arp_tpa, (char *)&dstAddr, sizeof (dstAddr));    if (arpDebug)				/* ARP debugging info */	{    	logMsg ("op:%s (if 0x%x) src: 0x%x [%s] dst: 0x%x ",		(arpOp == ARPOP_REQUEST) ? (int) "request" : (int) "reply",		ntohl (pArpcom->ac_ipaddr.s_addr), ntohl (srcAddr.s_addr),		(int) ether_sprintf (pArp->arp_sha), ntohl (dstAddr.s_addr), 0);	if (arpOp != ARPOP_REQUEST)	    logMsg ("[%s]", (int) ether_sprintf (pArp->arp_tha), 0, 0, 0, 0 ,0);	logMsg ("\n", 0, 0, 0, 0, 0, 0);	}    /* Ignore any messages containing a broadcast address as the source. */    if (!(bcmp (pArp->arp_sha, etherbroadcastaddr, sizeof (pArp->arp_sha))))        {        m_freem (pMbuf);        return (TRUE);    /* Invalid message - skip standard ARP processing. */        }    semTake (proxySemId, WAIT_FOREVER);    switch (arpOp)	{	case ARPOP_REQUEST:            /*             * Handle any ARP requests which must cross a network boundary             * that the proxy server hides. The standard ARP processing             * cannot manage those situations. It will handle all requests             * from a main network since proxy ARP entries exist for all             * hosts on the proxy network.             */            if ((pNet = proxyNetFind (&pArpcom->ac_ipaddr)) != NULL)                {                /*                 * Received an ARP request from a proxy network.                  * Add new client if enabled by arpRegister setting.                 */                if (arpRegister && !proxyIsAClient (&srcAddr))                    (void) proxyClientAdd (pArpcom, &srcAddr, pArp->arp_sha);                pClient = proxyClientFind (&dstAddr);                if (pClient)                    {                    /*                     * The destination of the request is also a proxy client.                     * If it is on the same proxy network, ignore the request                     * since the client will reply for itself. If it is on                     * a different proxy network, the standard ARP processing                     * will reply correctly based on the proxy ARP entry.                     */                    if (pClient->pNet->proxyAddr.s_addr                            == pArpcom->ac_ipaddr.s_addr)                        {                        /* Client will answer - avoid proxy reply. */                        semGive (proxySemId);                        m_freem (pMbuf);                        return (TRUE);                        }                    }                else                    {                    /*                     * The destination is not a proxy client. These ARP                     * requests from a proxy client for a different host on                     * the main network cannot be handled by the standard                     * ARP processing. If the destination's hardware address                     * is available, send a reply giving ours as an alias.                     * Otherwise, forward the request to the main network.                     */                    if (arpCmd (SIOCGARP, &dstAddr, (u_char *)NULL,                                (int *) NULL) == OK ||				pNet->proxyAddr.s_addr == dstAddr.s_addr ||				pNet->mainAddr.s_addr == dstAddr.s_addr)                        proxyArpReply (pArpcom, pMbuf,                                       ntohs (pArp->arp_pro));                    else                        proxyArpRequestFwd (&srcAddr, pMbuf);                    semGive (proxySemId);                    m_freem (pMbuf);                    return (TRUE);    /* Skip standard ARP processing. */                    }                }            break;	case ARPOP_REPLY:    	    /*     	     * Received an ARP reply.  If it is a response to an earlier             * (forwarded) request, generate a reply to the proxy client             * supplying our hardware address as an alias. Once the              * hardware address of the actual destination is in the             * ARP cache, the proxy server will be able to transparently             * forward packets from the proxy network to that host.      	     */            pClient = proxyClientFind (&dstAddr);            if (pClient && (pClient->pNet->mainAddr.s_addr ==                                pArpcom->ac_ipaddr.s_addr))                {                /*                 * Note: the second condition of the previous test is a                 * sanity check preventing the forwarding of replies                 * between proxy networks, although those messages should                 * never be sent since requests are not forwarded between                 * proxy networks in the first place.                 */                proxyArpReplyFwd (pClient, pMbuf);                /*                 * The standard ARP processing would only refresh an existing                 * entry, not create a new one, so add the entry for the                 * actual destination of the original ARP request.                 */                arpCmd (SIOCSARP, &srcAddr, pArp->arp_sha, (int *) NULL);                semGive (proxySemId);                m_freem (pMbuf);                return (TRUE); 	/* Skip (redundant) standard ARP processing. */                }            break;	default:	    break;	}    semGive (proxySemId);    return (FALSE); 	/* Standard ARP processing handles remaining cases. */    }/********************************************************************************* proxyArpReply - generate an ARP reply** This routine responds to ARP request messages which would ordinarily* require forwarding across a network boundary hidden by the proxy server.* The server advertises the hardware address of its local interface instead* of the actual hardware address of the destination host. It will forward* the incoming data to the correct destination on the separate network.** This routine usually handles ARP requests from the proxy network for a host* on the main network. The standard ARP processing is capable of responding* to requests from the main network since registering the proxy clients* creates the necessary proxy ARP entries, but hosts on a main network are* not registered.** The <pArpcom> parameter identifies the interface which received the* ARP message contained in the <pMbuf> mbuf chain. The <proto> parameter* identifies the type of the protocol information for the new ARP message.* Currently, it is always ETHERTYPE_IP (0x800). ** RETURNS: N/A** NOMANUAL*/LOCAL void proxyArpReply    (    FAST struct arpcom *		pArpcom,	/* arpcom structure   */    FAST struct mbuf *			pMbuf,		/* mbuf chain 	      */    int 			 	proto		/* format of protocol */    )    {    struct ether_arp *			pArp;		/* ARP message	      */    struct in_addr			srcAddr;	/* source address     */    pArp = mtod (pMbuf, struct ether_arp *);    /*     * Add the original source to the ARP cache so that the server can     * transparently forward data from the proxy client to that host.     * Ignore failures caused if an entry already exists.     */    bcopy (pArp->arp_spa, (char *)&srcAddr, sizeof (srcAddr));    arpCmd (SIOCSARP, &srcAddr, (u_char *)pArp->arp_sha,  (int *)NULL);    /*  switch source and target addresses */    proxyArpSend ( (struct ifnet *) pArpcom, ARPOP_REPLY, proto,                  pArp->arp_tpa, pArp->arp_sha, pArp->arp_spa);    }/********************************************************************************* proxyArpRequestFwd - forward an ARP request** This routine relays an ARP request message from a proxy network to a* main network when a proxy client attempts to contact a host across the* network boundary which the proxy server conceals. The server supplies* the hardware address of the local interface to the host on the main* network so that all traffic will be transparently forwarded to the* proxy client. The <pMbuf> parameter contains the original ARP request* sent by the proxy client using the <pClientAddr> address.** RETURNS:  N/A** NOMANUAL*/LOCAL void proxyArpRequestFwd    (    struct in_addr *		pClientAddr,		/* proxy client addr */    struct mbuf * 		pMbuf			/* mbuf chain	     */    )    {    PROXY_CLNT *		pClient;		/* proxy client	     */    struct ether_arp *		pArp;			/* ARP message 	     */    struct sockaddr_in		sin;			/* interface sin     */    struct ifaddr *		pIfa;			/* interface address */    /* find the client's main network interface */    if ((pClient = proxyClientFind (pClientAddr)) == NULL)	return;    SIN_FILL (&sin, AF_INET, pClient->pNet->mainAddr.s_addr, 0);    if ((pIfa = ifa_ifwithaddr ((struct sockaddr *) &sin)) == NULL)	return;    if (proxyArpVerbose)			/* print debugging info */	logMsg ("(forwarding request to if 0x%x) ", ntohl (pClient->pNet->mainAddr.s_addr),		0, 0, 0, 0, 0);    /*     * Leave the client as the source protocol address so when the reply     * comes back we know where to forward the reply.     */    pArp = mtod (pMbuf, struct ether_arp *);    proxyArpSend (pIfa->ifa_ifp, ntohs (pArp->arp_op), ntohs (pArp->arp_pro),		  pArp->arp_spa, pArp->arp_tha, pArp->arp_tpa);    }/********************************************************************************* proxyArpReplyFwd - forward an ARP reply** This routine relays an ARP reply message from a main network to a* proxy network following an earlier transfer in the opposite direction.* The server supplies the hardware address of the local interface instead* of the actual destination host on the main network so that all traffic* from the proxy client will be transparently forwarded. The <pMbuf>* mbuf chain contains the original ARP reply intended for the  proxy client* indicated by the <pClient> parameter.** RETURNS: N/A** NOMANUAL*/LOCAL void proxyArpReplyFwd    (    PROXY_CLNT * 	pClient,    /* proxy client registration data */    struct mbuf * 	pMbuf       /* original ARP message */    )    {    struct sockaddr_in		sin;			/* interface sin     */    struct ifaddr *		pIfa;			/* interface address */    struct ether_arp *		pArp;			/* ARP message 	     */    u_short 			arpProto;		/* ARP type	     */    /* Find the interface connected to the proxy client. */    SIN_FILL (&sin, AF_INET, pClient->pNet->proxyAddr.s_addr, 0);    if ((pIfa = ifa_ifwithaddr ((struct sockaddr *) &sin)) == NULL)	return;    if (proxyArpVerbose)			/* print debugging info */	logMsg ("(forwarding reply to if 0x%x)", ntohl (pClient->pNet->proxyAddr.s_addr),		0, 0, 0, 0, 0);    pArp = mtod (pMbuf, struct ether_arp *);    /*     * Replace (deprecated) trailer packets with the standard type value. It     * is theoretically possible to consume those messages since trailer     * responses are additional replies, but forward them anyway for safety.     */    if (ntohs (pArp->arp_pro) == ETHERTYPE_TRAIL)        arpProto = ETHERTYPE_IP;    else        arpProto = ntohs (pArp->arp_pro);    /*     * The client's registration data contains a snapshot of the hardware     * address at that time. Since all clients must register, the lack of     * dynamic updates (available with an ARP entry) is unimportant.     */    proxyArpSend (pIfa->ifa_ifp, ntohs (pArp->arp_op), arpProto,                  pArp->arp_spa, pClient->hwaddr, pArp->arp_tpa);    }/********************************************************************************* proxyArpSend - generate and send an ARP message** This routine constructs and sends an ARP message over the network interface* specified by <pIf>.  <op> specifies the ARP operation, <proto> is the format* of protocol address.  <srcProtoAddr> is the source protocol address,* <dstHwAddr> is the destination hardware address and <dstProtoAddr> is the* destination protocol addresses.** RETURNS: N/A** NOMANUAL*/LOCAL void proxyArpSend    (    struct ifnet *		pIf,		/* interface pointer 	*/    int				op,		/* ARP op		*/    int				proto,		/* ARP protocol		*/    u_char *			srcProtoAddr,	/* src ip address	*/    u_char *			dstHwAddr,	/* dest hw address	*/    u_char *			dstProtoAddr	/* dest ip address	*/    )    {    FAST struct mbuf *		pMbuf;		/* mbuf chain		*/    FAST struct ether_arp *	pArp;		/* ARP message		*/    struct ether_header *	pEh;		/* ether header		*/    struct sockaddr 		sa;		/* sockaddr structure	*/    if ((pMbuf = mHdrClGet(M_DONTWAIT, MT_DATA, sizeof(*pArp), TRUE)) == NULL)	return;    pMbuf->m_len = sizeof(*pArp);    pMbuf->m_pkthdr.len = sizeof(*pArp);    MH_ALIGN(pMbuf, sizeof(*pArp));    pArp = mtod(pMbuf, struct ether_arp *);	/* fill in ARP message */    bzero ((caddr_t) pArp, sizeof (struct ether_arp));    pArp->arp_hrd = htons (ARPHRD_ETHER);    pArp->arp_pro = htons (proto);    pArp->arp_hln = sizeof (pArp->arp_sha);    pArp->arp_pln = sizeof (pArp->arp_spa);    pArp->arp_op  = htons (op);    bcopy ((caddr_t) ((struct arpcom *) pIf)->ac_enaddr,	   (caddr_t) pArp->arp_sha, sizeof (pArp->arp_sha));    bcopy ((caddr_t) srcProtoAddr, (caddr_t) pArp->arp_spa,	   sizeof (pArp->arp_spa));    bcopy ((caddr_t) dstProtoAddr, (caddr_t) pArp->arp_tpa,	   sizeof (pArp->arp_tpa));    bzero ((caddr_t) &sa, sizeof (sa));    sa.sa_family = AF_UNSPEC;    pEh = (struct ether_header *) sa.sa_data;    pEh->ether_type = ETHERTYPE_ARP;		/* switched in ether_output */    if (op == ARPOP_REQUEST)	{    	bcopy ((caddr_t) etherbroadcastaddr, (caddr_t) pEh->ether_dhost,	       sizeof (pEh->ether_dhost));	}    else	{    	bcopy ((caddr_t) dstHwAddr, (caddr_t) pArp->arp_tha,	       sizeof (pArp->arp_tha));    	bcopy ((caddr_t) dstHwAddr, (caddr_t) pEh->ether_dhost,	       sizeof (pEh->ether_dhost));	}    if (proxyArpVerbose)	{    	logMsg ("%s (%x): src: 0x%x [%s] dst : 0x%x ", (op == ARPOP_REQUEST) ?		(int) "request" : (int) "reply", proto,		*((int *) pArp->arp_spa), (int) ether_sprintf (pArp->arp_sha),		*((int *) pArp->arp_tpa), 0);	if (op != ARPOP_REQUEST)	    logMsg ("[%s]", (int) ether_sprintf (pArp->arp_tha), 0, 0, 0, 0, 0);	logMsg ("\n", 0, 0, 0, 0, 0, 0);	}    (*pIf->if_output) (pIf, pMbuf, &sa, (struct rtentry *) NULL);    }/********************************************************************************* proxyNetCreate - create a proxy ARP network** This routine activates proxy services between the proxy network connected* to the interface with the <proxyAddr> IP address and the main network* connected to the interface with the <mainAddr> address. Once registration* is complete, the proxy server will disguise the physically separated* networks as a single logical network. ** The corresponding interfaces must be attached and configured with IP* addresses before calling this routine. If the proxy network shares the* same logical subnet number as the main network, the corresponding interface* to the proxy network must use a value of 255.255.255.255 for the netmask.** RETURNS: OK, or ERROR if unsuccessful.** ERRNO:*  S_proxyArpLib_INVALID_ADDRESS*/STATUS proxyNetCreate    (    char * 	proxyAddr,	/* address of proxy network interface */    char * 	mainAddr	/* address of main network interface */    )    {    struct sockaddr_in 	proxyAddrKey;    struct sockaddr_in 	mainAddrKey;    PROXY_NET * 	pNet;    struct ifaddr * 	pIfa;    int 		flags;    /*     * Verify that local interfaces can reach the addresses of the     * proxy and main networks.     */    SIN_FILL (&proxyAddrKey, AF_INET, inet_addr (proxyAddr), 0);    SIN_FILL (&mainAddrKey, AF_INET, inet_addr (mainAddr), 0);    if ( (ifa_ifwithaddr ( (struct sockaddr *)&mainAddrKey) == NULL) ||        ( (pIfa = ifa_ifwithaddr ( (struct sockaddr *)&proxyAddrKey)) == NULL))        {        errno = S_proxyArpLib_INVALID_ADDRESS;        return (ERROR);        }    if ((pNet = (PROXY_NET *) calloc (1, sizeof (PROXY_NET))) == NULL)	return (ERROR);    semTake (proxySemId, WAIT_FOREVER);    /* Replace any existing proxy network entry with the new values. */    proxyNetDelete (proxyAddr);    pNet->proxyAddr    =  proxyAddrKey.sin_addr;    pNet->mainAddr     =  mainAddrKey.sin_addr;    lstInit (&pNet->clientList);    lstAdd (&proxyNetList, &pNet->netNode);    /*     * Add a proxy ARP entry allowing the standard ARP processing     * to reply to requests for this local interface from hosts on     * other networks. The ATF_PROXY flag indicates a "wildcard" hardware     * address. Ignore failures caused if an entry already exists.     */    flags = ATF_PUBL | ATF_PROXY | ATF_PERM;    arpCmd (SIOCSARP, &pNet->proxyAddr, NULL, &flags);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产福利精品导航| 日韩精品中文字幕一区 | 偷拍日韩校园综合在线| 国产在线国偷精品产拍免费yy | 国产精品国产馆在线真实露脸| 一区二区三区小说| 国产中文字幕精品| 欧美一区二视频| 亚洲综合自拍偷拍| av爱爱亚洲一区| 久久综合成人精品亚洲另类欧美| 亚洲第一主播视频| 一本大道久久a久久精二百| 精品国产乱码久久久久久蜜臀 | 欧洲激情一区二区| 久久精品亚洲一区二区三区浴池| 午夜精品久久久久久久99樱桃| 91日韩精品一区| 久久久精品国产免大香伊| 日韩国产精品91| 欧美日韩另类一区| 亚洲激情第一区| 94-欧美-setu| 亚洲婷婷综合久久一本伊一区| 国产乱码精品一品二品| 欧美大胆一级视频| 久久机这里只有精品| 在线91免费看| 日本视频免费一区| 在线电影欧美成精品| 视频在线观看一区| 欧美一级日韩不卡播放免费| 亚洲成人一区二区在线观看| 欧美在线观看一二区| 亚洲成av人片在线观看| 精品视频免费看| 天堂va蜜桃一区二区三区| 欧美视频一二三区| 亚洲成人三级小说| 51午夜精品国产| 免费观看一级特黄欧美大片| 337p亚洲精品色噜噜狠狠| 欧美aaa在线| 精品噜噜噜噜久久久久久久久试看| 日本sm残虐另类| 51精品秘密在线观看| 激情久久五月天| 久久午夜电影网| 国产传媒日韩欧美成人| 国产精品久久三区| 色网综合在线观看| 亚洲国产你懂的| 制服丝袜中文字幕一区| 久久国产夜色精品鲁鲁99| 久久亚洲欧美国产精品乐播| 成人涩涩免费视频| 亚洲自拍偷拍九九九| 欧美一二区视频| 国内久久精品视频| 国产精品国产三级国产专播品爱网 | 日韩精品一区二区三区蜜臀| 久久99日本精品| 国产精品无圣光一区二区| 色婷婷av一区二区三区大白胸| 一区二区三区在线视频观看| 91精品国产综合久久久久久| 国产伦理精品不卡| 亚洲男人的天堂网| 欧美成人一区二区三区在线观看| 国内精品写真在线观看| 亚洲日韩欧美一区二区在线| 欧美男人的天堂一二区| 久久精品国产在热久久| 亚洲精品欧美综合四区| 日韩精品一区二区三区在线播放| 成人激情开心网| 手机精品视频在线观看| 国产精品电影一区二区| 欧美精品久久99| caoporm超碰国产精品| 日韩国产欧美一区二区三区| 国产精品萝li| 欧美成人一区二区三区在线观看| 色综合欧美在线视频区| 狠狠狠色丁香婷婷综合久久五月| 亚洲伦在线观看| 久久久久88色偷偷免费| 欧美人狂配大交3d怪物一区| 成人av免费在线| 久久99精品国产麻豆婷婷| 亚洲视频电影在线| 久久久国产精品不卡| 欧美日韩高清在线| 成人国产免费视频| 精品一区中文字幕| 视频一区中文字幕国产| 亚洲日本丝袜连裤袜办公室| 久久久久久久久久看片| 欧美一区二区三区播放老司机| av色综合久久天堂av综合| 激情小说欧美图片| 日韩黄色在线观看| 亚洲无线码一区二区三区| 亚洲欧美一区二区三区极速播放| 久久久久久久久97黄色工厂| 欧美电影免费观看高清完整版在 | 国产视频911| 日韩免费高清视频| 欧美高清精品3d| 欧美日韩国产一二三| 99re66热这里只有精品3直播| 国产一区二区三区不卡在线观看 | 精品成人佐山爱一区二区| 欧美久久免费观看| 欧美日韩激情一区二区三区| 91久久国产综合久久| 91视视频在线观看入口直接观看www | 亚洲午夜影视影院在线观看| 一区二区久久久久| 依依成人精品视频| 亚洲综合一区二区| 亚洲国产精品自拍| 偷拍日韩校园综合在线| 免费高清在线一区| 久久69国产一区二区蜜臀| 久久成人av少妇免费| 精品一区二区三区av| 国产乱码精品一区二区三区忘忧草| 国产一区二区视频在线| 成人永久看片免费视频天堂| 成人免费高清在线观看| 91在线小视频| 欧美日韩一区二区三区不卡| 91.com在线观看| 精品国产露脸精彩对白 | 欧美xxxx在线观看| 久久久久久久久久美女| 国产精品久久久爽爽爽麻豆色哟哟 | 色婷婷综合视频在线观看| 色视频欧美一区二区三区| 欧美曰成人黄网| 3751色影院一区二区三区| 久久这里只有精品首页| 国产精品女上位| 一区二区理论电影在线观看| 奇米综合一区二区三区精品视频| 国精产品一区一区三区mba桃花| 国产一区 二区 三区一级| 99天天综合性| 日韩欧美在线网站| 国产亚洲精品资源在线26u| 中文字幕一区二区三区视频| 视频一区二区欧美| 国产精品91xxx| 欧美天天综合网| 欧美激情中文字幕一区二区| 亚洲男人电影天堂| 韩国精品主播一区二区在线观看 | 成人h动漫精品一区二区| 欧美日韩一区二区三区高清| 国产性做久久久久久| 亚洲综合自拍偷拍| 国产美女在线精品| 欧洲精品在线观看| 亚洲国产精品成人久久综合一区| 亚洲成人高清在线| 成人网在线播放| 日韩欧美视频一区| 亚洲综合男人的天堂| 国产高清成人在线| 欧美精品在线观看一区二区| 国产精品久久久久9999吃药| 日本大胆欧美人术艺术动态| av毛片久久久久**hd| 久久先锋影音av鲁色资源网| 舔着乳尖日韩一区| 色先锋aa成人| 自拍偷拍欧美激情| 国产99久久久精品| 日韩一区二区在线观看视频播放| 亚洲欧美乱综合| 岛国av在线一区| 精品国一区二区三区| 亚洲成人在线免费| 在线亚洲高清视频| 国产精品久久久一区麻豆最新章节| 精品一区二区久久| 91麻豆精品国产| 亚洲午夜一区二区| 日本精品一级二级| 自拍视频在线观看一区二区| 成人免费视频播放| 久久蜜臀精品av| 国产呦精品一区二区三区网站| 在线电影国产精品| 日韩av电影天堂| 7777精品伊人久久久大香线蕉 | 亚洲色大成网站www久久九九| 国产精品一二一区| 精品福利av导航|