[nanomsg] do you use the cmsg API?

  • From: "Garrett D'Amore" <garrett@xxxxxxxxxx>
  • To: "nanomsg@xxxxxxxxxxxxx" <nanomsg@xxxxxxxxxxxxx>
  • Date: Mon, 16 Nov 2015 12:14:02 -0800

I’ve found what I believe is a serious problem with the way the cmsg API is
used within libnanomsg. Basically, the SP headers that are stored there do
not include a correct length, only a “stored” length, which includes
padding for alignment.

Unfortunately, this breaks some things that use them, like the nn_device()
API.

(Btw, it was *not* easy to track this down.)

I think I’m going to need to change the cmsg implementation somewhat — in
particular in order for this to work I need to add a length field. This
can be added to the cmsg header structure, or I can embed it in the payload
for the SP header.

To be honest, I don’t have a strong opinion about which way to go.

Here are the pros & cons:

* Changing the payload to inject a size ahead of the payload won’t affect
anything other than the SP_HDR portion.
* However changing the payload WILL break any code that currently relies on
the contents of the SP_HDR.

If you use the CMSG API with nanomsg, please take a moment to let me know
your thoughts. I’m interested to know how you’re using it (what CMSG
options are using it for), and if you have an opinion about either way.

I need to make a decision on this asap. This is now a blocker for 0.8.

- Garrett

Other related posts: