debian/patches/0007-static-EAM.patch: refresh patch by quilt.
Benda Xu
4 years ago
12 | 12 | conffile.c | 40 +++++++++++++++++++++++++++++++++++++--- |
13 | 13 | 2 files changed, 60 insertions(+), 9 deletions(-) |
14 | 14 | |
15 | diff --git a/addrmap.c b/addrmap.c | |
16 | index 7a4bf8b..24926d8 100644 | |
17 | 15 | --- a/addrmap.c |
18 | 16 | +++ b/addrmap.c |
19 | @@ -22,10 +22,6 @@ extern time_t now; | |
17 | @@ -22,10 +22,6 @@ | |
20 | 18 | |
21 | 19 | int validate_ip4_addr(const struct in_addr *a) |
22 | 20 | { |
27 | 25 | /* First octet == 127 */ |
28 | 26 | if ((a->s_addr & htonl(0xff000000)) == htonl(0x7f000000)) |
29 | 27 | return -1; |
30 | @@ -97,7 +93,12 @@ int is_private_ip4_addr(const struct in_addr *a) | |
28 | @@ -97,7 +93,7 @@ | |
31 | 29 | |
32 | 30 | int calc_ip4_mask(struct in_addr *mask, const struct in_addr *addr, int len) |
33 | 31 | { |
36 | 34 | if (addr && (addr->s_addr & ~mask->s_addr)) |
37 | 35 | return -1; |
38 | 36 | return 0; |
39 | @@ -422,6 +423,9 @@ int map_ip4_to_ip6(struct in6_addr *addr6, const struct in_addr *addr4, | |
37 | @@ -422,6 +418,9 @@ | |
40 | 38 | case MAP_TYPE_STATIC: |
41 | 39 | s = container_of(map4, struct map_static, map4); |
42 | 40 | *addr6 = s->map6.addr; |
46 | 44 | break; |
47 | 45 | case MAP_TYPE_RFC6052: |
48 | 46 | s = container_of(map4, struct map_static, map4); |
49 | @@ -564,7 +568,13 @@ int map_ip6_to_ip4(struct in_addr *addr4, const struct in6_addr *addr6, | |
47 | @@ -564,7 +563,13 @@ | |
50 | 48 | switch (map6->type) { |
51 | 49 | case MAP_TYPE_STATIC: |
52 | 50 | s = container_of(map6, struct map_static, map6); |
61 | 59 | break; |
62 | 60 | case MAP_TYPE_RFC6052: |
63 | 61 | if (extract_from_prefix(addr4, addr6, map6->prefix_len) < 0) |
64 | @@ -629,3 +639,10 @@ void addrmap_maint(void) | |
62 | @@ -629,3 +634,10 @@ | |
65 | 63 | } |
66 | 64 | } |
67 | 65 | } |
72 | 70 | +indent-tabs-mode: t |
73 | 71 | +End: |
74 | 72 | +*/ |
75 | diff --git a/conffile.c b/conffile.c | |
76 | index ec6433c..dd4193c 100644 | |
77 | 73 | --- a/conffile.c |
78 | 74 | +++ b/conffile.c |
79 | @@ -217,16 +217,43 @@ static void config_map(int ln, int arg_count, char **args) | |
75 | @@ -217,16 +217,43 @@ | |
80 | 76 | |
81 | 77 | m = alloc_map_static(ln); |
82 | 78 | |
93 | 89 | - "line %d\n", args[0], ln); |
94 | 90 | + slog(LOG_CRIT, "Expected an IPv4 subnet but found \"%s\" on " |
95 | 91 | + "line %d\n", args[0], ln); |
96 | exit(1); | |
97 | } | |
92 | + exit(1); | |
93 | + } | |
98 | 94 | + m->map4.prefix_len = prefix4; |
99 | 95 | + calc_ip4_mask(&m->map4.mask, NULL, prefix4); |
100 | 96 | + |
108 | 104 | + if ((32 - prefix4) != (128 - prefix6)) { |
109 | 105 | + slog(LOG_CRIT, "IPv4 and IPv6 subnet must be of the same size, but found" |
110 | 106 | + " %s and %s on line %d\n", args[0], args[1], ln); |
111 | + exit(1); | |
112 | + } | |
107 | exit(1); | |
108 | } | |
113 | 109 | + |
114 | 110 | if (!inet_pton(AF_INET6, args[1], &m->map6.addr)) { |
115 | 111 | - slog(LOG_CRIT, "Expected an IPv6 address but found \"%s\" on " |
123 | 119 | if (validate_ip4_addr(&m->map4.addr) < 0) { |
124 | 120 | slog(LOG_CRIT, "Cannot use reserved address %s in map " |
125 | 121 | "directive, aborting...\n", args[0]); |
126 | @@ -490,3 +517,10 @@ malloc_fail: | |
122 | @@ -490,3 +517,10 @@ | |
127 | 123 | slog(LOG_CRIT, "Unable to allocate config memory\n"); |
128 | 124 | exit(1); |
129 | 125 | } |