Marc-Antoine Perennou
57827c087c
fix in_addr_prefix_intersect for 32bits
...
shifting from a non fixed number of bits >= to the size of the type
leads to weird results, handle the special case of << 32 to fix it.
This was causing a test failure from test-socket-util:
Assertion 'in_addr_prefix_intersect(f, &ua, apl, &ub, bpl) == result' failed at
/var/tmp/paludis/build/sys-apps-systemd-scm/work/systemd-scm/src/test/test-socket-util.c:147, function
test_in_addr_prefix_intersect_one(). Aborting.
Minimal reproducer:
paludisbuild@Lou /tmp $ cat test.c
static void test(unsigned m) {
unsigned nm = 0xFFFFFFFFUL << (32-m);
printf("%u: %x\n", m, nm);
}
int main (void) {
test(1);
test(0);
return 0;
}
paludisbuild@Lou /tmp $ gcc -m32 -std=gnu99 test.c -o test32
paludisbuild@Lou /tmp $ ./test32
1: 80000000
0: ffffffff
paludisbuild@Lou /tmp $ gcc -std=gnu99 test.c -o test64
paludisbuild@Lou /tmp $ ./test64
1: 80000000
0: 0
2014-06-22 12:26:09 -04:00
..
2014-02-12 18:30:36 +01:00
2014-02-26 02:19:28 +01:00
2014-03-04 10:04:50 -05:00
2014-06-19 00:00:24 +02:00
2014-02-19 17:53:50 +01:00
2014-02-26 02:19:28 +01:00
2014-02-26 02:19:28 +01:00
2014-03-04 21:06:05 +01:00
2014-03-04 21:06:05 +01:00
2014-05-15 15:29:58 +02:00
2014-04-24 09:23:54 +02:00
2014-05-05 21:19:06 +02:00
2014-05-05 21:19:06 +02:00
2014-02-12 03:02:09 +01:00
2014-03-10 20:35:52 +01:00
2014-02-19 17:53:50 +01:00
2014-05-24 10:45:44 +08:00
2014-02-23 01:53:40 +01:00
2014-02-23 01:53:40 +01:00
2014-03-25 04:08:16 +01:00
2014-06-04 11:13:08 +02:00
2014-06-01 08:49:33 +02:00
2014-04-23 19:06:39 +02:00
2014-05-15 15:29:58 +02:00
2014-02-17 15:49:21 +01:00
2014-05-21 09:36:49 +09:00
2014-03-14 01:49:44 +01:00
2014-05-24 10:26:33 +08:00
2014-05-24 10:26:33 +08:00
2014-06-13 13:26:32 +02:00
2014-06-13 13:26:32 +02:00
2014-06-20 00:10:47 -04:00
2014-05-26 20:12:19 +02:00
2014-04-28 08:15:50 +02:00
2014-06-20 00:20:35 +02:00
2014-06-19 19:36:08 +02:00
2014-05-15 15:29:58 +02:00
2014-03-19 16:25:11 +01:00
2014-01-20 21:28:37 +01:00
2014-03-07 04:31:26 +01:00
2014-01-12 19:41:57 +08:00
2014-01-12 19:41:57 +08:00
2014-05-25 11:23:35 +08:00
2014-05-25 11:23:35 +08:00
2014-06-05 13:09:46 +02:00
2014-06-05 13:09:46 +02:00
2014-03-18 19:31:34 +01:00
2014-06-22 00:45:15 +02:00
2014-04-12 17:23:13 -04:00
2014-03-06 04:00:41 +01:00
2014-03-14 15:12:48 +01:00
2014-05-15 00:43:44 +02:00
2014-05-15 00:43:44 +02:00
2014-06-20 00:10:47 -04:00
2014-06-17 02:43:43 +02:00
2014-06-10 22:48:56 +02:00
2014-04-23 19:06:38 +02:00
2014-05-06 13:07:15 +02:00
2014-06-17 02:43:44 +02:00
2014-02-17 02:26:22 -05:00
2014-03-17 18:35:48 +01:00
2014-03-17 18:35:48 +01:00
2014-05-22 11:44:03 +09:00
2014-06-16 15:22:46 +02:00
2014-06-20 22:05:43 -04:00
2014-06-10 23:42:16 +02:00
2014-06-10 23:42:16 +02:00
2013-12-23 02:55:06 +01:00
2013-12-23 02:55:06 +01:00
2014-03-13 04:17:37 +01:00
2014-03-24 03:22:44 +01:00
2014-06-20 00:10:46 -04:00
2014-05-15 15:29:58 +02:00
2014-06-20 00:10:46 -04:00
2014-06-20 00:10:46 -04:00
2014-02-21 18:42:14 +01:00
2014-05-13 22:08:13 +02:00
2014-05-13 22:08:13 +02:00
2014-02-18 22:14:00 +01:00
2014-02-18 22:14:00 +01:00
2013-12-22 21:12:25 +01:00
2013-12-22 21:12:25 +01:00
2014-06-22 00:45:15 +02:00
2014-05-28 17:36:40 +08:00
2014-02-24 17:37:41 +01:00
2014-06-22 00:45:15 +02:00
2014-06-22 12:26:09 -04:00
2014-06-18 18:28:29 +02:00
2014-03-18 19:31:34 +01:00
2014-03-05 19:03:10 +01:00
2014-03-19 00:54:41 +01:00
2014-02-24 19:24:14 -05:00
2014-05-22 11:44:03 +09:00
2014-06-19 17:29:39 +02:00
2014-04-13 17:12:14 -07:00
2014-06-17 01:24:03 +02:00
2013-12-26 15:49:54 -05:00
2014-04-05 00:42:01 -04:00
2014-04-05 00:42:01 -04:00
2014-06-20 22:44:01 -04:00
2014-06-18 00:09:46 +02:00
2014-03-14 21:27:33 +01:00
2014-03-14 21:27:33 +01:00
2014-06-10 18:16:47 +02:00
2014-02-24 13:26:44 +01:00
2014-03-18 19:31:34 +01:00
2014-06-06 19:41:24 +02:00
2014-06-06 19:41:24 +02:00