Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5986549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:41:14+00:00 2026-05-22T22:41:14+00:00

I’m trying to write a little program that will add mDNS CNAME aliases to

  • 0

I’m trying to write a little program that will add mDNS CNAME aliases to my Linux device, so that it can be accessed via more than one “something.local.” domain name.

This program’s intended function is the same as the avahi-aliases Python script, but in order to avoid a Python dependency, I’m trying to implement it in C++ instead.

I’ve based my code (for now) on the client-publish-service.c example that is included in the Avahi source distribution. When I run that example unchanged, it works as expected: in particular, I see “MegaPrinter” show up in Bonjour Browser on my Mac, etc.

My next step is to modify the example code to add a CNAME record instead of adding services. So I #ifdef out the avahi_entry_group_add_service() calls and put this in instead:

 const int TTL = 60;

 char rdata[] = "\0msli-10135114\0local";   // "msli10135114.local." is the device's normal FQDN, which I want to make aliases to
 rdata[0]   = 13;
 rdata[14]  = 5;

 printf("rdata=[%s] _moduleName=[%s]\n", rdata, _moduleName);
 printf("add_record: %s\n", avahi_strerror(avahi_entry_group_add_record (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, (AvahiPublishFlags)0, "TestX", 0x01, 0x10, 120, "\5booya", 6)));

 if ((ret = avahi_entry_group_add_record(
    group,                 //AvahiEntryGroup *group,
    AVAHI_IF_UNSPEC,       //AvahiIfIndex interface,
    AVAHI_PROTO_UNSPEC,    //AvahiProtocol protocol,
    (AvahiPublishFlags)0,  //AvahiPublishFlags flags,
    _moduleName,           //const char *name,
    AVAHI_DNS_CLASS_IN,    //uint16_t clazz,
    AVAHI_DNS_TYPE_CNAME,  //uint16_t type,
    TTL,                   //uint32_t ttl,
    rdata,                 //const void *rdata,
    sizeof(rdata)          //size_t size
    )) < 0)
 {
    if (ret == AVAHI_ERR_COLLISION) goto collision;
    fprintf(stderr, "Failed to add module record: %s\n", avahi_strerror(ret));
    goto fail;
 }

…. but it doesn’t work; in particular, running the routine only gives me this output:

msli-10135114local] _moduleName=[Wild-Tracks-1]
add_record: Not supported 
Failed to add module record: Not supported

What’s strange is, not only does my own call to avahi_entry_group_add_record() fail with code AVAHI_ERR_NOT_SUPPORTED, but also my throw-away test call (inside the printf(“add_record”)) also fails with the same error code. But that call is copied verbatim out of the avahi-client/client-test.c file that comes with Avahi, so it seems like it should be a valid call.

Can anyone suggest why these calls might be failing, or what I am doing wrong here?

In case it helps, the complete source code for the test is here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:41:15+00:00Added an answer on May 22, 2026 at 10:41 pm

    I finally figured this one out… the problem was that the (AvahiPublishFlags) argument to avahi_entry_group_add_record needed to include the AVAHI_PUBLISH_USE_MULTICAST bit, not just be zero. Oddly enough, the Python script I used as an example didn’t include that bit.

    In any case, a working version of the source code is here, in case anyone is interested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.