REM:
1. 补充vxlan不可用情况下网卡数据处理流程
This commit is contained in:
huangxin 2022-06-15 11:04:04 +08:00
parent dddca17acd
commit 704ddb08d0
2 changed files with 15 additions and 9 deletions

View File

@ -329,8 +329,6 @@ static err_t netif_input_data(struct pbuf *p, struct netif *inp) {
vxlan_pkg_decode(p, &ebuf, &tag); vxlan_pkg_decode(p, &ebuf, &tag);
if (ebuf == NULL) { if (ebuf == NULL) {
return ERR_IF;
} else {
struct eth_hdr *eth = (struct eth_hdr *)ebuf->payload; struct eth_hdr *eth = (struct eth_hdr *)ebuf->payload;
if (strlen(pContext->session.data.svrBaseMac) == 0) { if (strlen(pContext->session.data.svrBaseMac) == 0) {
@ -345,18 +343,25 @@ static err_t netif_input_data(struct pbuf *p, struct netif *inp) {
eth->src.addr[5]); eth->src.addr[5]);
} }
} }
}
if ((err = pContext->session.nicif->input(ebuf, pContext->session.nicif)) != ERR_OK) { if ((err = pContext->session.nicif->input(ebuf, pContext->session.nicif)) != ERR_OK) {
LWIP_DEBUGF(NETIF_DEBUG, ("pppoeif_input: netif input error\n")); LWIP_DEBUGF(NETIF_DEBUG, ("pppoeif_input: netif input error\n"));
} }
pbuf_free(p); pbuf_free(p);
return err; return err;
}
} }
} }
// 当前网卡的数据包vxLan无法处理则送回协议栈处理
if (memcmp(pBuf, inp->hwaddr, inp->hwaddr_len) == 0) {
return tcpip_input(p, inp);
}
// 遍历用户网卡处理数据
NETIF_FOREACH(netif) { NETIF_FOREACH(netif) {
if (netif->hwaddr_len == 6 && memcmp(p->payload, netif->hwaddr, netif->hwaddr_len) == 0) { if (netif->hwaddr_len == 6 && memcmp(p->payload, netif->hwaddr, netif->hwaddr_len) == 0) {
if ((err = netif->input(p, netif)) != ERR_OK) { if ((err = netif->input(p, netif)) != ERR_OK) {
@ -368,6 +373,7 @@ static err_t netif_input_data(struct pbuf *p, struct netif *inp) {
} }
} }
// 无用户关联网卡数据直接送协议栈处理
return tcpip_input(p, inp); return tcpip_input(p, inp);
} }

View File

@ -23,7 +23,7 @@ void user_info_init() {
//user_info_add(0, &g_userInfo[0]); //user_info_add(0, &g_userInfo[0]);
//user_info_add(1, &g_userInfo[1]); //user_info_add(1, &g_userInfo[1]);
//user_info_add(2, &g_userInfo[2]); //user_info_add(2, &g_userInfo[2]);
//user_info_add(3, &g_userInfo[3]); user_info_add(3, &g_userInfo[3]);
} }
void user_info_change_status(PUSER_INFO_CONTEXT pInfo, USER_STATUS status) { void user_info_change_status(PUSER_INFO_CONTEXT pInfo, USER_STATUS status) {