Blame SOURCES/openssh-6.6p1-allow-ip-opts.patch

017ff1
diff --git a/canohost.c b/canohost.c
017ff1
index a61a8c9..97ce58c 100644
017ff1
--- a/canohost.c
017ff1
+++ b/canohost.c
017ff1
@@ -165,12 +165,29 @@ check_ip_options(int sock, char *ipaddr)
f09e2e
 	option_size = sizeof(options);
f09e2e
 	if (getsockopt(sock, ipproto, IP_OPTIONS, options,
f09e2e
 	    &option_size) >= 0 && option_size != 0) {
f09e2e
-		text[0] = '\0';
f09e2e
-		for (i = 0; i < option_size; i++)
f09e2e
-			snprintf(text + i*3, sizeof(text) - i*3,
f09e2e
-			    " %2.2x", options[i]);
f09e2e
-		fatal("Connection from %.100s with IP options:%.800s",
f09e2e
-		    ipaddr, text);
f09e2e
+		i = 0;
f09e2e
+		do {
f09e2e
+			switch (options[i]) {
f09e2e
+				case 0:
f09e2e
+				case 1:
f09e2e
+					++i;
f09e2e
+					break;
017ff1
+				case 130:
017ff1
+				case 133:
017ff1
+				case 134:
017ff1
+					i += options[i + 1];
017ff1
+					break;
017ff1
+				default:
f09e2e
+				/* Fail, fatally, if we detect either loose or strict
f09e2e
+			 	 * source routing options. */
f09e2e
+					text[0] = '\0';
f09e2e
+					for (i = 0; i < option_size; i++)
f09e2e
+						snprintf(text + i*3, sizeof(text) - i*3,
f09e2e
+							" %2.2x", options[i]);
f09e2e
+					fatal("Connection from %.100s with IP options:%.800s",
f09e2e
+						ipaddr, text);
f09e2e
+			}
f09e2e
+		} while (i < option_size);
f09e2e
 	}
f09e2e
 #endif /* IP_OPTIONS */
f09e2e
 }