Codebase list tayga / 195f795
debian/patches/0007-static-EAM.patch: refresh patch by quilt. Benda Xu 4 years ago
1 changed file(s) with 11 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
1212 conffile.c | 40 +++++++++++++++++++++++++++++++++++++---
1313 2 files changed, 60 insertions(+), 9 deletions(-)
1414
15 diff --git a/addrmap.c b/addrmap.c
16 index 7a4bf8b..24926d8 100644
1715 --- a/addrmap.c
1816 +++ b/addrmap.c
19 @@ -22,10 +22,6 @@ extern time_t now;
17 @@ -22,10 +22,6 @@
2018
2119 int validate_ip4_addr(const struct in_addr *a)
2220 {
2725 /* First octet == 127 */
2826 if ((a->s_addr & htonl(0xff000000)) == htonl(0x7f000000))
2927 return -1;
30 @@ -97,7 +93,12 @@ int is_private_ip4_addr(const struct in_addr *a)
28 @@ -97,7 +93,7 @@
3129
3230 int calc_ip4_mask(struct in_addr *mask, const struct in_addr *addr, int len)
3331 {
3634 if (addr && (addr->s_addr & ~mask->s_addr))
3735 return -1;
3836 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 @@
4038 case MAP_TYPE_STATIC:
4139 s = container_of(map4, struct map_static, map4);
4240 *addr6 = s->map6.addr;
4644 break;
4745 case MAP_TYPE_RFC6052:
4846 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 @@
5048 switch (map6->type) {
5149 case MAP_TYPE_STATIC:
5250 s = container_of(map6, struct map_static, map6);
6159 break;
6260 case MAP_TYPE_RFC6052:
6361 if (extract_from_prefix(addr4, addr6, map6->prefix_len) < 0)
64 @@ -629,3 +639,10 @@ void addrmap_maint(void)
62 @@ -629,3 +634,10 @@
6563 }
6664 }
6765 }
7270 +indent-tabs-mode: t
7371 +End:
7472 +*/
75 diff --git a/conffile.c b/conffile.c
76 index ec6433c..dd4193c 100644
7773 --- a/conffile.c
7874 +++ b/conffile.c
79 @@ -217,16 +217,43 @@ static void config_map(int ln, int arg_count, char **args)
75 @@ -217,16 +217,43 @@
8076
8177 m = alloc_map_static(ln);
8278
9389 - "line %d\n", args[0], ln);
9490 + slog(LOG_CRIT, "Expected an IPv4 subnet but found \"%s\" on "
9591 + "line %d\n", args[0], ln);
96 exit(1);
97 }
92 + exit(1);
93 + }
9894 + m->map4.prefix_len = prefix4;
9995 + calc_ip4_mask(&m->map4.mask, NULL, prefix4);
10096 +
108104 + if ((32 - prefix4) != (128 - prefix6)) {
109105 + slog(LOG_CRIT, "IPv4 and IPv6 subnet must be of the same size, but found"
110106 + " %s and %s on line %d\n", args[0], args[1], ln);
111 + exit(1);
112 + }
107 exit(1);
108 }
113109 +
114110 if (!inet_pton(AF_INET6, args[1], &m->map6.addr)) {
115111 - slog(LOG_CRIT, "Expected an IPv6 address but found \"%s\" on "
123119 if (validate_ip4_addr(&m->map4.addr) < 0) {
124120 slog(LOG_CRIT, "Cannot use reserved address %s in map "
125121 "directive, aborting...\n", args[0]);
126 @@ -490,3 +517,10 @@ malloc_fail:
122 @@ -490,3 +517,10 @@
127123 slog(LOG_CRIT, "Unable to allocate config memory\n");
128124 exit(1);
129125 }