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

Looking for hackers with the skills:

c c++ avahi linux tumbleweed suse github

This project is part of:

Hack Week 23

Activity

  • 6 months ago: renxt0310 liked this project.
  • 6 months ago: vojha added keyword "c" to this project.
  • 6 months ago: vojha added keyword "c++" to this project.
  • 6 months ago: vojha added keyword "avahi" to this project.
  • 6 months ago: vojha added keyword "linux" to this project.
  • 6 months ago: vojha added keyword "tumbleweed" to this project.
  • 6 months ago: vojha added keyword "suse" to this project.
  • 6 months ago: vojha added keyword "github" to this project.
  • 6 months ago: vojha liked this project.
  • 6 months ago: vojha started this project.
  • 6 months ago: vojha originated this project.

  • Comments

    • vojha
      6 months 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

      1. Install and start the Avahi service.
      2. 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.
      

    • vojha
      6 months 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
      

    • vojha
      6 months 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.

    • vojha
      6 months ago by vojha | Reply

      GitHub Code add-emoji

    Similar Projects

    80-bit floats support on x86_64 for Valgrind by mfranc

    [comment]: # (Please use the project descriptio...


    The Missing Middle: Add an intermediate brightness setting for auxiliary LEDs in Andúril 2 by gkenion

    [comment]: # (Please use the project descriptio...


    Port OTPClient to GTK >= 4.12 by pstivanin

    Project Description

    OTPClient is currentl...


    Extend GObject based introspectable API to libzypp by zbenjamin

    [comment]: # (Please use the project descriptio...


    Extract generic testing framework from Linux Test Project code base by acervesato

    Project Description

    The Linux Test Projec...


    Open Source Firmware for EV chargers using the ESP32 Chip (Autoaid / EN-Plus / EVSEDO) by bschmidt

    [comment]: # (Please use the project descriptio...


    HelenOS: <filesystem> of a down by jjindrak

    During the previous Hackweek [0], I have succes...


    Extend GObject based introspectable API to libzypp by zbenjamin

    [comment]: # (Please use the project descriptio...


    Tungsten: A low-level LLVM programming language by mfriedrich

    Project Description

    > Tungsten is suppose...


    Port some classic game to Linux by MDoucha

    Let's pick some old classic game, reverse engin...


    Linux incarnation of the Party Parrot by rsimai

    Project Description

    Lesser on the coding s...


    Testing and adding GNU/Linux distributions on Uyuni by juliogonzalezgil

    Join the Gitter channel! [https://gitter.im/uy...


    Generic text file preprocessor using custom syntax for define include ifdef by mdati

    Project Description

    Scope of this project...


    Authenticated hashes for BTRFS by dsterba

    Project Description

    Implement a checksum ...


    Extract generic testing framework from Linux Test Project code base by acervesato

    Project Description

    The Linux Test Projec...


    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...


    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...