From 70e0756a6a55b6bb00b4ac445bb7289ed25df610 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sun, 6 Mar 2016 10:04:34 +0000 Subject: [PATCH] Handles now both IPv4 and IPv6 Function should be renamed FossilOrigin-Name: 6a79cd856a810895a4ef8499e210e0fb7f9338e9ce7a1f173daa218e1763535c --- src/cw/cw_in_capwap_control_ipv4_address.c | 29 +++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/cw/cw_in_capwap_control_ipv4_address.c b/src/cw/cw_in_capwap_control_ipv4_address.c index 1e5f49e4..ebe6cb83 100644 --- a/src/cw/cw_in_capwap_control_ipv4_address.c +++ b/src/cw/cw_in_capwap_control_ipv4_address.c @@ -36,13 +36,30 @@ int cw_in_capwap_control_ipv4_address(struct conn *conn, struct cw_action_in *a, return 0; } - struct sockaddr_in addr; - memcpy(&addr.sin_addr,data,4); - addr.sin_family=AF_INET; - sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT); - memcpy(&acip->ip,&addr,sizeof(addr)); + + if (a->elem_id == CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS) { + struct sockaddr_in addr; + memcpy(&addr.sin_addr,data,4); + addr.sin_family=AF_INET; + sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT); + memcpy(&acip->ip,&addr,sizeof(addr)); + acip->wtp_count = cw_get_word(data+4); + } + + if (a->elem_id == CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS) { + struct sockaddr_in6 addr; + memset (&addr,0,sizeof(addr)); + memcpy(&addr.sin6_addr,data,16); + addr.sin6_family=AF_INET6; + sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT); + memcpy(&acip->ip,&addr,sizeof(addr)); + acip->wtp_count = cw_get_word(data+16); + } + + + + - acip->wtp_count = cw_get_word(data+4); cw_aciplist_replace(list,acip);