rscada / libmbus

Meter-bus library and utility programs
http://www.rscada.se/libmbus
BSD 3-Clause "New" or "Revised" License
217 stars 137 forks source link

IPv6 does not work #209

Closed petrkr closed 3 months ago

petrkr commented 1 year ago
$ mbus-tcp-request-data -d 2a00:abcd:4018:e490:860d:8eff:fec2:abcd 1234 10
Failed to setup connection to M-bus gateway
$ mbus-tcp-request-data -d [2a00:abcd:4018:e490:860d:8eff:fec2:abcd] 1234 10
Failed to setup connection to M-bus gateway

But over IPv4 it works

$ mbus-tcp-request-data -d 192.168.131.121 1234 10
[2023-06-20 15:37:06Z] SEND (005): 10 5B 0A 65 16
[2023-06-20 15:37:06Z] RECV (066): 68 3C 3C ....
Apollon77 commented 3 months ago

I would assume that the change needs to happen in https://github.com/rscada/libmbus/blob/master/mbus/mbus-tcp.c#L60-L69 and needs to get configurable or detectable. most likely another address family needs to be given.

I do not know the linux APIs enough, but should be documented. So "just" need to find time ;-)

petrkr commented 3 months ago

Well, I've rewritten part of TCP connect and it works now.

But since how much forks and similar "addons" I see. I am little-bit sad everyone just fork, do own update and not do pull request. But since there are already 15 open PR without any comment it seems to be dead project already.

But problem is if every distro will use this as source for packages, it will never be fixed.

https://github.com/petrkr/libmbus/commit/a6297b406a5a2e6734552a6a1dda954ab41f393a

[petrkr@pkdell libmbus (ipv6 %=)]$ ./bin/mbus-tcp-request-data aaaa::860d:8eff:abcd:d000 1234 10
<?xml version="1.0" encoding="ISO-8859-1"?>
<MBusData>

    <SlaveInformation>
        <Id>22100477</Id>
        <Manufacturer>ACW</Manufacturer>
lategoodbye commented 3 months ago

I'm merged pull request #213 Thanks @petrkr

petrkr commented 3 months ago

Tested again from master and it works fine. Thanks