IPv6 hton layout does not match ipv6_mreq
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 82
- Forks
- 42
- Avg merge
- 2h 24m
- Merged PRs (30d)
- 3
Description
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
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"
I think hton should match the ipv6_mreq layout.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names IPAddr#hton and the C ipv6_mreq structure; start by locating the hton implementation and existing tests in the ipaddr repository, then compare the two representations' byte lengths and layouts. Done means the expected relationship between hton and ipv6_mreq is decided and documented by a regression test or a clearly justified behavior change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, ruby
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 46/100