diff --git a/srcs/lwip/src/arch_linux/core/vxlan_pkg.c b/srcs/lwip/src/arch_linux/core/vxlan_pkg.c index efe4544..5dfe6bd 100644 --- a/srcs/lwip/src/arch_linux/core/vxlan_pkg.c +++ b/srcs/lwip/src/arch_linux/core/vxlan_pkg.c @@ -203,7 +203,6 @@ static void vxlan_pkg_head_init(PVXLAN_PKG_HEAD pvxLan) { pkg->vxlan_head.res1 = 0x00; pkg->vxlan_head.res2 = 0x00; pkg->vxlan_head.res3 = 0x00; - //pkg->vxlan_head.vni_reserved = lwip_htonl(VXLAN_VIN_ID_PACK(pvxLan->vni)); // 设置内层ETH头部 // 设置内层报文类型 @@ -237,6 +236,8 @@ int vxlan_peer_add(const char *pIp, const char *pMac) { return -ERR_MALLOC_MEMORY; } + g_vxLanLinks.pkg_head = pkg; + memset(pkg, 0, sizeof(VXLAN_PKG_HEAD)); pkg->peerIp = lwip_htonl(peerIp); @@ -272,41 +273,5 @@ int vxlan_link_init(const char *pEthName) { return -ERR_SYS_INIT; } -#if 0 - PVXLAN_LINK pvxLan; - - if (!VERIFY_STRING(pEthName) || !VERIFY_STRING(pPeerIp) || !VERIFY_STRING(pPeerMac)) { - dzlog_error("Input parameters error: %s, %s, %s\n", - SAFETY_STR_STRING(pEthName), - SAFETY_STR_STRING(pPeerIp), - SAFETY_STR_STRING(pPeerMac)); - return -ERR_INPUT_PARAMS; - } - - pvxLan = (PVXLAN_LINK)malloc(sizeof(VXLAN_LINK)); - - if (pvxLan == NULL) { - dzlog_error("Create vxLan link error: %lu\n", sizeof(VXLAN_LINK)); - return -ERR_MALLOC_MEMORY; - } - - memset(pvxLan, 0, sizeof(VXLAN_LINK)); - - strncpy(pvxLan->vxlan_configure.ethName, pEthName, ETH_NAME_MAX); - str_to_mac(pPeerMac, pvxLan->vxlan_configure.ourMac); - - if (str_to_ipaddr(pPeerIp, &pvxLan->vxlan_configure.peerIp) == 0) { - dzlog_error("Get vxLan peer ip address failed: %s\n", pPeerIp); - return -ERR_SYS_INIT; - } - - if (get_nic_info(pEthName, &pvxLan->vxlan_configure.outIp, NULL, NULL, pvxLan->vxlan_configure.ourMac) - != ERR_SUCCESS) { - dzlog_error("Get NIC information failed\n"); - return -ERR_SYS_INIT; - } - - HASH_ADD_INT() -#endif return ERR_SUCCESS; }