Skip to contentSkip to conversation

--reject-with admin-prohibited (again)

PATCH Jason Lunz 1 participant 1 message May 23, 2003 netfilter

lore
Share & tools
lore

Jason Lunz

author
#0 lore raw

I was wondering about implementing rfc1812 icmp-admin-prohibited, so I found the threads on this topic in the archives, and looked at the patches that implement it. Since the big problem seems to be compatibility, I checked whether it was feasible to try and add rules with the new reject type and fall back to net-prohibited if that failed on the running kernel.

The problem is that adding an unrecognized reject type on an old kernel doesn't fail. The ipt_REJECT.c kernel module silently adds the rule but never sends the reject packet when it triggers. Shouldn't something like the patch below be added to the kernel?

Jason

ipv4/netfilter/ipt_REJECT.c renamed from ipv4/netfilter/ipt_REJECT.c.orig +13 -0
@@ -353,6 +353,19 @@
 			DEBUGP("REJECT: TCP_RESET illegal for non-tcp\n");
 			return 0;
 		}
+	} else {
+		switch(rejinfo->with) {
+			case IPT_ICMP_NET_UNREACHABLE:
+			case IPT_ICMP_HOST_UNREACHABLE:
+			case IPT_ICMP_PROT_UNREACHABLE:
+			case IPT_ICMP_PORT_UNREACHABLE:
+			case IPT_ICMP_NET_PROHIBITED:
+			case IPT_ICMP_HOST_PROHIBITED:
+				break;
+			default:
+				printk(KERN_ERR "REJECT: invalid reject type.\n");
+				return 0;
+		}
 	}
 
 	return 1;