IPv6 hton layout does not match ipv6_mreq
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 46/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Domain
- networking
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.
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.
- Dominant language
- Ruby
- Stars
- 82
- Forks
- 42
- Avg merge
- 2h 24m
- Merged PRs (30d)
- 3
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.
More from ruby/ipaddr
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bensheldon/good_job#1816 · 5 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·