upstart-socket-bridge doesn't support ipv6 sockets

Bug #942955 reported by Steve Langasek
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
upstart
Fix Committed
Undecided
Unassigned
upstart (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Playing with upstart-socket-bridge to see if it's a solution for avoiding polling in the Ubuntu cups post-start (bug #855010), I find that the socket bridge only supports inet and unix sockets - it does not support inet6 sockets. As a result, it's impossible to use socket initialization for an ipv6 service... which nowadays should be approximately all services.

If we want socket initialization to be a viable option for services, ipv6 support is a must.

Related branches

Steve Langasek (vorlon)
Changed in upstart (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Steve Langasek (vorlon)
Changed in upstart (Ubuntu):
assignee: nobody → James Hunt (jamesodhunt)
Revision history for this message
Kai Mast (kai-mast) wrote :

Just wondering. I am not familiar with the upstart codebase, but this seems rather trivial to fix. Where is the problem here?

Revision history for this message
Dimitri John Ledkov (xnox) wrote : Re: [Bug 942955] Re: upstart-socket-bridge doesn't support ipv6 sockets

On 31 December 2013 13:20, Kai Mast <email address hidden> wrote:
> Just wondering. I am not familiar with the upstart codebase, but this
> seems rather trivial to fix. Where is the problem here?
>

The whole upstart socket bridge is a single C file in the upstart codebase:

https://bazaar.launchpad.net/+branch/upstart/view/head:/extra/upstart-socket-bridge.c

As the rest of the code base it heavily uses libnih library. Some
introduction / documentation about that library can be found at:

http://people.canonical.com/~jhunt/presentations/uds-r/2012-10-31/upstart-development.pdf

http://libnih.la/

--
Regards,

Dimitri.

Revision history for this message
Kai Mast (kai-mast) wrote :

Thanks for the info Dimitri.
I looked at the code and still think this can be resolved by adding a case for AF_INET6 to both switches.

Sadly, I have no idea how to test/debug upstart. Otherwise, I would definitly give this a try...

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

@Kai Mast
According to /sys/socket.h definition:
http://unix.superglobalmegacorp.com/Net2/newsrc/sys/socket.h.html

there isn't AF_INET6 declarations.

In "Address families" section there are only:
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Latest sys/socket.h is described here:
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html

And there are AF_INET6 declaration.
Sorry for cofusion.

Revision history for this message
Kai Mast (kai-mast) wrote :

The linked branch builds now. I cannot find any tests for upstart socket bride, so I don't really now how to verify it is working. Any help?

Btw, here is a good tutorial how to convert code to IPv6: http://uw714doc.sco.com/en/SDK_netapi/sockC.PortIPv4appIPv6.html

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

I look at your code and here is my remarks:
1. Line 335:
  char buffer[INET6_ADDRSTRLEN];
use nih_local. It shoul looks like:
  nih_local char buffer[INET6_ADDRSTRLEN];

2. Line 72, 73
  Add comment with description of the variables sin6_addr and sin_addr

3. Line 539-546
  Fix identation. You could follow Coding style section in HACKING file

4. Update ChangeLog file

5. Update man files (with additional examples of the IPv6 usage) in directory: extra/man/

Changed in upstart:
status: New → In Progress
Revision history for this message
Cameron Norman (cameronnemo) wrote :

So I made those tweaks you recommended, Bartosz.

Kai, you should install Ubuntu in a VM, install your Upstart branch from source, then write job that uses IPv6.

Revision history for this message
Kai Mast (kai-mast) wrote :

Thanks for picking this up cameron. Seem like you already tested it. Does it work?

Well, I was hoping there are some kind of unit tests for this.

James Hunt (jamesodhunt)
Changed in upstart (Ubuntu):
assignee: James Hunt (jamesodhunt) → nobody
Changed in upstart:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.