Re: [mh] xAP vs Proxy
Stephen Switzer <[email protected]>
| Newsgroups | gmane.comp.misc.misterhouse.user |
|---|---|
| Message-ID | <CALSXUc3OQNrtjG0btArtCx3uiCoqqKHq-3qPjnrMh6CPQK1miQ@mail.gmail.com> |
(Spoiler alert: I figured out the cause of my issue, but I left the email
that I crafted along the way intact, in case it helps someone else later.
See my last sentences.)
Thanks for the reply. I was just about to look at this again. There's no
firewall on this box:
root@avalanche:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
..and to prove the network is OK, tcpdump shows traffic if I use nc to pipe
data to the box:
root@avalanche:~# tcpdump -vvvvvv -i enp4s0 udp port 3639
tcpdump: listening on enp4s0, link-type EN10MB (Ethernet), capture size
262144 bytes
10:02:02.067482 IP (tos 0x0, ttl 63, id 32408, offset 0, flags [none],
proto UDP (17), length 199)
steve-inspiron-7537.switzerny.local.52700 >
avalanche.switzerny.local.3639: [udp sum ok] UDP, length 171
^C
1 packet captured
1 packet received by filter
0 packets dropped by kernel
MH is listening on this port:
root@avalanche:~# ss -tunlp
Netid State Recv-Q Send-Q Local Address:Port
Peer Address:Port Process
udp UNCONN 0 0 0.0.0.0:3639
0.0.0.0:* users:(("perl",pid=449758,fd=13))
...but the xAP code reports nothing.
$xap_monitor1 = new xAP_Item;
$xap_monitor1->tie_event('print_log "xap data: $state"');
Since it's not solved, I can't say definitively what the issue is, but I
cannot see how it's anything except my MH implementation at this point.
Thinking further, I just modified lib/xAP_Items.pm to add dumping of the
data received.
I see this: &::MainLoop_pre_add_hook( \&xAP::check_for_data, 1 );
...and check_for_data calls _process_incoming_xap_hub_data. So I edited
that:
sub _process_incoming_xap_hub_data {
my ($data) = @_;
my $ip_address = $::config_parms{'ipaddress_xap'};
$ip_address = $::Info{IPAddress_local} unless $ip_address;
undef $xap_data;
$xap_data = &parse_data($data);
my ( $protocol, $source, $class, $target );
if ( $$xap_data{'xap-header'} or $$xap_data{'xap-hbeat'} ) {
$protocol = 'xAP';
$source = $$xap_data{'xap-header'}{source};
$class = $$xap_data{'xap-header'}{class};
$target = $$xap_data{'xap-header'}{target};
$source = $$xap_data{'xap-hbeat'}{source} unless $source;
$class = $$xap_data{'xap-hbeat'}{class} unless $class;
$target = $$xap_data{'xap-hbeat'}{target} unless $target;
}
print Dumper($xap_data);
return unless $source;
&::print_log("source: $source");
my ($port);
# As a hub, echo data to other listeners
...then I see this in the log when I netcat data to MH:
11/25/20 10:35:21 AM [xAP_Items.pm] (check_for_data) Received xap data:
$VAR1 = {
'xap-hbeat' => {},
'mhouse.item' => {
'state' => 'off',
'mh_target' => '',
'state_prev' => 'on',
'name' => '$Motion_Living',
'set_by' => ''
},
'xap-header' => {
'source' => 'mhouse.mh.misterhouse.core',
'hop' => '1',
'uid' => 'ffe90001',
'class' => 'mhouse.item',
'v' => '12'
}
};
11/25/20 10:35:21 AM source: mhouse.mh.misterhouse.core
So, xAP_Items.pm is receiving the data and processing it, but it seems to
stop there and not update any local objects that I reference.
Digging further and adding more dump calls, I noticed that
_process_incoming_xap_data was being called... but it dropped the data
silently because of:
if ( !( $source eq &xAP::get_xap_mh_source_info() ) ) {
There's no debug line that says this is the reason for ignoring the
incoming data, so I think we should add something in. I'll likely create a
pull request for this. I think I'm on to something here, finally. I needed
to change the source to something that MH didn't recognize as itself. This
leads me to ask if MH will need this overridden when working together with
other MH instances. Thanks for your patience, all of you.
Steve
On Tue, Nov 24, 2020 at 6:49 PM Brian M <[email protected]>
wrote:
> On 11/24/20 2:41 PM, Stephen Switzer wrote:
> >
> > ...but nothing indicating that the data I sent was received. I must be
> > overlooking something, but... can't figure it out. Yet. Eventually,
> > I'm thinking of having my laptop participate, but it's on a different
> > vlan/subnet. I don't want to add that layer of complexity yet.
> >
> I know fair amount about networking, a moderate amount about MH, and
> nothing about xAP. Given that, do you have a firewall on the box?
> Maybe it's blocking your inbound traffic. "iptables -nvL INPUT". See
> if there's a rule about that port, and if not, what the default INPUT
> policy is.
>
> Next up would be: Is anything listening on that port. "netstat -plntu"
> will which ports are being listened to, and by whom.
>
> People that know xAP may be able to tell from your post that you're
> already way beyond that. If so, please forgive my ignorance.
>
> -Brian M
>
>
>
> ________________________________________________________
> To unsubscribe from this list, go to:
> https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>
>
--
Best regards,
Steve Switzer
---
Get world-class business I.T. services and a phone system with awesome
features that won't challenge your budget!http://www.sbsROC.com
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users