JPersson77 / LGTVCompanion

Power On and Off WebOS LG TVs together with your PC
MIT License
992 stars 40 forks source link

Subnet warning incorrect. #152

Closed individualist closed 10 months ago

individualist commented 1 year ago

For some subnets, even though the TV and PC are on the same subnet - LGTV Companion warns that they are not.

Here's an example:

PC is 10.10.18.1/22
LGTV is 10.10.19.200/22

For the above subnet:

Network Address/CIDR: 10.10.16.0/22
Subnet Mask: 255.255.252.0
Valid Host IP rage: 10.10.16.1 - 10.10.19.254
Broadcast Address: 10.10.19.255

I don't know if it's related or not, but scan has never worked for me in such a configuration either. Manual configuration seems to work fine though.

JPersson77 commented 1 year ago

Hi @individualist , thanks for the detailed bug report. I will review the code

JPersson77 commented 1 year ago

This should be fixed in v3.1.9, Issue closed

individualist commented 1 year ago

Hi, @JPersson77 Unfortunately this is still happening for me for subnet 255.255.252.0 (22)

I could be mistaken, but I think the issue may be that during the conversion, the CIDR is being incremented on all bits, but should only increment for bits that are on...

https://github.com/JPersson77/LGTVCompanion/blob/83073254c70344adb692f335fcff47db902ccb53/Common/Common.cpp#L152-L155

e.g.

if ((m & 0x01) == 0x01) CIDR++

This seems to produce CIDR=22, as I expected. Otherwise it produces CIDR=24.

As an aside, this tool is great, thanks for creating it: it really increases quality of life when using a LG OLED.

JPersson77 commented 1 year ago

Thanks! Appreciate the detailed response again. Reopening the issue to try again

JPersson77 commented 11 months ago

Should be fixed in the next version. Please confirm

JPersson77 commented 10 months ago

Closing due to inactivity. Please feel free to reopen as needed