nickvsnetworking / pyhss

Python HSS / Diameter Server
GNU Affero General Public License v3.0
71 stars 59 forks source link

Answer_16777238_272() is storing the wrong Diameter remote_peer which breaks async messages when a DRA is used #181

Open nickvsnetworking opened 10 months ago

nickvsnetworking commented 10 months ago

We get the remote peer based on this:

            try:        #Check if we have a record-route set as that's where we'll need to send the response
                remote_peer = self.get_avp_data(avps, 282)[-1]                          #Get first record-route header
                remote_peer = binascii.unhexlify(remote_peer).decode('utf-8')           #Format it
            except:     #If we don't have a record-route set, we'll send the response to the OriginHost
                remote_peer = OriginHost
            self.logTool.log(service='HSS', level='debug', message="[diameter.py] [Answer_16777238_272] [CCA] Remote Peer is " + str(remote_peer), redisClient=self.redisMessaging)
            remote_peer = remote_peer + ";" + str(self.config['hss']['OriginHost'])

If the peer is coming from a DRA, this will just get the Origin-Host, not the DRA connection,

We'll need to pass the source IP & port through, and then run that through Redis' ActiveDiameterPeers to find the peer.