Avahi Integration and Network Connection
Project Description
This project aims to integrate Avahi service on a Linux server to manage and control network connections between mobile devices and televisions. The goal is to establish a 1-to-1 connection between specific mobile devices on the 192.168.10.x network and TVs on the 192.168.20.x network, acting as a controlled intermediary.
Why Start This Project?
The project is initiated to address the challenges of uncontrolled network connections facilitated by Avahi. By creating a custom C/C++ program, we aim to restrict and secure connections between mobile and TV networks, allowing specific devices to connect only to designated TVs.
Goal for this Hackweek
The primary objective for this Hackweek is to develop and implement the C/C++ program that will interface with Avahi, handling mDNS queries and unicast responses. We intend to demonstrate the controlled forwarding of packets between networks, achieving the goal of establishing a secure 1-to-1 connection.
To be more specific: For this hackweed we want to achieve
- successfully install avahi on the system
- check /usr/include > cd avahi- avahi-client/ avahi-common/ avahi-compat-libdns_sd/ avahi-core/ avahi-libevent/
- use sudo zypper install avahi-compat-libdns_sd-devel
- run using gcc -o avahiexample avahiexample.c -lavahi-client -lavahi-common ./avahi_example
- output finally > avahi-browse -a
Resources
Other Resources
Keywords
- Avahi
- Network Connection
- mDNS
- Linux
- C/C++ Programming
- Hackweek
- Network Security
- Integration
This project is part of:
Hack Week 23
Activity
Comments
-
24 days ago by vojha | Reply
Scenario Overview
This scenario involves establishing a 1-to-1 connection between mobile devices (192.168.10.x network) and televisions (192.168.20.x network) through a Linux server acting as an intermediary. The goal is to allow specific mobile devices to discover and connect only to certain TVs, creating a controlled connection process between networks.
Problem and Objective
Avahi Disabled Scenario
When Avahi is disabled: - Mobile devices on the 192.168.10.x network cannot discover any TVs on the 192.168.20.x network.
Avahi Enabled Scenario
When Avahi is enabled: - All mobile devices can discover all TVs, allowing connections between any mobile and TV on the network.
Proposed Solution and Process
Create a C/C++ Program
The program will interface with Avahi, handling the detection and communication between mobile and TV networks. It identifies the source (mobile) and target (TV) IP addresses and manages mDNS queries.
Purpose of the C/C++ Program
When Avahi is disabled, the program will handle and manipulate mDNS queries, allowing a 1-to-1 connection. The program ensures controlled forwarding of packets between networks, establishing specific connections between mobile devices and TVs.
Steps to Implement
- Install and start the Avahi service.
- Create the C/C++ program to handle mDNS queries and unicast responses between the mobile and TV networks. The program will act as a proxy server, forwarding and restricting packets between the specified mobile and TV.
Testing Procedure
Validate the C program's functionality by sending mDNS queries from mobile devices and forwarding them to the TV network. Test and confirm that the forwarded responses are unicast and specific to the intended mobile device.
Desired Outcomes & Future Works
The desired outcome is to establish controlled 1-to-1 connections between specific mobile devices and TVs without Avahi automatically forwarding mDNS packets. This will ensure a restricted and secure network connection, allowing specific mobile devices to connect only to certain TVs.
Note: Ensure that Avahi doesn't automatically forward packets unless the integration program is actively running.
Result and Outcome
I was able to run a simple service publication.
Service Publication
Publishes a service named "MyService" of type "example.tcp" on all network interfaces and protocols (IPv4 and IPv6) on port 12345. This service can be discovered on the local network.
Output
The output indicates the successful publication of the service. When the service is successfully published, the
entry_group_callback
function is called, and it prints: "Service 'MyService' successfully published."To run the C program, use the following example:
gcc -o avahi_integration avahi_integration.c -lavahi-client -lavahi-common ./avahi_integration There are .sh files to install Avahi on Ubuntu, stop and start the daemon services as well, which makes life easier when testing different scenarios. Output En02 smart_tv found. bash Copy code $ ./avahi_integration Resolved service: Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa, _googlecast._tcp, local, a56831aa-ef2a-1db0-9c3f-d6b56ff217fa.local:8009 Resolved service: Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa, _googlecast._tcp, local, a56831aa-ef2a-1db0-9c3f-d6b56ff217fa.local:8009 ^C In another tab: bash Copy code avahi-browse -a Output: bash Copy code eno2 IPv6 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa _googlecast._tcp local eno2 IPv4 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa _googlecast._tcp local eno1 IPv4 dap2230 Web Site local eno2 IPv6 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa _googlecast._tcp local eno2 IPv6 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa _googlecast._tcp local eno2 IPv4 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa _googlecast._tcp local Client failure, exiting: Daemon connection failed. The message appeared when we stopped the Avahi daemon using sudo systemctl stop avahi-daemon. Note that the ./avahi_integration ELF file was running in another tab, and nothing happened.
-
24 days ago by vojha | Reply
Avahi Integration and Network Connection README
What is Avahi?
Avahi is a system that facilitates service discovery on a local network. It implements Zeroconf networking specifications, including mDNS (multicast Domain Name System) and DNS-SD (DNS-based Service Discovery). Avahi enables devices to automatically discover and utilize services on the local network without requiring manual configuration.
For more information, visit the Avahi website.
Run in SUSE Linux OpenSUSE Tumbleweed
The Avahi files were successfully installed on the system, and the following steps were performed:
cd /usr/include/avahi- avahi-client/ avahi-common/ avahi-compat-libdns_sd/ avahi-core/ avahi-libevent/ To compile and run the example program: bash Copy code gcc -o avahi_example avahi_example.c -lavahi-client -lavahi-common ./avahi_example To browse services: bash Copy code avahi-browse -a
-
24 days ago by vojha | Reply
All the programs and shell scripts
Everything is posted in github, feel free to check the codes and implement the same at your end. See you in next Hackweek
https://github.com/varunkojha/avahi-c
Desired Outcomes & Future Works
The desired outcome is to establish controlled 1-to-1 connections between specific mobile devices and TVs without Avahi automatically forwarding mDNS packets. This will ensure a restricted and secure network connection, allowing specific mobile devices to connect only to certain TVs.
-
Similar Projects
Deep Packet Inspection: compare the performance between libnetfilter_queue, NF_HOOK and eBPF XDP by nguyens
Deep Packet Inspection: compare the performan...
Extend GObject based introspectable API to libzypp by zbenjamin
[comment]: # (Please use the project descriptio...
80-bit floats support on x86_64 for Valgrind by mfranc
[comment]: # (Please use the project descriptio...
Port OTPClient to GTK >= 4.12 by pstivanin
Project Description
OTPClient is currentl...
Extract generic testing framework from Linux Test Project code base by acervesato
Project Description
The Linux Test Projec...
SMTGCC by fkastl
[comment]: # (Please use the project descriptio...
Port some classic game to Linux by MDoucha
Let's pick some old classic game, reverse engin...
HelenOS: <filesystem> of a down by jjindrak
During the previous Hackweek [0], I have succes...
Open Source Firmware for EV chargers using the ESP32 Chip (Autoaid / EN-Plus / EVSEDO) by bschmidt
[comment]: # (Please use the project descriptio...
Extend GObject based introspectable API to libzypp by zbenjamin
[comment]: # (Please use the project descriptio...
Testing and adding GNU/Linux distributions on Uyuni by juliogonzalezgil
Join the Gitter channel! [https://gitter.im/uy...
Linux incarnation of the Party Parrot by rsimai
Project Description
Lesser on the coding s...
Authenticated hashes for BTRFS by dsterba
Project Description
Implement a checksum ...
Generic text file preprocessor using custom syntax for define include ifdef by mdati
Project Description
Scope of this project...
Extract generic testing framework from Linux Test Project code base by acervesato
Project Description
The Linux Test Projec...
Parental controls on Tumbleweed/Aeon by fcrozat
[comment]: # (Please use the project descriptio...
Tumbleweed support for Raspberry Pi 4 with Quad SATA HAT by jbaier_cz
[comment]: # (Please use the project descriptio...
Tumbleweed on Mars-CM (RISC-V board) by ph03nix
RISC-V is awesome, Tumbleweed is awesome, choco...
Update Haskell ecosystem in Tumbleweed to GHC-9.6.x by psimons
[comment]: # (Please use the project descriptio...
Deep clean-up of the Uyuni documentation files by omaric
Project Description
This project is plann...
Test Results for openQA on GitHub by livdywan
Project Description
Jobs in openQA are us...
Collect flaky test cases identified by the team in a GitHub board and highlight them in the Test report by oscar-barrios
Project Description
Flaky tests: Th...