[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openser-devel
Subject:    [sr-dev] git:master:c10d50e1: cdp: fix for CER not containing Host-IP-Address AVP
From:       Daniel-Constantin Mierla via sr-dev <sr-dev () lists ! kamailio ! org>
Date:       2023-11-30 10:02:05
Message-ID: E1r8drx-0001A1-RR () www ! kamailio ! org
[Download RAW message or body]

Module: kamailio
Branch: master
Commit: c10d50e10bc5f2c3f6a73dc685f631b3367f2481
URL: https://github.com/kamailio/kamailio/commit/c10d50e10bc5f2c3f6a73dc685f631b3367f2481

Author: Supreeth Herle <herlesupreeth@gmail.com>
Committer: Daniel-Constantin Mierla <miconda@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/c10d50e10bc5f2c3f6a73dc685f631b3367f2481.diff
Patch: https://github.com/kamailio/kamailio/commit/c10d50e10bc5f2c3f6a73dc685f631b3367f2481.patch

---

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);

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-leave@lists.kamailio.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic