- // FIXME: left for bit-wizard rich
- memset(&sa->sin6_addr, -1, sizeof(sa->sin6_addr));
+ unsigned char* hb = sa->sin6_addr.s6_addr;
+ unsigned onebytes = prefix_length / 8;
+ unsigned bits = prefix_length % 8;
+ unsigned nullbytes = 16 - onebytes;
+ memset(hb, -1, onebytes);
+ memset(hb+onebytes, 0, nullbytes);
+ if(bits) {
+ unsigned char x = -1;
+ x <<= 8 - bits;
+ hb[onebytes] = x;
+ }