lkml.org 
[lkml]   [1998]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPatch to 2.0.33 to add ICMP MASK response.

This patch will enable linux to respond to ICMP MASK requests.

I have added this as a compile time option.

It should patch into any 2.0.xx kernel.

Note: Description I have created for "xconfig" could be better worded.
Any sugestions ??

I came across this when using "scotty/tkined" to map our internal network
which is subnetted. Linux is being used as one of the routers and tkined
had real problems mapping the network. It uses the ICMP MASK to discover
the subnet mask of each segment.

Now if I can only get Novell 4.10 to respond, I'll get a nice map of our
network :-)

==========================================================================
|Mark Harvey | Contrary to popular belief, UNIX is user friendly. |
|Technical Support | It just happens to be selective about who it |
|Force Technology | decides to make friends with. |
+------------------------------------------------------------------------+
|Voice: 61-2-94174477, Fax: 61-2-94173881, email: markh@forcetech.com.au |
==========================================================================
diff -urN linux-2.0.33.orig/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-2.0.33.orig/Documentation/Configure.help Thu Dec 11 13:21:47 1997
+++ linux/Documentation/Configure.help Fri Jan 9 11:28:29 1998
@@ -1043,6 +1043,20 @@
drivers/net/README.multicast. If you haven't heard about it, you
don't need it.

+IP: ICMP MASK reply
+CONFIG_IP_ADDR_AGENT
+ Enable one of the 18 or so ICMP functions. Echo reply is the usual one
+ everybody uses which is used by ping. Saying YES to this will allow
+ the ICMP protocol to return the subnet mask of the interface being
+ queried. This is really usefull if using the package "scotty/tkined"
+ (see http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ ).
+ Among other things this snmp addition to TCL/TK will "discover" and
+ map out your IP network.
+ It uses the ICMP MASK to determine the network mask used when tring
+ to sort out your network topology.
+
PC/TCP compatibility mode
CONFIG_INET_PCTCP
If you have been having difficulties telneting to your Linux machine
diff -urN linux-2.0.33.orig/net/ipv4/Config.in linux/net/ipv4/Config.in
--- linux-2.0.33.orig/net/ipv4/Config.in Wed Aug 13 04:30:25 1997
+++ linux/net/ipv4/Config.in Fri Jan 9 11:29:29 1998
@@ -41,6 +41,7 @@
bool 'IP: ARP daemon support (EXPERIMENTAL)' CONFIG_ARPD
fi
fi
+bool 'ICMP MASK reply' CONFIG_IP_ADDR_AGENT
comment '(it is safe to leave these untouched)'
bool 'IP: PC/TCP compatibility mode' CONFIG_INET_PCTCP
tristate 'IP: Reverse ARP' CONFIG_INET_RARP
diff -urN linux-2.0.33.orig/net/ipv4/icmp.c linux/net/ipv4/icmp.c
--- linux-2.0.33.orig/net/ipv4/icmp.c Tue Sep 16 02:54:52 1997
+++ linux/net/ipv4/icmp.c Fri Jan 9 11:29:35 1998
@@ -965,18 +965,21 @@

static void icmp_address(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev, __u32 saddr, __u32 daddr, int len)
{
-#ifdef CONFIG_IP_ADDR_AGENT /* Don't use, broken */
+#ifdef CONFIG_IP_ADDR_AGENT
struct icmp_bxm icmp_param;
icmp_param.icmph.type=ICMP_ADDRESSREPLY;
icmp_param.icmph.code=0;
icmp_param.icmph.un.echo.id = icmph->un.echo.id;
icmp_param.icmph.un.echo.sequence = icmph->un.echo.sequence;
- icmp_param.data_ptr=&dev->pa_mask;
- icmp_param.data_len=4;
- if (ip_options_echo(&icmp_param.replyopts, NULL, daddr, saddr, skb)==0)
- icmp_build_xmit(&icmp_param, daddr, saddr, skb->iph->tos);
-#endif
- kfree_skb(skb, FREE_READ);
+ dev = ip_dev_find(daddr);
+ if (dev != NULL) {
+ icmp_param.data_ptr=&dev->pa_mask;
+ icmp_param.data_len=4;
+ if (ip_options_echo(&icmp_param.replyopts, NULL, daddr, saddr, skb)==0)
+ icmp_build_xmit(&icmp_param, daddr, saddr, skb->ip_hdr->tos);
+ }
+#endif
+ kfree_skb(skb, FREE_READ);
}

static void icmp_discard(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev, __u32 saddr, __u32 daddr, int len)
\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.075 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site