lldpad/lldpad-0.9.41-handle-negative-response-in-VDP-state-machine.patch
2011-04-21 09:10:21 +02:00

70 lines
2.5 KiB
Diff

From 2784f4b9b91fea1690841f9284c11cac6cfe0e1f Mon Sep 17 00:00:00 2001
From: Jens Osterkamp <jens@linux.vnet.ibm.com>
Date: Sun, 6 Mar 2011 21:38:06 -0800
Subject: [PATCH 14/51] handle negative response in VDP state machine
In case where we receive a negative response to a request from the switch,
handle it appropriately.
Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Petr Sabata <psabata@redhat.com>
---
lldp_vdp.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/lldp_vdp.c b/lldp_vdp.c
index 9bd361e..025cc8f 100644
--- a/lldp_vdp.c
+++ b/lldp_vdp.c
@@ -332,6 +332,14 @@ static void vdp_stop_keepaliveTimer(struct vsi_profile *profile)
profile->instance[15], profile->keepaliveTimer);
}
+static bool vdp_vsi_negative_response(struct vsi_profile *profile)
+{
+ if ((profile->response > 0) && (profile->response < 255))
+ return true;
+ else
+ return false;
+}
+
/* vdp_vsi_change_station_state - changes the VDP station sm state
* @profile: profile to process
* @newstate: new state for the sm
@@ -426,8 +434,10 @@ static bool vdp_vsi_set_station_state(struct vsi_profile *profile)
if (profile->mode == VDP_MODE_PREASSOCIATE) {
vdp_vsi_change_station_state(profile, VSI_PREASSOC_PROCESSING);
return true;
- } else if (profile->mode == VDP_MODE_DEASSOCIATE) {
+ } else if ((profile->mode == VDP_MODE_DEASSOCIATE) ||
+ vdp_vsi_negative_response(profile)) {
vdp_vsi_change_station_state(profile, VSI_DEASSOC_PROCESSING);
+ vdp_somethingChangedLocal(profile, true);
return true;
} else if (vdp_keepaliveTimer_expired(profile)) {
vdp_stop_keepaliveTimer(profile);
@@ -874,6 +884,9 @@ int vdp_indicate(struct vdp_data *vd, struct unpacked_tlv *tlv, int ecp_mode)
p->mode = vdp->mode;
p->response = vdp->response;
+ if (vdp_vsi_negative_response(p))
+ p->mode = VDP_MODE_DEASSOCIATE;
+
LLDPAD_DBG("%s(%i): profile response: %s (%i) "
"for profile 0x%02x at state %s.\n",
__func__, __LINE__,
@@ -881,7 +894,8 @@ int vdp_indicate(struct vdp_data *vd, struct unpacked_tlv *tlv, int ecp_mode)
p->response, p->instance[15],
vsi_states[p->state]);
} else {
- LLDPAD_DBG("%s(%i): station: profile not found !\n", __func__, __LINE__);
+ LLDPAD_DBG("%s(%i): station: profile not found !\n",
+ __func__, __LINE__);
/* ignore profile */
}
}
--
1.7.4.4