diff --git a/srcs/lwip/src/arch_linux/netif/pcapif.c b/srcs/lwip/src/arch_linux/netif/pcapif.c index af70fec..4c5e3ce 100644 --- a/srcs/lwip/src/arch_linux/netif/pcapif.c +++ b/srcs/lwip/src/arch_linux/netif/pcapif.c @@ -329,8 +329,6 @@ static err_t netif_input_data(struct pbuf *p, struct netif *inp) { vxlan_pkg_decode(p, &ebuf, &tag); if (ebuf == NULL) { - return ERR_IF; - } else { struct eth_hdr *eth = (struct eth_hdr *)ebuf->payload; 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]); } } - } - if ((err = pContext->session.nicif->input(ebuf, pContext->session.nicif)) != ERR_OK) { - LWIP_DEBUGF(NETIF_DEBUG, ("pppoeif_input: netif input error\n")); - } + if ((err = pContext->session.nicif->input(ebuf, pContext->session.nicif)) != ERR_OK) { + LWIP_DEBUGF(NETIF_DEBUG, ("pppoeif_input: netif input error\n")); + } - pbuf_free(p); - return err; + pbuf_free(p); + return err; + } } } + // 当前网卡的数据包,vxLan无法处理则送回协议栈处理 + if (memcmp(pBuf, inp->hwaddr, inp->hwaddr_len) == 0) { + return tcpip_input(p, inp); + } + + // 遍历用户网卡处理数据 NETIF_FOREACH(netif) { + if (netif->hwaddr_len == 6 && memcmp(p->payload, netif->hwaddr, netif->hwaddr_len) == 0) { 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); } diff --git a/srcs/user/user_info.c b/srcs/user/user_info.c index 620da96..eb5fbf0 100644 --- a/srcs/user/user_info.c +++ b/srcs/user/user_info.c @@ -23,7 +23,7 @@ void user_info_init() { //user_info_add(0, &g_userInfo[0]); //user_info_add(1, &g_userInfo[1]); //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) {