From 78e1d2ba55411563b4e5123ee43cba112b1b558b Mon Sep 17 00:00:00 2001 From: huangxin Date: Mon, 13 Jun 2022 11:35:48 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E5=A2=9E=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96BASE=20MAC=E5=9C=B0=E5=9D=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srcs/lwip/src/arch_linux/netif/pcapif.c | 15 +++++++++++++++ srcs/pppoe/vcpe_pppoe.c | 4 ++-- srcs/user/user_info.c | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/srcs/lwip/src/arch_linux/netif/pcapif.c b/srcs/lwip/src/arch_linux/netif/pcapif.c index d19afb8..e66a603 100644 --- a/srcs/lwip/src/arch_linux/netif/pcapif.c +++ b/srcs/lwip/src/arch_linux/netif/pcapif.c @@ -330,6 +330,21 @@ static err_t netif_input_data(struct pbuf *p, struct netif *inp) { if (ebuf == NULL) { return ERR_IF; + } else { + struct eth_hdr* eth = (struct eth_hdr*)ebuf->payload; + + if(strlen(pContext->session.data.svrBaseMac) == 0) { + if (strlen(pContext->session.data.svrBaseMac) == 0) { + sprintf(pContext->session.data.svrBaseMac, + "%02X:%02X:%02X:%02X:%02X:%02X", + eth->src.addr[0], + eth->src.addr[1], + eth->src.addr[2], + eth->src.addr[3], + eth->src.addr[4], + eth->src.addr[5]); + } + } } if ((err = pContext->session.nicif->input(ebuf, pContext->session.nicif)) != ERR_OK) { diff --git a/srcs/pppoe/vcpe_pppoe.c b/srcs/pppoe/vcpe_pppoe.c index 3d6325f..7a02110 100644 --- a/srcs/pppoe/vcpe_pppoe.c +++ b/srcs/pppoe/vcpe_pppoe.c @@ -263,9 +263,9 @@ int pppoe_session_init() { g_rawSocketIf = bind_pcap_if(config_get_vxlan_nic_name(), config_get_vxlan_pkg_filter(), cfg_get_support_vxlan()); if (g_rawSocketIf) { - dzlog_info("Create Raw Socket netif: <%p>\n", (void *)g_rawSocketIf); + dzlog_info("Create hardware netif: <%p>\n", (void *)g_rawSocketIf); } else { - dzlog_info("Create Raw Socket error: <%p>\n", (void *)g_rawSocketIf); + dzlog_info("Create hardware error: <%p>\n", (void *)g_rawSocketIf); } // 启动Session状态机线程 diff --git a/srcs/user/user_info.c b/srcs/user/user_info.c index 3a2b606..f39bc31 100644 --- a/srcs/user/user_info.c +++ b/srcs/user/user_info.c @@ -20,7 +20,7 @@ void user_info_init() { uv_rwlock_init(&g_userLock); 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(3, &g_userInfo[3]); }