OCT
REM: 1. 可以根据下发的配置增加vxLan信息 2. vxLan用户信息为空时,网卡走普通数据包模式
This commit is contained in:
parent
f6b5fe515c
commit
6ee38533ed
|
@ -45,7 +45,7 @@ application:
|
|||
zero_mq:
|
||||
{
|
||||
svr_port = 6278; # ZeroMQ 服务器端口
|
||||
agent_addr = "ipc:///tmp/msg_fifo0"; # 消息通道路径
|
||||
agent_addr = "ipc:///tmp/msg_fifo1"; # 消息通道路径
|
||||
};
|
||||
|
||||
# vxlan 相关
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "pppoe_info.h"
|
||||
#include "user_errno.h"
|
||||
#include "user_info.h"
|
||||
#include "vxlan_pkg.h"
|
||||
|
||||
#define AGENT_CMD_ADDUSER ("add-ywg-pppoe-vcpe")
|
||||
|
||||
|
@ -247,7 +248,6 @@ static void process_data_msg(void *UNUSED(pDataCh), zmq_msg_t *pMsg) {
|
|||
PADD_INFO pInfo = &(p->pInfo[m]);
|
||||
for (n = 0; n < pInfo->userCount; n++) {
|
||||
PADD_USER_USER pUser = &(pInfo->pUser[n]);
|
||||
#if 1
|
||||
USER_PARAMS userInfo;
|
||||
|
||||
memset(&userInfo, 0, sizeof(USER_PARAMS));
|
||||
|
@ -259,8 +259,8 @@ static void process_data_msg(void *UNUSED(pDataCh), zmq_msg_t *pMsg) {
|
|||
userInfo.q1 = pUser->c_tag_in;
|
||||
userInfo.q2 = pUser->s_tag_in;
|
||||
str_to_mac(pUser->clientMac, userInfo.mac_addr);
|
||||
vxlan_peer_add(pUser->vni, pInfo->vxlan.vsvxlanIP, pInfo->vxlan.vsvxlanMac);
|
||||
user_info_add(userInfo.userid, &userInfo);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
free_add_user(p);
|
||||
|
|
|
@ -197,15 +197,14 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) {
|
|||
|
||||
if (pBuf && outSize != 0) {
|
||||
written = pcap_inject(pcapif->pcap, pBuf, outSize);
|
||||
}
|
||||
|
||||
free(pBuf);
|
||||
|
||||
return written == (outSize) ? ERR_OK : ERR_IF;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
written = pcap_inject(pcapif->pcap, buf, p->tot_len);
|
||||
return (written == p->tot_len) ? ERR_OK : ERR_IF;
|
||||
}
|
||||
}
|
||||
|
||||
err_t pcapif_output(struct netif *netif, struct pbuf *p) {
|
||||
|
@ -310,6 +309,7 @@ static void link_callback(struct netif *state_netif) {
|
|||
|
||||
static err_t netif_input_data(struct pbuf *p, struct netif *inp) {
|
||||
err_t err = ERR_OK;
|
||||
struct netif *netif;
|
||||
struct pcapif *pcapif = (struct pcapif *)inp->state;
|
||||
const unsigned char *pBuf = (const unsigned char *)p->payload;
|
||||
|
||||
|
@ -331,9 +331,9 @@ 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;
|
||||
struct eth_hdr *eth = (struct eth_hdr *)ebuf->payload;
|
||||
|
||||
if(strlen(pContext->session.data.svrBaseMac) == 0) {
|
||||
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",
|
||||
|
@ -354,8 +354,8 @@ static err_t netif_input_data(struct pbuf *p, struct netif *inp) {
|
|||
pbuf_free(p);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
struct netif *netif;
|
||||
}
|
||||
|
||||
NETIF_FOREACH(netif) {
|
||||
if (netif->hwaddr_len == 6 && memcmp(p->payload, netif->hwaddr, netif->hwaddr_len) == 0) {
|
||||
|
||||
|
@ -367,7 +367,6 @@ static err_t netif_input_data(struct pbuf *p, struct netif *inp) {
|
|||
return err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tcpip_input(p, inp);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,6 @@ _Noreturn void sessionCalcCb(void *UNUSED(pArg)) {
|
|||
case STATUS_TASK_INIT:
|
||||
if (pppoe_session_create(pUser) == ERR_SUCCESS) {
|
||||
dzlog_debug("User(%05d:%s) init pppoe session\n", pUser->userid, pUser->user_info.pppoe_user);
|
||||
vxlan_peer_add(pUser->vxlan.vni, config_get_vxlan_peer_ip(), config_get_vxlan_peer_mac());
|
||||
pSession->status = STATUS_TASK_DIAL;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue