Module: kamailio
Branch: master
Commit: c10d50e10bc5f2c3f6a73dc685f631b3367f2481
URL:
https://github.com/kamailio/kamailio/commit/c10d50e10bc5f2c3f6a73dc685f631b…
Author: Supreeth Herle <herlesupreeth(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-11-30T10:18:47+01:00
cdp: fix for CER not containing Host-IP-Address AVP
---
Modified: src/modules/cdp/peerstatemachine.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c10d50e10bc5f2c3f6a73dc685f631b…
Patch:
https://github.com/kamailio/kamailio/commit/c10d50e10bc5f2c3f6a73dc685f631b…
---
diff --git a/src/modules/cdp/peerstatemachine.c b/src/modules/cdp/peerstatemachine.c
index 74d119b70f2..0732822e0fa 100644
--- a/src/modules/cdp/peerstatemachine.c
+++ b/src/modules/cdp/peerstatemachine.c
@@ -132,8 +132,10 @@ int sm_process(
case Wait_Conn_Ack:
switch(event) {
case I_Rcv_Conn_Ack:
- I_Snd_CER(p);
p->state = Wait_I_CEA;
+ I_Snd_CER(p);
+ if (p->state == Closed)
+ sm_process(p, Start, 0, 1, 0);
break;
case I_Rcv_Conn_NAck:
Cleanup(p, p->I_sock);
@@ -656,6 +658,7 @@ void I_Snd_CER(peer *p)
} addr_u;
socklen_t addrlen;
char x[18];
+ int ret = 0;
cer = AAANewMessage(Code_CE, 0, 0, 0);
if(!cer)
@@ -663,10 +666,16 @@ void I_Snd_CER(peer *p)
cer->hopbyhopId = next_hopbyhop();
cer->endtoendId = next_endtoend();
addrlen = sizeof(addr_u);
- if(getsockname(p->I_sock, &(addr_u.addr), &addrlen) == -1) {
+ if((ret = getsockname(p->I_sock, &(addr_u.addr), &addrlen)) == -1) {
LM_ERR("I_Snd_CER(): Error on finding local host address > %s\n",
strerror(errno));
- } else {
+ Cleanup(p,p->I_sock);
+ p->state = Closed;
+ AAAFreeMessage(&cer);
+ return;
+ }
+
+ if (ret != -1) {
switch(addr_u.addr.sa_family) {
case AF_INET:
set_2bytes(x, 1);