We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given this C program:
#include <netinet/in.h> #include <stdlib.h> #include <stdio.h> #include <string.h> int main(int argc, char * argv[]) { struct ipv6_mreq req; memset(&req, 0, sizeof(req)); req.ipv6mr_multiaddr.s6_addr[0] = 0xFF; req.ipv6mr_multiaddr.s6_addr[1] = 0x02; req.ipv6mr_multiaddr.s6_addr[15] = 0xFB; uint8_t * ptr = (uint8_t *)&req; for(int i = 0; i < sizeof(req); i++) { fprintf(stderr, "\\%#02x", ptr[i]); } fprintf(stderr, "\n"); return 0; }
The bytes of the ipv6_mreq struct are: \0xff\0x2\00\00\00\00\00\00\00\00\00\00\00\00\00\0xfb\00\00\00\00
ipv6_mreq
\0xff\0x2\00\00\00\00\00\00\00\00\00\00\00\00\00\0xfb\00\00\00\00
However, if I use this Ruby program:
require "ipaddr" p IPAddr.new("ff02::fb").hton
The bytes are: "\xFF\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFB"
"\xFF\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFB"
I think hton should match the ipv6_mreq layout.
hton
The text was updated successfully, but these errors were encountered:
btw I'm not confident that I'm debugging this correctly, but I think the bytes should be the same.
Sorry, something went wrong.
No branches or pull requests
Given this C program:
The bytes of the
ipv6_mreq
struct are:\0xff\0x2\00\00\00\00\00\00\00\00\00\00\00\00\00\0xfb\00\00\00\00
However, if I use this Ruby program:
The bytes are:
"\xFF\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFB"
I think
hton
should match theipv6_mreq
layout.The text was updated successfully, but these errors were encountered: