GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Service discovery on specific IPv6 interface · Issue #1132 · python-zeroconf/python-zeroconf

Service discovery on specific IPv6 interface #1132

New issue
Copy link
New issue
Copy link
Open
Open
Service discovery on specific IPv6 interface#1132
Copy link

Description

@lokesh2019
lokesh2019
opened on Feb 15, 2023
Issue body actions

Not sure if this is a bug or I am using the API wrong. Please advise. This is all IPv6-only network.
I have a host with say three network interfaces : eth0, eth1 and eth2 - and I want to listen to advertisements coming only from eth1.

My service listener is based on browser.py example. The api calls look something like this:

class ZeroconfListener:
    """Class for zeroconf to populate"""

    def remove_service(self, _zeroconf, service_type, name):
        """Called when zeroconf when a service is nolonger available"""
       do stuff

    def add_service(self, zeroconf, service_type, name):
        """Called when zeroconf when a service becomes available"""
        do stuff

    def update_service(self, *_):
        """Called internally by Zeroconf."""
        not needed. do nothing

zeroconf = Zeroconf(ip_version=IPVersion.V6Only, interfaces=[addr_of_eth1])
services = ["_device-info._tcp.local."]
ServiceBrowser(zeroconf, services, ZeroconfListener())

while True: # wait forever
    time.sleep(60)

The problem is, I only want to listen to advertisements coming from eth1 but this seems to listen to all the interfaces. I can verify this by publishing a _device-info._tcp.local service from a machine connected on eth0 subnet. I suspect that is because I am not using unicast argument when initialising Zeroconf class, and this line puts a listener on all the interfaces:

python-zeroconf/src/zeroconf/_utils/net.py

Line 358 in 18b3cd7

listen_socket = new_socket(ip_version=ip_version, apple_p2p=apple_p2p, bind_addr=('',))

TL;DR Question is, how do I restrict zeroconf to a specific interface? Is this a supported use case?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.