mirror of
https://github.com/unifi-utilities/unifios-utilities.git
synced 2024-08-30 18:32:21 +00:00
Proxy for HDHomeRun tuner discovery across VLANs (#337)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
This commit is contained in:
parent
1adccdb235
commit
a07f4bd873
BIN
hdhomerun/.DS_Store
vendored
Normal file
BIN
hdhomerun/.DS_Store
vendored
Normal file
Binary file not shown.
62
hdhomerun/README.md
Normal file
62
hdhomerun/README.md
Normal file
@ -0,0 +1,62 @@
|
||||
# HDHomeRun VLAN Traversal
|
||||
|
||||
## License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
## Reference
|
||||
|
||||
From https://community.ui.com/questions/Howto-HDHomerun-discovery-on-different-LAN-segment/97db52c6-4add-4ba1-ab0d-27ee6f43db8f
|
||||
|
||||
## Purpose
|
||||
|
||||
The HDHomeRun software sends a UDP broadcast out to the HDHomeRun tuner as part
|
||||
of the discovery process. If your HDHomeRun is on a separate VLAN, you need
|
||||
some sort of proxy to push this UDP broadcast out to the target network.
|
||||
|
||||
Also `socat` is a useful tool and maybe you want to cross-compile it for your
|
||||
UDMP(SE)
|
||||
|
||||
## Compiling `socat`
|
||||
|
||||
In the `build` directory, there is a Docker file to cross compile a socat
|
||||
binary for the Dream Machine Pro.
|
||||
|
||||
```docker build -t build_socat .```
|
||||
```docker run -v $PWD:/tmp/release build_socat```
|
||||
|
||||
The first command builds the container, and the second runs the container. The
|
||||
container will copy the binary inside the container to `/tmp/release`. The -v
|
||||
volume mapping will case the file to apper in the current working directory of
|
||||
the host.
|
||||
|
||||
Precompiled binary is provided. Use at your own risk.
|
||||
|
||||
## Setting up the on.boot script
|
||||
|
||||
1. Update the `99-hdhomerun.sh` script with the IP address of your HDHomeRun
|
||||
tuner.
|
||||
2. Place it in your `on_boot.d` folder and make it executable.
|
||||
3. Reboot your UDMP(SE) or restart the service with something like
|
||||
`systemctl restart udm-boot`
|
||||
4. You can verify the script is running with `ps aux | grep "socat"`
|
||||
5. The HDHomeRun software should now be able to discover the tuner on the
|
||||
other VLAN.
|
||||
|
||||
## Testing
|
||||
|
||||
This was tested with an HDHomeRun PRIME. I do not know if it works with other
|
||||
hardware.
|
BIN
hdhomerun/bin/.DS_Store
vendored
Normal file
BIN
hdhomerun/bin/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
hdhomerun/bin/socat
Executable file
BIN
hdhomerun/bin/socat
Executable file
Binary file not shown.
BIN
hdhomerun/build/.DS_Store
vendored
Normal file
BIN
hdhomerun/build/.DS_Store
vendored
Normal file
Binary file not shown.
43
hdhomerun/build/Dockerfile
Normal file
43
hdhomerun/build/Dockerfile
Normal file
@ -0,0 +1,43 @@
|
||||
# Note: map a volume to /tmp/release to accept the binary.
|
||||
# ```
|
||||
# docker build -t build_socat .
|
||||
|
||||
FROM aarch64/gcc
|
||||
|
||||
ARG SOCAT_VERSION=1.7.4.3
|
||||
ARG READLINE_VERSION=7.0
|
||||
ARG OPENSSL_VERSION=1.0.2k
|
||||
|
||||
# Make directories
|
||||
RUN mkdir -p /build && mkdir -p /tmp/release
|
||||
WORKDIR /build
|
||||
|
||||
# Build readline
|
||||
RUN curl -k -LO ftp://ftp.cwru.edu/pub/bash/readline-${READLINE_VERSION}.tar.gz
|
||||
RUN tar xzvf readline-${READLINE_VERSION}.tar.gz
|
||||
WORKDIR /build/readline-${READLINE_VERSION}
|
||||
RUN ./configure -disable-shared --enable-static -build=aarch64
|
||||
RUN make -j4
|
||||
RUN make install-static
|
||||
|
||||
# Build OpenSSL
|
||||
WORKDIR /build
|
||||
RUN curl -k -LO https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
|
||||
RUN tar zxvf openssl-${OPENSSL_VERSION}.tar.gz
|
||||
WORKDIR /build/openssl-${OPENSSL_VERSION}
|
||||
ENV CFLAGS='-fPIC -static'
|
||||
RUN ./Configure no-shared linux-aarch64
|
||||
RUN make -j4
|
||||
RUN make install
|
||||
|
||||
# Build socat
|
||||
WORKDIR /build
|
||||
RUN curl -k -LO http://www.dest-unreach.org/socat/download/socat-${SOCAT_VERSION}.tar.gz
|
||||
RUN tar xzvf socat-${SOCAT_VERSION}.tar.gz
|
||||
WORKDIR /build/socat-${SOCAT_VERSION}
|
||||
ENV LDFLAGS='-static -ldl -ltinfo'
|
||||
RUN ./configure -build=linux-aarch64
|
||||
RUN make -j4
|
||||
|
||||
# Copy the file to the release directory
|
||||
ENTRYPOINT cp socat /tmp/release
|
5
hdhomerun/on_boot.d/99-hdhomerun.sh
Normal file
5
hdhomerun/on_boot.d/99-hdhomerun.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Place cross compiled version of `socat` in /mnt/data/hdhomerun
|
||||
HDHOMERUN_IP=10.10.30.146
|
||||
|
||||
/mnt/data/hdhomerun/socat -d -d -v udp4-recvfrom:65001,broadcast,fork udp4-sendto:{$HDHOMERUN_IP}:65001 &
|
Loading…
Reference in New Issue
Block a user