代码拉取完成,页面将自动刷新
diff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c
--- lwip-org/src/core/netif.c 2023-11-24 17:38:29.428481010 +0800
+++ lwip-vlan/src/core/netif.c 2023-11-27 18:35:00.172481010 +0800
@@ -355,6 +355,11 @@
netif->input = input;
NETIF_RESET_HINTS(netif);
+
+#if GAZELLE_ENABLE
+ netif->vlan_enable=false;
+#endif
+
#if ENABLE_LOOPBACK
netif->loop_first = NULL;
netif->loop_last = NULL;
@@ -441,6 +446,15 @@
return netif;
}
+#if GAZELLE_ENABLE
+void
+netif_set_vlan_tci(struct netif *netif, u16_t vlan_tci)
+{
+ netif->vlan_enable = true;
+ netif->vlan_tci = vlan_tci;
+}
+#endif
+
static void
netif_do_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
{
diff -Nur lwip-org/src/core/tcp.c lwip-vlan/src/core/tcp.c
--- lwip-org/src/core/tcp.c 2023-11-24 17:38:29.448481010 +0800
+++ lwip-vlan/src/core/tcp.c 2023-11-27 10:42:33.228481010 +0800
@@ -987,7 +987,9 @@
lpcb->tos = pcb->tos;
#if LWIP_VLAN_PCP
+#if !GAZELLE_ENABLE
lpcb->netif_hints.tci = pcb->netif_hints.tci;
+#endif
#endif /* LWIP_VLAN_PCP */
#if GAZELLE_TCP_REUSE_IPPORT
lpcb->connect_num = 0;
diff -Nur lwip-org/src/core/tcp_in.c lwip-vlan/src/core/tcp_in.c
--- lwip-org/src/core/tcp_in.c 2023-11-24 17:38:29.448481010 +0800
+++ lwip-vlan/src/core/tcp_in.c 2023-11-27 10:42:33.228481010 +0800
@@ -808,7 +808,9 @@
npcb->listener = pcb;
#endif /* LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG */
#if LWIP_VLAN_PCP
+#if !GAZELLE_ENABLE
npcb->netif_hints.tci = pcb->netif_hints.tci;
+#endif
#endif /* LWIP_VLAN_PCP */
/* inherit socket options */
npcb->so_options = pcb->so_options & SOF_INHERITED;
diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
--- lwip-org/src/include/lwip/netif.h 2023-11-24 17:38:29.440481010 +0800
+++ lwip-vlan/src/include/lwip/netif.h 2023-11-27 18:33:07.936481010 +0800
@@ -45,6 +45,10 @@
#include "lwip/ip_addr.h"
+#if GAZELLE_ENABLE
+#include <stdbool.h>
+#endif
+
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
@@ -357,6 +361,10 @@
#if GAZELLE_ENABLE
u64_t rxol_flags;
u64_t txol_flags;
+ bool vlan_enable;
+ /** vlan id is an attribute of NIC. The variable 'netif_hints' is not used because it is assigned by pcb,
+ * while non transport layers without pcb cannot be enabled */
+ u16_t vlan_tci;
#endif
/** descriptive abbreviation */
char name[2];
@@ -484,6 +492,7 @@
#define netif_get_rxol_flags(netif) ((netif)->rxol_flags)
#define netif_get_txol_flags(netif) ((netif)->txol_flags)
+void netif_set_vlan_tci(struct netif *netif, u16_t vlan_tci);
void netif_set_rtc_mode(struct netif *netif);
void netif_set_rxol_flags(struct netif *netif, u64_t flags);
void netif_set_txol_flags(struct netif *netif, u64_t flags);
diff -Nur lwip-org/src/netif/ethernet.c lwip-vlan/src/netif/ethernet.c
--- lwip-org/src/netif/ethernet.c 2023-11-24 17:38:29.444481010 +0800
+++ lwip-vlan/src/netif/ethernet.c 2023-11-27 11:07:48.464481010 +0800
@@ -283,9 +283,15 @@
vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
#elif LWIP_VLAN_PCP
vlan_prio_vid = -1;
+#if !GAZELLE_ENABLE
if (netif->hints && (netif->hints->tci >= 0)) {
vlan_prio_vid = (u16_t)netif->hints->tci;
}
+#else
+ if (netif->vlan_enable) {
+ vlan_prio_vid = netif->vlan_tci;
+ }
+#endif /* GAZELLE_ENABLE */
#endif
if (vlan_prio_vid >= 0) {
struct eth_vlan_hdr *vlanhdr;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。