REM:
1. 增加vxlan隧道初始化日志
This commit is contained in:
huangxin 2022-06-14 09:57:08 +08:00
parent 6ee38533ed
commit dddca17acd
1 changed files with 5 additions and 3 deletions

View File

@ -163,7 +163,7 @@ unsigned char *vxlan_pkg_encode(const unsigned char *pInBuf, int inSize, PVXLAN_
pkg->ip_head._chksum = 0x0000; pkg->ip_head._chksum = 0x0000;
pkg->udp_head.chksum = 0x0000; pkg->udp_head.chksum = 0x0000;
checksum = udp_checksum(pBuf, total_len); checksum = udp_checksum(pBuf, total_len);
pkg->udp_head.chksum = checksum; pkg->udp_head.chksum = checksum;
IPH_CHKSUM_SET(&pkg->ip_head, inet_chksum(&pkg->ip_head, 20)); IPH_CHKSUM_SET(&pkg->ip_head, inet_chksum(&pkg->ip_head, 20));
@ -220,7 +220,7 @@ static void vxlan_pkg_head_init(PVXLAN_PEER pvxLan) {
pkg->qinq_head.in_type = lwip_htons(QINQ_802_1_AD); pkg->qinq_head.in_type = lwip_htons(QINQ_802_1_AD);
} }
int vxlan_peer_add(unsigned int vni, const char* pIp, const char* pMac) { int vxlan_peer_add(unsigned int vni, const char *pIp, const char *pMac) {
PVXLAN_PEER vxlan_peer; PVXLAN_PEER vxlan_peer;
if (!VERIFY_STRING(pIp) || !VERIFY_STRING(pMac)) { if (!VERIFY_STRING(pIp) || !VERIFY_STRING(pMac)) {
@ -233,7 +233,7 @@ int vxlan_peer_add(unsigned int vni, const char* pIp, const char* pMac) {
uv_rwlock_rdunlock(&g_vxLanLinks.lock_peer); uv_rwlock_rdunlock(&g_vxLanLinks.lock_peer);
if (vxlan_peer == NULL) { if (vxlan_peer == NULL) {
unsigned int peerIp; unsigned int peerIp;
unsigned char peerMac[6]; unsigned char peerMac[6];
str_to_mac(pMac, peerMac); str_to_mac(pMac, peerMac);
@ -260,6 +260,8 @@ int vxlan_peer_add(unsigned int vni, const char* pIp, const char* pMac) {
uv_rwlock_wrlock(&g_vxLanLinks.lock_peer); uv_rwlock_wrlock(&g_vxLanLinks.lock_peer);
HASH_ADD_INT(g_pAllvxLanPeers, vni, vxlan_peer); HASH_ADD_INT(g_pAllvxLanPeers, vni, vxlan_peer);
uv_rwlock_wrunlock(&g_vxLanLinks.lock_peer); uv_rwlock_wrunlock(&g_vxLanLinks.lock_peer);
dzlog_debug("Add vxLan[vni = %d]: vSwitch: %s, %s\n", vni, pIp, pMac);
} }
return ERR_SUCCESS; return ERR_SUCCESS;