Skip to content

Support for setting/getting IPv6 TCLASS on socket level #420

Closed
@dvolodin7

Description

@dvolodin7

tclass is the IPv6 counterpart to IPv4's tos field.

We can implement IPv6 methods just like Socket::tos and Socket::set_tos

    pub fn set_tclass(&self, tclass: u32) -> io::Result<()> {
        unsafe { setsockopt(self.as_raw(), sys::IPPROTO_IPV6, sys::IPV6_TCLASS, tclass as c_int) }
    }
    pub fn tclass(&self) -> io::Result<u32> {
        unsafe {
            getsockopt::<c_int>(self.as_raw(), sys::IPPROTO_IPV6, sys::IPV6_TCLASS).map(|tclass| tclass as u32)
        }
    }

IPV6_CLASS option is defined in RFC3542.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions