All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 net-next 0/5] add support for RFC 8335 PROBE
@ 2021-02-03 23:24 Andreas Roeseler
  2021-02-03 23:24 ` [PATCH V2 net-next 1/5] icmp: " Andreas Roeseler
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Andreas Roeseler @ 2021-02-03 23:24 UTC (permalink / raw)
  To: davem; +Cc: kuznet, yoshfuji, kuba, netdev

The popular utility ping has several severe limitations such as the
inability to query specific interfaces on a node and requiring
bidirectional connectivity between the probing and probed interfaces.
RFC 8335 attempts to solve these limitations by creating the new utility
PROBE which is a specialized ICMP message that makes use of the ICMP
Extention Structure outlined in RFC 4884.

This patchset adds definitions for the ICMP Extended Echo Request and
Reply (PROBE) types for both IPV4 and IPV6, adds a sysctl to enable 
response to PROBE messages, expands the list of supported ICMP messages
to accommodate PROBE types, and adds functionality to respond to PROBE
requests.

Changes since v1:
 - Add AFI definitions
 - Switch to functions such as dev_get_by_name and ip_dev_find to lookup
   net devices 

Andreas Roeseler (5):
  icmp: add support for RFC 8335 PROBE
  ICMPV6: add support for RFC 8335 PROBE
  net: add sysctl for enabling RFC 8335 PROBE messages
  net: add support for sending RFC 8335 PROBE messages
  icmp: add response to RFC 8335 PROBE messages

 include/net/netns/ipv4.h    |  1 +
 include/uapi/linux/icmp.h   | 24 +++++++++
 include/uapi/linux/icmpv6.h |  6 +++
 net/ipv4/icmp.c             | 98 +++++++++++++++++++++++++++++++++----
 net/ipv4/ping.c             |  4 +-
 net/ipv4/sysctl_net_ipv4.c  |  7 +++
 6 files changed, 129 insertions(+), 11 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH V2 net-next 5/5] icmp: add response to RFC 8335 PROBE messages
@ 2021-02-04  2:10 kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-02-04  2:10 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 9707 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <7af3da33a7aa540f7878cfcbf5076dcf61d201ef.1612393368.git.andreas.a.roeseler@gmail.com>
References: <7af3da33a7aa540f7878cfcbf5076dcf61d201ef.1612393368.git.andreas.a.roeseler@gmail.com>
TO: Andreas Roeseler <andreas.a.roeseler@gmail.com>

Hi Andreas,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Andreas-Roeseler/add-support-for-RFC-8335-PROBE/20210204-072756
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 6626a0266566c5aea16178c5e6cd7fc4db3f2f56
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: i386-randconfig-m021-20210202 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/ipv4/icmp.c:1032 icmp_echo() error: uninitialized symbol 'dev'.

vim +/dev +1032 net/ipv4/icmp.c

^1da177e4c3f41 Linus Torvalds           2005-04-16   971  
^1da177e4c3f41 Linus Torvalds           2005-04-16   972  /*
^1da177e4c3f41 Linus Torvalds           2005-04-16   973   *	Handle ICMP_ECHO ("ping") requests.
^1da177e4c3f41 Linus Torvalds           2005-04-16   974   *
^1da177e4c3f41 Linus Torvalds           2005-04-16   975   *	RFC 1122: 3.2.2.6 MUST have an echo server that answers ICMP echo
^1da177e4c3f41 Linus Torvalds           2005-04-16   976   *		  requests.
^1da177e4c3f41 Linus Torvalds           2005-04-16   977   *	RFC 1122: 3.2.2.6 Data received in the ICMP_ECHO request MUST be
^1da177e4c3f41 Linus Torvalds           2005-04-16   978   *		  included in the reply.
^1da177e4c3f41 Linus Torvalds           2005-04-16   979   *	RFC 1812: 4.3.3.6 SHOULD have a config option for silently ignoring
^1da177e4c3f41 Linus Torvalds           2005-04-16   980   *		  echo requests, MUST have default=NOT.
^1da177e4c3f41 Linus Torvalds           2005-04-16   981   *	See also WRT handling of options once they are done and working.
^1da177e4c3f41 Linus Torvalds           2005-04-16   982   */
^1da177e4c3f41 Linus Torvalds           2005-04-16   983  
e3e3217029a35c Rick Jones               2014-11-17   984  static bool icmp_echo(struct sk_buff *skb)
^1da177e4c3f41 Linus Torvalds           2005-04-16   985  {
872bc41b1e24e1 Andreas Roeseler         2021-02-03   986  	struct icmp_bxm icmp_param;
b34a95ee6e0557 Pavel Emelyanov          2008-03-26   987  	struct net *net;
872bc41b1e24e1 Andreas Roeseler         2021-02-03   988  	struct net_device *dev;
872bc41b1e24e1 Andreas Roeseler         2021-02-03   989  	struct icmp_extobj_hdr *extobj_hdr;
872bc41b1e24e1 Andreas Roeseler         2021-02-03   990  	struct icmp_ext_ctype3_hdr *ctype3_hdr;
872bc41b1e24e1 Andreas Roeseler         2021-02-03   991  	__u8 status;
b34a95ee6e0557 Pavel Emelyanov          2008-03-26   992  
adf30907d63893 Eric Dumazet             2009-06-02   993  	net = dev_net(skb_dst(skb)->dev);
872bc41b1e24e1 Andreas Roeseler         2021-02-03   994  	/* should there be an ICMP stat for ignored echos? */
872bc41b1e24e1 Andreas Roeseler         2021-02-03   995  	if (net->ipv4.sysctl_icmp_echo_ignore_all)
872bc41b1e24e1 Andreas Roeseler         2021-02-03   996  		return true;
^1da177e4c3f41 Linus Torvalds           2005-04-16   997  
88c7664f13bd1a Arnaldo Carvalho de Melo 2007-03-13   998  	icmp_param.data.icmph		= *icmp_hdr(skb);
^1da177e4c3f41 Linus Torvalds           2005-04-16   999  	icmp_param.skb			= skb;
^1da177e4c3f41 Linus Torvalds           2005-04-16  1000  	icmp_param.offset		= 0;
^1da177e4c3f41 Linus Torvalds           2005-04-16  1001  	icmp_param.data_len		= skb->len;
^1da177e4c3f41 Linus Torvalds           2005-04-16  1002  	icmp_param.head_len		= sizeof(struct icmphdr);
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1003  
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1004  	if (icmp_param.data.icmph.type == ICMP_ECHO) {
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1005  		icmp_param.data.icmph.type = ICMP_ECHOREPLY;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1006  		goto send_reply;
^1da177e4c3f41 Linus Torvalds           2005-04-16  1007  	}
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1008  	if (!net->ipv4.sysctl_icmp_echo_enable_probe)
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1009  		return true;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1010  	/* We currently do not support probing off the proxy node */
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1011  	if (!(ntohs(icmp_param.data.icmph.un.echo.sequence) & 1))
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1012  		return true;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1013  
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1014  	icmp_param.data.icmph.type = ICMP_EXT_ECHOREPLY;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1015  	icmp_param.data.icmph.un.echo.sequence &= htons(0xFF00);
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1016  	extobj_hdr = (struct icmp_extobj_hdr *)(skb->data + sizeof(struct icmp_ext_hdr));
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1017  	ctype3_hdr = (struct icmp_ext_ctype3_hdr *)(extobj_hdr + 1);
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1018  	status = 0;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1019  	switch (extobj_hdr->class_type) {
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1020  	case CTYPE_NAME:
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1021  		dev = dev_get_by_name(net, (char *)(extobj_hdr + 1));
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1022  		break;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1023  	case CTYPE_INDEX:
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1024  		dev = dev_get_by_index(net, ntohl(*((uint32_t *)(extobj_hdr + 1))));
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1025  		break;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1026  	case CTYPE_ADDR:
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1027  		switch (ntohs(ctype3_hdr->afi)) {
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1028  		case AFI_IP:
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1029  			dev = ip_dev_find(net, *(__be32 *)(ctype3_hdr + 1));
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1030  			break;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1031  		case AFI_IP6:
872bc41b1e24e1 Andreas Roeseler         2021-02-03 @1032  			dev = ipv6_dev_find(net, (struct in6_addr *)(ctype3_hdr + 1), dev);
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1033  			if(dev) dev_hold(dev);
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1034  			break;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1035  		default:
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1036  			icmp_param.data.icmph.code = ICMP_EXT_MAL_QUERY;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1037  			goto send_reply;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1038  		}
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1039  		break;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1040  	default:
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1041  		icmp_param.data.icmph.code = ICMP_EXT_MAL_QUERY;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1042  		goto send_reply;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1043  	}
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1044  	if(!dev) {
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1045  		icmp_param.data.icmph.code = ICMP_EXT_NO_IF;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1046  		goto send_reply;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1047  	}
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1048  	/* RFC 8335: 3 the last 8 bits of the Extended Echo Reply Message
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1049  	 *  are laid out as follows:
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1050  	 *	+-+-+-+-+-+-+-+-+
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1051  	 *	|State|Res|A|4|6|
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1052  	 *	+-+-+-+-+-+-+-+-+
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1053  	 */
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1054  	if (dev->flags & IFF_UP)
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1055  		status |= EXT_ECHOREPLY_ACTIVE;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1056  	if (dev->ip_ptr->ifa_list)
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1057  		status |= EXT_ECHOREPLY_IPV4;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1058  	if (!list_empty(&dev->ip6_ptr->addr_list))
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1059  		status |= EXT_ECHOREPLY_IPV6;
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1060  	dev_put(dev);
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1061  	icmp_param.data.icmph.un.echo.sequence |= htons(status);
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1062  
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1063  send_reply:
872bc41b1e24e1 Andreas Roeseler         2021-02-03  1064  	icmp_reply(&icmp_param, skb);
e3e3217029a35c Rick Jones               2014-11-17  1065  	return true;
^1da177e4c3f41 Linus Torvalds           2005-04-16  1066  }
^1da177e4c3f41 Linus Torvalds           2005-04-16  1067  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38567 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-02-05  5:02 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-03 23:24 [PATCH V2 net-next 0/5] add support for RFC 8335 PROBE Andreas Roeseler
2021-02-03 23:24 ` [PATCH V2 net-next 1/5] icmp: " Andreas Roeseler
2021-02-04 19:42   ` Willem de Bruijn
2021-02-03 23:24 ` [PATCH V2 net-next 2/5] ICMPV6: " Andreas Roeseler
2021-02-03 23:24 ` [PATCH V2 net-next 3/5] net: add sysctl for enabling RFC 8335 PROBE messages Andreas Roeseler
2021-02-04 19:52   ` Willem de Bruijn
2021-02-03 23:24 ` [PATCH V2 net-next 4/5] net: add support for sending " Andreas Roeseler
2021-02-03 23:24 ` [PATCH V2 net-next 5/5] icmp: add response to " Andreas Roeseler
2021-02-04  1:18   ` kernel test robot
2021-02-04  1:19   ` kernel test robot
2021-02-04  7:15   ` Dan Carpenter
2021-02-04  7:15     ` Dan Carpenter
2021-02-04 19:52   ` Willem de Bruijn
2021-02-05  5:01     ` Andreas Roeseler
2021-02-04 20:16   ` Jakub Kicinski
  -- strict thread matches above, loose matches on Subject: below --
2021-02-04  2:10 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.