deptofdefense / AndroidTacticalAssaultKit-CIV

Other
32 stars 14 forks source link

Bug: CoT not being handled by ATAK #265

Open rehovicova opened 2 years ago

rehovicova commented 2 years ago

We are completely unable to send a CoT to localhost in ATAK 4.3 and 4.4 (other version were not tested), but it works with 3.10.

val datagramSocket: DatagramSocket
val receiverAddress: InetAddress
val port = 4243
      try {
            datagramSocket = DatagramSocket()
            receiverAddress = InetAddress.getLocalHost()
            val cotSb = StringBuilder()
            cotEvent.buildXml(cotSb)
            val buffer = cotSb.toString().toByteArray()
            val packet = DatagramPacket(buffer, buffer.size, receiverAddress, port)
            datagramSocket.send(packet)
        } catch  ...

I changed the port to 4243 in the network connection of course.

After a long time of trying to build 4.5 (btw, you should also try to build 4.5 from scratch, because the instructions are not complete, and the scripts needed to be changed...) We built ATAK 4.5 and it started working. The only difference between these versions is that 4.5 lets you keep 0.0.0.0 as a valid address in Network Connections settings. That being said, if you set 127.0.0.1 in 4.5 the CoT message also won't get handled. Same goes if you set receiverAddress to IPv6. E.g.:

receiverAddress = InetAddress.getLoopbackAddress()

Won't work neither with 0.0.0.0 nor 127.0.0.1 in the connection settings.

So the only solution to sending a CoT to a localhost is to build ATAK 4.5, set the address to 0.0.0.0 and in your code make sure you are using IPv4.

This is a bug and it should be fixed.

IgorGanapolsky commented 2 years ago

What label should we give to this issue? I'd like to categorize it for tracking.

bisgroves commented 1 year ago

I am trying to understand the initial report - is ATAK 4.5 behaving as expected or did you need to make changes to it to handle the CoT from localhost?