> On Feb 2, 2024, at 11:07 PM, Jesus Cea <[email protected]> wrote:
>
> I am using IPv6 and I noticed that by default SmartOS uses a flow label of 0
> (no flow label) in its IPv6 datagrams. I wonder how could I enable the use of
> flow labels in order to be more compatible with for example, load balancers
> (that hash (origin ip, destination ip, flowlabel) to route to a backend
> server). For example, as described in
> https://datatracker.ietf.org/doc/rfc7098/
Perhaps by filling in the flow information in sockaddr_in6?
/*
* IPv6 socket address.
*/
struct sockaddr_in6 {
sa_family_t sin6_family;
in_port_t sin6_port;
uint32_t sin6_flowinfo;
struct in6_addr sin6_addr;
uint32_t sin6_scope_id; /* Depends on scope of sin6_addr */
uint32_t __sin6_src_id; /* Impl. specific - UDP replies */
};
/*
* Macros for accessing the traffic class and flow label fields from
* sin6_flowinfo.
* These are designed to be applied to a 32-bit value.
*/
#ifdef _BIG_ENDIAN
/* masks */
#define IPV6_FLOWINFO_FLOWLABEL 0x000fffffU
#define IPV6_FLOWINFO_TCLASS 0x0ff00000U
#else /* _BIG_ENDIAN */
/* masks */
#define IPV6_FLOWINFO_FLOWLABEL 0xffff0f00U
#define IPV6_FLOWINFO_TCLASS 0x0000f00fU
#endif /* _BIG_ENDIAN */
Try that on your apps that connect or sendto()?
> PS: I have been bumping against this issue when accessing to a farm of dns
> servers, where my Illumos machines are being hitting the same backend server
> because flowlabel=0, while linux clients are spread to all backend servers
> because flowlabel=random.
If you are using pre-compiled software, that could be a useful RFE to have 0 ==
random if a IP netstack parameter is set. (I'm curious how BSD and Linux do
this?)
Dan
------------------------------------------
illumos: illumos-discuss
Permalink:
https://illumos.topicbox.com/groups/discuss/Tf37a59e0bc93f2a7-M5448d1d05188981dd95e96cb
Delivery options: https://illumos.topicbox.com/groups/discuss/subscription