List Info

Thread: Untested interface limitation patch




Untested interface limitation patch
country flaguser name
Russian Federation
2008-05-11 14:27:10
Hi,


Yesterday I proposed a patch on to limit avahi to a specific
interface 
based on the source address when opening each socket. As a
real Michael 
Niedermayer, Sjoerd shot the patch on sight and suggested an
interface 
based approach.

This patch tries to accomplish to limit the used interfaces
based on a 
user defined list in the daemon configuration file. The idea
would be if 
the list is not defined, it will just process every found
interface, if 
the list is present, it will iterate over the list for every
found 
interface. A todo is clean the list from duplicates.

The patch compiles on svn, but I have not yet tested it.
Open for more 
feedback!


Signed-off-by: Stefan de Konink <dekoninkkinkrsoftware.nl>


Yours Sincerely,

Stefan de Konink

_______________________________________________
avahi mailing list
avahilists.freedesktop.org
h
ttp://lists.freedesktop.org/mailman/listinfo/avahi

  
Re: Untested interface limitation patch
country flaguser name
Russian Federation
2008-05-11 16:45:31
Hey,


On Sun, 11 May 2008, Lennart Poettering wrote:

 > > I am confused.

Nvm, ffmpeg-devel insiders joke.

 >> > > This patch tries to accomplish to limit
the used interfaces 
based on a user
 >> > > defined list in the daemon configuration
file. The idea would be 
if the
 >> > > list is not defined, it will just
process every found interface, 
if the
 >> > > list is present, it will iterate over
the list for every found 
interface. A
 >> > > todo is clean the list from duplicates.
 > >
 > > I am mostly happy for the patch. Before I'll
merge I'd however ask
 > > you to rename the option to something to
"interface-allow" or
 > > "allow-interfaces" or so. I'd consider
"bind-interfaces" misleading,
 > > since this suggests that some kind of bind() is
involved here, which
 > > however is not the case.
 > >
 > > I'd prefer if we'd also get an interface
blacklist at the same time
 > > as a whitelist, but that wouldn't hinder me to
merge your
 > > patch. (i.e. "deny-interfaces" would be
cool in addition to
 > > "allow-interface").

I'll do this too then. Since it is the same function. What
would be the
resolve scenario? First deny then allow?


 >> > > -int
avahi_interface_is_relevant(AvahiInterface *i) {
 >> > > +static int
avahi_interface_is_relevant_iter(AvahiInterface *i) {
 > >
 > > Hmm, why did you call this "_iter"? I
see no iterator involved here */

Basically because of the function under it. Any good hints?
_static,
_private, _child?

 >> > >      AvahiInterfaceAddress *a;
 >> > >
 >> > > -    assert(i);
 >> > > +    assert(i); // Not really required
 > >
 > > Hehe, *no* assert is really required.

It is already done by its parent. (The function under it
that was 
actually the added code, and nobody should call this static
one anyway)

 > > Also /me doesn't like C++ style
 > > comments. So please leave this as it is right
now. /me likes
 > > paranoid asserts.
 > >
 > > /* This is C */
 > >
 > > // this is C++

As you wish  ;)


 > > Hmm, avahi_server_config_free() needs updating,
too.
 > >
 > > And finally, man/avahi-daemon.conf.5.xml.in and
 > > avahi-daemon/avahi-daemon.conf need updating as
well.

I guess I missed that  

 > > Otherwise I am happy, no further nitpicking  

Since nobody tested the patch on working I hope you will
volunteer  ;)

 > > Thanks for your patch!

You're welcome. A little nitpicking on my own... in my
private network 
at home I get very annoyed by Avahi just guessing my SSH
port is at 22, 
would it be possible to check this before advertising?


Yours Sincerely,

Stefan de Konink
_______________________________________________
avahi mailing list
avahilists.freedesktop.org
h
ttp://lists.freedesktop.org/mailman/listinfo/avahi

Re: Untested interface limitation patch
country flaguser name
Germany
2008-05-11 15:35:24
On Sun, 11.05.08 23:27, Stefan de Konink (avahiml.kinkrsoftware.nl) wrote:

Hi!

> Yesterday I proposed a patch on to limit avahi to a
specific interface 
> based on the source address when opening each socket.
As a real Michael 
> Niedermayer, Sjoerd shot the patch on sight and
suggested an interface 
> based approach.

I am confused.

> This patch tries to accomplish to limit the used
interfaces based on a user 
> defined list in the daemon configuration file. The idea
would be if the 
> list is not defined, it will just process every found
interface, if the 
> list is present, it will iterate over the list for
every found interface. A 
> todo is clean the list from duplicates.

I am not sure it is really necessary to filter out dupes. If
there are
dupes it doesn't have any impact on the logic, so if the
user likes to
waste some memory he is welcome to do so, but i wouldn't
really shed a
tear about that. I mean, if I as the maintainer of Avahi
would have
coded this I'd have been too lazy to add the filtering code
here, and you
could even argue that having this complicates the code for
no real
benefit.

I am mostly happy for the patch. Before I'll merge I'd
however ask you
to rename the option to something to
"interface-allow" or
"allow-interfaces" or so. I'd consider
"bind-interfaces" misleading,
since this suggests that some kind of bind() is involved
here, which
however is not the case.

I'd prefer if we'd also get an interface blacklist at the
same time
as a whitelist, but that wouldn't hinder me to merge your
patch. (i.e. "deny-interfaces" would be cool in
addition to
"allow-interface").

> -int avahi_interface_is_relevant(AvahiInterface *i) {
> +static int
avahi_interface_is_relevant_iter(AvahiInterface *i) {

Hmm, why did you call this "_iter"? I see no
iterator involved here */

>      AvahiInterfaceAddress *a;
>      
> -    assert(i);
> +    assert(i); // Not really required

Hehe, *no* assert is really required. Also /me doesn't like
C++ style
comments. So please leave this as it is right now. /me likes
paranoid asserts.

/* This is C */

// this is C++


Hmm, avahi_server_config_free() needs updating, too.

And finally, man/avahi-daemon.conf.5.xml.in and
avahi-daemon/avahi-daemon.conf need updating as well.

Otherwise I am happy, no further nitpicking 

Thanks for your patch!

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lenn
art/           GnuPG 0x1A015CC4
_______________________________________________
avahi mailing list
avahilists.freedesktop.org
h
ttp://lists.freedesktop.org/mailman/listinfo/avahi

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )