<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Trebuchet MS";
panose-1:2 11 6 3 2 2 2 2 2 4;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p><b><span style='font-size:9.0pt;font-family:"Trebuchet MS","sans-serif";color:#AAAAAA'>Dell Customer Communication</span></b><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Greetings,</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>We would like to add to the Avahi service file functionality by adding an “interface” attribute to restrict mDNS announcements on a per interface basis. This would allow a system with multiple interfaces and/or vlans to only advertise certain services on certain network paths. <o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#1F497D'>If the service file does not contain the new attribute, Avahi still performs the existing behavior of publishing on all interfaces.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>[PATCH]<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Description: Add interface attribute for Avahi service files. If present, <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>the service or sub-type will publish only on the specified interface. If <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>not present the default behavior of publishing on all interfaces is unchanged.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>The value for this attribute is the system ifname. If the interface is invalid,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>the service is not published and an error is logged.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Author: Charles_Claggett@dell.com<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Index: 0.6.31-r11.1/avahi-0.6.31/avahi-daemon/static-services.c<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>===================================================================<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>--- 0.6.31-r11.1.orig/avahi-0.6.31/avahi-daemon/static-services.c<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+++ 0.6.31-r11.1/avahi-0.6.31/avahi-daemon/static-services.c<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -21,6 +21,7 @@<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> #include <config.h><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> #endif<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+#include <net/if.h><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> #include <sys/stat.h><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> #include <glob.h><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> #include <limits.h><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -60,6 +61,7 @@ struct StaticService {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> char *host_name;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> uint16_t port;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> int protocol;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ int interface;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> AvahiStringList *subtypes;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -122,6 +124,7 @@ static StaticService *static_service_new<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> s->type = s->host_name = s->domain_name = NULL;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> s->port = 0;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ s->interface = AVAHI_IF_UNSPEC;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> s->protocol = AVAHI_PROTO_UNSPEC;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> s->txt_records = NULL;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -256,7 +259,7 @@ static void add_static_service_group_to_<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> if (avahi_server_add_service_strlst(<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> avahi_server,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> g->entry_group,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>- AVAHI_IF_UNSPEC, s->protocol,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ s->interface, s->protocol,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> 0,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> g->chosen_name, s->type, s->domain_name,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> s->host_name, s->port,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -273,7 +276,7 @@ static void add_static_service_group_to_<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> if (avahi_server_add_service_subtype(<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> avahi_server,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> g->entry_group,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>- AVAHI_IF_UNSPEC, s->protocol,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ s->interface, s->protocol,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> 0,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> g->chosen_name, s->type, s->domain_name,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> (char*) i->text) < 0) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -305,6 +308,7 @@ typedef enum {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> XML_TAG_DOMAIN_NAME,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> XML_TAG_HOST_NAME,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> XML_TAG_PORT,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ XML_TAG_INTERFACE,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> XML_TAG_TXT_RECORD<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> } xml_tag_name;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -402,6 +406,11 @@ static void XMLCALL xml_start(void *data<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> goto invalid_attr;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> u->current_tag = XML_TAG_PORT;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "interface") == 0) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ if (attr[0])<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ goto invalid_attr;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ u->current_tag = XML_TAG_INTERFACE;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "txt-record") == 0) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> if (attr[0])<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> goto invalid_attr;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -473,6 +482,23 @@ static void XMLCALL xml_end(void *data, <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ case XML_TAG_INTERFACE: {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ int interface;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ assert(u->service);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ interface = (int) if_nametoindex(u->buf);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ if(interface < 1) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ avahi_log_error("%s: parse failure: invalid interface specification \"%s\".", u->group->filename, u->buf);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ u->failed = 1;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ return;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ u->service->interface = interface;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ u->current_tag = XML_TAG_SERVICE;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> case XML_TAG_TXT_RECORD: {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> assert(u->service);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>@@ -550,6 +576,7 @@ static void XMLCALL xml_cdata(void *data<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> case XML_TAG_PORT:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>+ case XML_TAG_INTERFACE:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> case XML_TAG_TXT_RECORD:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> case XML_TAG_SUBTYPE:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'> assert(u->service);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>