varnish/varnish.endianfix.cs3170-3071.patch

86 lines
2.8 KiB
Diff
Raw Normal View History

Index: include/vrt.h
===================================================================
--- include/vrt.h (revisjon 3169)
+++ include/vrt.h (revisjon 3171)
@@ -154,6 +154,7 @@
/* Simple stuff */
int VRT_strcmp(const char *s1, const char *s2);
+void VRT_memmove(void *dst, const void *src, unsigned len);
void VRT_ESI(struct sess *sp);
void VRT_Rollback(struct sess *sp);
Index: lib/libvcl/vcc_fixed_token.c
===================================================================
--- lib/libvcl/vcc_fixed_token.c (revisjon 3169)
+++ lib/libvcl/vcc_fixed_token.c (revisjon 3171)
@@ -434,6 +434,7 @@
vsb_cat(sb, "\n");
vsb_cat(sb, "/* Simple stuff */\n");
vsb_cat(sb, "int VRT_strcmp(const char *s1, const char *s2);\n");
+ vsb_cat(sb, "void VRT_memmove(void *dst, const void *src, unsigned len);\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "void VRT_ESI(struct sess *sp);\n");
vsb_cat(sb, "void VRT_Rollback(struct sess *sp);\n");
Index: lib/libvcl/vcc_acl.c
===================================================================
--- lib/libvcl/vcc_acl.c (revisjon 3169)
+++ lib/libvcl/vcc_acl.c (revisjon 3171)
@@ -328,23 +328,37 @@
int depth, l, m, i;
unsigned at[VRT_ACL_MAXADDR + 1];
const char *oc;
+ struct sockaddr sa;
Fh(tl, 0, "\nstatic int\n");
Fh(tl, 0, "match_acl_%s_%s(const struct sess *sp, const void *p)\n",
pfx, acln);
Fh(tl, 0, "{\n");
- Fh(tl, 0, "\tunsigned fam;\n");
Fh(tl, 0, "\tconst unsigned char *a;\n");
+ assert(sizeof (unsigned char) == 1);
+ assert(sizeof (unsigned short) == 2);
+ assert(sizeof (unsigned int) == 4);
+ if (sizeof sa.sa_family == 1)
+ Fh(tl, 0, "\tunsigned char fam;\n");
+ else if (sizeof sa.sa_family == 2)
+ Fh(tl, 0, "\tunsigned short fam;\n");
+ else if (sizeof sa.sa_family == 4)
+ Fh(tl, 0, "\tunsigned int fam;\n");
+ else
+ assert(0 == __LINE__);
+
Fh(tl, 0, "\n");
Fh(tl, 0, "\ta = p;\n");
- Fh(tl, 0, "\tfam = a[%d];\n", offsetof(struct sockaddr, sa_family));
+ Fh(tl, 0, "\tVRT_memmove(&fam, a + %d, sizeof fam);\n",
+ offsetof(struct sockaddr, sa_family));
Fh(tl, 0, "\tif (fam == %d)\n", PF_INET);
Fh(tl, 0, "\t\ta += %d;\n", offsetof(struct sockaddr_in, sin_addr));
Fh(tl, 0, "\telse if (fam == %d)\n", PF_INET6);
Fh(tl, 0, "\t\ta += %d;\n", offsetof(struct sockaddr_in6, sin6_addr));
- Fh(tl, 0, "\telse\n");
+ Fh(tl, 0, "\telse {\n");
+ Fh(tl, 0, "\t\tVRT_acl_log(sp, \"NO_FAM %s\");\n", acln);
Fh(tl, 0, "\t\treturn(0);\n");
- Fh(tl, 0, "\n");
+ Fh(tl, 0, "\t}\n\n");
depth = -1;
oc = 0;
at[0] = 256;
Index: bin/varnishd/cache_vrt.c
===================================================================
--- bin/varnishd/cache_vrt.c (revisjon 3169)
+++ bin/varnishd/cache_vrt.c (revisjon 3171)
@@ -726,3 +726,10 @@
return (strcmp(s1, s2));
}
+void
+VRT_memmove(void *dst, const void *src, unsigned len)
+{
+
+ (void)memmove(dst, src, len);
+}
+