Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dvolodin7 opened this issue Mar 26, 2023 · 1 comment
Open

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

dvolodin7 opened this issue Mar 26, 2023 · 1 comment

Comments

@dvolodin7
Copy link

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.

@dvolodin7 dvolodin7 changed the title IPv6 TCLASS support Support for setting/getting IPv6 TCLASS on socket level Mar 26, 2023
@Thomasdezeeuw
Copy link
Collaborator

Same as #418 (comment), prs are welcome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants