View previous topic :: View next topic |
Author |
Message |
Alexey Osipov
Joined: 02 May 2011 Posts: 5
|
Posted: Mon May 02, 2011 6:32 pm Post subject: [PATCH] Same-IP interfaces and runtime interface detection |
|
|
Hi, All!
First of all, thank you Thomas (and others?) for this great software!
I have made a couple of improvements to miniupnpd for meet my needs. It is a series of six patches, which adds next features:
1. Serve several LAN interfaces which all have same IP address.
Rationale: My Ubuntu-based server provides internet access for several users from my local network. Users connect to the server by means of PPtP and PPPoE tunnels. For every tunnel there is one PPP interface on the server. All user's PPP interfaces have the same IP address on the server. All users, surely, have different IP addresses. And everything works fine, except miniupnpd.
Old behavior: miniupnpd starts, opens one SSDP receive socket listening on ANY (0.0.0.0) address, add IP multicast membership for each LAN address specified in listening_ip config-file directives, opens SSDP notify and NAT-PMP sockets for each LAN address.
The problem: if there are several interfaces with same IP, miniupnpd adds multicast membership only to the first one, so the other interfaces just ignore SSDP traffic. Same with NAT-PMP 'public address change' notifications - it is sent only to the first interface from the group of same-ip interfaces.
New behavior: miniupnpd starts, opens one SSDP receive socket listening on ANY (0.0.0.0) address, gets the list of currently available network interfaces and add IP multicast membership for each interface from the list, which have an IP specified in listening_ip config-file directives, opens SSDP notify sockets for each LAN interface, opens NAT-PMP sockets for each LAN address. So all interfaces could accept SSDP traffic. When NAT-PMP 'public address change' notify emits, miniupnpd first set IP_MULTICAST_IF to correct interface, then send notification, and repeat for next interface.
2. Serve LAN interfaces, which was not exist during miniupnpd startup.
Rationale: The same as in 1. Users connects and disconnects during miniupnpd runs.
Old behavior: Shutdowned interfaces just disappeared from miniupnpd and produce some errors. New interfaces wasn't managed by miniupnpd.
New behavior: Shutdowned interfaces gracefully removed from miniupnpd. New interfaces (if their addresses specified in config file) become served by miniupnpd.
3. Hard limit on LAN interfaces count was removed, because you don't know how many interfaces there will be in runtime.
-------------
Because this dumb forum not allowing to upload files nor posting links unless you have one post, the link to the patches will be in the next post.
0001-Cosmetic-changes.patch
Some cosmetic changes like fixing line indents, removing extra tabs and spaces. Nothing serious.
0002-Remove-lan-addresses-limit-by-changing-storage-type-.patch
Change static array lan_addrs storage to dynamic linked list. The is the effective way to remove hard limit on LAN addresses count.
0003-Add-function-getifs-to-get-list-of-currently-availab.patch
Add a function getifs() which returns an array of currently available network interfaces.
0004-Separate-semantics-of-lan-address-and-lan-interface.patch
Implementation of feature 1. Create separate lan_iface_s structure for each network interface.
0005-Selection-of-multicast-interface-by-separate-functio.patch
Make sure that NAT-PMP 'public address change' notifications are sent from correct interface and for all clients.
0006-Runtime-network-interfaces-detection-Linux-only.patch
Runtime detection of new and removed network interfaces. Uses RTNETLINK socket. Seems to be Linux-only.
I will be glad, if this work will be accepted by upstream.
I'm also ready for discuss.
Alexey.
--------------
Some offtopic:
1. Is there only one author of this software? I mean the absence of AUTHORS file...
2. Do you use some public source version control system, where one can get the latest sources? |
|
Back to top |
|
|
Alexey Osipov
Joined: 02 May 2011 Posts: 5
|
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1593
|
Posted: Fri May 06, 2011 8:30 am Post subject: |
|
|
thank you for your work.
I'll have a look at it to put it uptream
I'm currently working on IPv6 support.
about the authors, yep, there should be an AUTHORS file, but there is (should be?) an author line in the header of each source file, so you can add your name there !
I use my private CVS for quite a long time (6 years). It has been envisaged to switch to a private SVN or GIT, but still not done _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
Alexey Osipov
Joined: 02 May 2011 Posts: 5
|
Posted: Fri May 06, 2011 9:39 am Post subject: |
|
|
miniupnp wrote: | thank you for your work.
I'll have a look at it to put it uptream
|
Cool
miniupnp wrote: |
about the authors, yep, there should be an AUTHORS file, but there is (should be?) an author line in the header of each source file, so you can add your name there !
|
Already done. I have put my name at the top of new files I created - ifacewatcher.c and ifacewatcher.h. But still, it could be nice to have an AUTHORS file. You can then reference AUTHORS file in your LICENSE file to mention the fact that the project have contributions from several people.
miniupnp wrote: |
I use my private CVS for quite a long time (6 years). It has been envisaged to switch to a private SVN or GIT, but still not done
|
I see. Try git. It's more suitable for decentralized development than svn. In any case, public SVC may attract new developers to the project. And, applying 3d-party patches will be more easy for you. |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1593
|
Posted: Fri May 06, 2011 9:53 am Post subject: |
|
|
Alexey Osipov wrote: |
miniupnp wrote: |
I use my private CVS for quite a long time (6 years). It has been envisaged to switch to a private SVN or GIT, but still not done
|
I see. Try git. It's more suitable for decentralized development than svn. In any case, public SVC may attract new developers to the project. And, applying 3d-party patches will be more easy for you. |
sorry should have written "... envisaged to switch to a public SVN or GIT ..." _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1593
|
|
Back to top |
|
|
Alexey Osipov
Joined: 02 May 2011 Posts: 5
|
Posted: Wed Sep 28, 2011 7:12 am Post subject: |
|
|
Wow! Great news.
But... there is only a client app. Will you publish source code of miniupnpd on github too? |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1593
|
Posted: Wed Sep 28, 2011 7:09 pm Post subject: |
|
|
Alexey Osipov wrote: |
Wow! Great news.
But... there is only a client app. Will you publish source code of miniupnpd on github too? |
yep sorry, I ran out of time yesterday ... I should be ok now _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
Alexey Osipov
Joined: 02 May 2011 Posts: 5
|
Posted: Wed Sep 28, 2011 7:59 pm Post subject: |
|
|
miniupnp wrote: |
yep sorry, I ran out of time yesterday ... I should be ok now |
Okay, it's ok now. I will adapt my patches to current git master in near feature. I let you know, when I finish. |
|
Back to top |
|
|
caketreats
Joined: 28 Oct 2011 Posts: 2
|
Posted: Wed Nov 09, 2011 11:12 am Post subject: |
|
|
Thanks for all the information you provided above. I'm trying to set up a new work station for my team and our IT person has been working on it for 3 days straight already. I'll let him see all these notes and hopefully see progress. God bless! |
|
Back to top |
|
|
|