From 96b9a70885f56f79c80400f9efbaa7598edec4d1 Mon Sep 17 00:00:00 2001 From: Jens Osterkamp Date: Sun, 6 Mar 2011 21:38:25 -0800 Subject: [PATCH 17/51] check if port is enabled for RxTx In vdp_ifup, check in adminstatus if port is enabled for RxTx, and do nothing, if not. Signed-off-by: Jens Osterkamp Signed-off-by: John Fastabend Signed-off-by: Petr Sabata --- lldp_vdp.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/lldp_vdp.c b/lldp_vdp.c index 980eaaf..b7c8f82 100644 --- a/lldp_vdp.c +++ b/lldp_vdp.c @@ -1235,6 +1235,7 @@ void vdp_ifup(char *ifname) char *p; struct vdp_data *vd; struct vdp_user_data *ud; + struct port *port; LLDPAD_DBG("%s(%i): starting VDP for if %s !\n", __func__, __LINE__, ifname); @@ -1270,6 +1271,20 @@ void vdp_ifup(char *ifname) ud = find_module_user_data_by_if(ifname, &lldp_head, LLDP_MOD_VDP); LIST_INSERT_HEAD(&ud->head, vd, entry); + port = port_find_by_name(ifname); + + if (!port) { + LLDPAD_ERR("%s(%i): could not find port for %s!\n", + __func__, __LINE__, ifname); + goto out_err; + } + + if (port->adminStatus != enabledRxTx) { + LLDPAD_WARN("%s(%i): port %s not enabled for RxTx (%i) !\n", + __func__, __LINE__, ifname, port->adminStatus); + return; + } + out_start_again: if (ecp_init(ifname)) { LLDPAD_ERR("%s:%s unable to init ecp !\n", __func__, ifname); -- 1.7.4.4