All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH net-next 12/13] net: mctp: add gateway routing support
@ 2025-06-13  7:34 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-06-13  7:34 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250611-dev-forwarding-v1-12-6b69b1feb37f@codeconstruct.com.au>
References: <20250611-dev-forwarding-v1-12-6b69b1feb37f@codeconstruct.com.au>
TO: Jeremy Kerr <jk@codeconstruct.com.au>
TO: Matt Johnston <matt@codeconstruct.com.au>
TO: "David S. Miller" <davem@davemloft.net>
CC: netdev@vger.kernel.org
TO: Eric Dumazet <edumazet@google.com>
TO: Jakub Kicinski <kuba@kernel.org>
TO: Paolo Abeni <pabeni@redhat.com>
TO: Simon Horman <horms@kernel.org>

Hi Jeremy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0097c4195b1d0ca57d15979626c769c74747b5a0]

url:    https://github.com/intel-lab-lkp/linux/commits/Jeremy-Kerr/net-mctp-don-t-use-source-cb-data-when-forwarding-ensure-pkt_type-is-set/20250611-143319
base:   0097c4195b1d0ca57d15979626c769c74747b5a0
patch link:    https://lore.kernel.org/r/20250611-dev-forwarding-v1-12-6b69b1feb37f%40codeconstruct.com.au
patch subject: [PATCH net-next 12/13] net: mctp: add gateway routing support
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: csky-randconfig-r073-20250612 (https://download.01.org/0day-ci/archive/20250613/202506131515.a5tCsTj0-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 14.3.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202506131515.a5tCsTj0-lkp@intel.com/

New smatch warnings:
net/mctp/route.c:1381 mctp_route_nlparse_common() error: uninitialized symbol 'gateway'.

Old smatch warnings:
net/mctp/route.c:1397 mctp_route_nlparse_common() error: uninitialized symbol 'gateway'.

vim +/gateway +1381 net/mctp/route.c

33d33bef994e518 Jeremy Kerr   2025-06-11  1344  
75626016e50cb9a Jeremy Kerr   2025-06-11  1345  /* base parsing; common to both _lookup and _populate variants.
75626016e50cb9a Jeremy Kerr   2025-06-11  1346   *
75626016e50cb9a Jeremy Kerr   2025-06-11  1347   * For gateway routes (which have a RTA_GATEWAY, and no RTA_OIF), we populate
75626016e50cb9a Jeremy Kerr   2025-06-11  1348   * *gatweayp. for direct routes (RTA_OIF, no RTA_GATEWAY), we populate *mdev.
75626016e50cb9a Jeremy Kerr   2025-06-11  1349   */
33d33bef994e518 Jeremy Kerr   2025-06-11  1350  static int mctp_route_nlparse_common(struct net *net, struct nlmsghdr *nlh,
06d2f4c583a7d89 Matt Johnston 2021-07-29  1351  				     struct netlink_ext_ack *extack,
06d2f4c583a7d89 Matt Johnston 2021-07-29  1352  				     struct nlattr **tb, struct rtmsg **rtm,
33d33bef994e518 Jeremy Kerr   2025-06-11  1353  				     struct mctp_dev **mdev,
75626016e50cb9a Jeremy Kerr   2025-06-11  1354  				     struct mctp_fq_addr *gatewayp,
33d33bef994e518 Jeremy Kerr   2025-06-11  1355  				     mctp_eid_t *daddr_start)
06d2f4c583a7d89 Matt Johnston 2021-07-29  1356  {
75626016e50cb9a Jeremy Kerr   2025-06-11  1357  	struct mctp_fq_addr *gateway;
75626016e50cb9a Jeremy Kerr   2025-06-11  1358  	unsigned int ifindex = 0;
06d2f4c583a7d89 Matt Johnston 2021-07-29  1359  	struct net_device *dev;
06d2f4c583a7d89 Matt Johnston 2021-07-29  1360  	int rc;
06d2f4c583a7d89 Matt Johnston 2021-07-29  1361  
06d2f4c583a7d89 Matt Johnston 2021-07-29  1362  	rc = nlmsg_parse(nlh, sizeof(struct rtmsg), tb, RTA_MAX,
06d2f4c583a7d89 Matt Johnston 2021-07-29  1363  			 rta_mctp_policy, extack);
06d2f4c583a7d89 Matt Johnston 2021-07-29  1364  	if (rc < 0) {
06d2f4c583a7d89 Matt Johnston 2021-07-29  1365  		NL_SET_ERR_MSG(extack, "incorrect format");
06d2f4c583a7d89 Matt Johnston 2021-07-29  1366  		return rc;
06d2f4c583a7d89 Matt Johnston 2021-07-29  1367  	}
06d2f4c583a7d89 Matt Johnston 2021-07-29  1368  
06d2f4c583a7d89 Matt Johnston 2021-07-29  1369  	if (!tb[RTA_DST]) {
06d2f4c583a7d89 Matt Johnston 2021-07-29  1370  		NL_SET_ERR_MSG(extack, "dst EID missing");
06d2f4c583a7d89 Matt Johnston 2021-07-29  1371  		return -EINVAL;
06d2f4c583a7d89 Matt Johnston 2021-07-29  1372  	}
06d2f4c583a7d89 Matt Johnston 2021-07-29  1373  	*daddr_start = nla_get_u8(tb[RTA_DST]);
06d2f4c583a7d89 Matt Johnston 2021-07-29  1374  
75626016e50cb9a Jeremy Kerr   2025-06-11  1375  	if (tb[RTA_OIF])
06d2f4c583a7d89 Matt Johnston 2021-07-29  1376  		ifindex = nla_get_u32(tb[RTA_OIF]);
06d2f4c583a7d89 Matt Johnston 2021-07-29  1377  
75626016e50cb9a Jeremy Kerr   2025-06-11  1378  	if (tb[RTA_GATEWAY])
75626016e50cb9a Jeremy Kerr   2025-06-11  1379  		gateway = nla_data(tb[RTA_GATEWAY]);
06d2f4c583a7d89 Matt Johnston 2021-07-29  1380  
75626016e50cb9a Jeremy Kerr   2025-06-11 @1381  	if (ifindex && gateway) {
75626016e50cb9a Jeremy Kerr   2025-06-11  1382  		NL_SET_ERR_MSG(extack,
75626016e50cb9a Jeremy Kerr   2025-06-11  1383  			       "cannot specify both ifindex and gateway");
33d33bef994e518 Jeremy Kerr   2025-06-11  1384  		return -EINVAL;
33d33bef994e518 Jeremy Kerr   2025-06-11  1385  
75626016e50cb9a Jeremy Kerr   2025-06-11  1386  	} else if (ifindex) {
06d2f4c583a7d89 Matt Johnston 2021-07-29  1387  		dev = __dev_get_by_index(net, ifindex);
06d2f4c583a7d89 Matt Johnston 2021-07-29  1388  		if (!dev) {
06d2f4c583a7d89 Matt Johnston 2021-07-29  1389  			NL_SET_ERR_MSG(extack, "bad ifindex");
06d2f4c583a7d89 Matt Johnston 2021-07-29  1390  			return -ENODEV;
06d2f4c583a7d89 Matt Johnston 2021-07-29  1391  		}
06d2f4c583a7d89 Matt Johnston 2021-07-29  1392  		*mdev = mctp_dev_get_rtnl(dev);
06d2f4c583a7d89 Matt Johnston 2021-07-29  1393  		if (!*mdev)
06d2f4c583a7d89 Matt Johnston 2021-07-29  1394  			return -ENODEV;
75626016e50cb9a Jeremy Kerr   2025-06-11  1395  		gatewayp->eid = 0;
75626016e50cb9a Jeremy Kerr   2025-06-11  1396  
75626016e50cb9a Jeremy Kerr   2025-06-11  1397  	} else if (gateway) {
75626016e50cb9a Jeremy Kerr   2025-06-11  1398  		if (!mctp_address_unicast(gateway->eid)) {
75626016e50cb9a Jeremy Kerr   2025-06-11  1399  			NL_SET_ERR_MSG(extack, "bad gateway");
75626016e50cb9a Jeremy Kerr   2025-06-11  1400  			return -EINVAL;
75626016e50cb9a Jeremy Kerr   2025-06-11  1401  		}
75626016e50cb9a Jeremy Kerr   2025-06-11  1402  
75626016e50cb9a Jeremy Kerr   2025-06-11  1403  		gatewayp->eid = gateway->eid;
75626016e50cb9a Jeremy Kerr   2025-06-11  1404  		gatewayp->net = gateway->net != MCTP_NET_ANY ?
75626016e50cb9a Jeremy Kerr   2025-06-11  1405  			gateway->net :
75626016e50cb9a Jeremy Kerr   2025-06-11  1406  			READ_ONCE(net->mctp.default_net);
75626016e50cb9a Jeremy Kerr   2025-06-11  1407  		*mdev = NULL;
75626016e50cb9a Jeremy Kerr   2025-06-11  1408  
75626016e50cb9a Jeremy Kerr   2025-06-11  1409  	} else {
75626016e50cb9a Jeremy Kerr   2025-06-11  1410  		NL_SET_ERR_MSG(extack, "no route output provided");
75626016e50cb9a Jeremy Kerr   2025-06-11  1411  		return -EINVAL;
75626016e50cb9a Jeremy Kerr   2025-06-11  1412  	}
75626016e50cb9a Jeremy Kerr   2025-06-11  1413  
75626016e50cb9a Jeremy Kerr   2025-06-11  1414  	*rtm = nlmsg_data(nlh);
75626016e50cb9a Jeremy Kerr   2025-06-11  1415  	if ((*rtm)->rtm_family != AF_MCTP) {
75626016e50cb9a Jeremy Kerr   2025-06-11  1416  		NL_SET_ERR_MSG(extack, "route family must be AF_MCTP");
75626016e50cb9a Jeremy Kerr   2025-06-11  1417  		return -EINVAL;
75626016e50cb9a Jeremy Kerr   2025-06-11  1418  	}
75626016e50cb9a Jeremy Kerr   2025-06-11  1419  
75626016e50cb9a Jeremy Kerr   2025-06-11  1420  	if ((*rtm)->rtm_type != RTN_UNICAST) {
75626016e50cb9a Jeremy Kerr   2025-06-11  1421  		NL_SET_ERR_MSG(extack, "rtm_type must be RTN_UNICAST");
75626016e50cb9a Jeremy Kerr   2025-06-11  1422  		return -EINVAL;
75626016e50cb9a Jeremy Kerr   2025-06-11  1423  	}
06d2f4c583a7d89 Matt Johnston 2021-07-29  1424  
33d33bef994e518 Jeremy Kerr   2025-06-11  1425  	return 0;
06d2f4c583a7d89 Matt Johnston 2021-07-29  1426  }
06d2f4c583a7d89 Matt Johnston 2021-07-29  1427  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH net-next 00/13] net: mctp: Add support for gateway routing
@ 2025-06-11  6:30 Jeremy Kerr
  2025-06-11  6:30 ` [PATCH net-next 12/13] net: mctp: add gateway routing support Jeremy Kerr
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Kerr @ 2025-06-11  6:30 UTC (permalink / raw)
  To: Matt Johnston, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: netdev

This series adds a gatweay route type for the MCTP core, allowing
non-local EIDs as the match for a route.

Example setup using the mctp tools:

    mctp route add 9 via mctpi2c0
    mctp neigh add 9 dev mctpi2c0 lladdr 0x1d
    mctp route add 10 gw 9

- will route packets to eid 10 through mctpi2c0, using a dest lladdr
of 0x1d (ie, that of the directly-attached eid 9).

The core change to support this is the introduction of a struct
mctp_dst, which represents the result of a route lookup. Since this
involves a bit of surgery through the routing code, we add a few tests
along the way.

We're introducing an ABI change in the new RTM_{NEW,GET,DEL}ROUTE
netlink formats, with the support for a RTA_GATEWAY attribute. Because
we need a network ID specified to fully-qualify a gateway EID, the
RTA_GATEWAY attribute carries the (net, eid) tuple in full:

    struct mctp_fq_addr {
        unsigned int net;
        mctp_eid_t eid;
    }

Of course, any questions, comments etc are most welcome.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
Jeremy Kerr (13):
      net: mctp: don't use source cb data when forwarding, ensure pkt_type is set
      net: mctp: separate routing database from routing operations
      net: mctp: separate cb from direct-addressing routing
      net: mctp: test: Add an addressed device constructor
      net: mctp: test: Add extaddr routing output test
      net: mctp: test: move functions into utils.[ch]
      net: mctp: test: add sock test infrastructure
      net: mctp: test: Add initial socket tests
      net: mctp: pass net into route creation
      net: mctp: remove routes by netid, not by device
      net: mctp: allow NL parsing directly into a struct mctp_route
      net: mctp: add gateway routing support
      net: mctp: test: Add tests for gateway routes

 include/net/mctp.h         |  52 +++-
 include/uapi/linux/mctp.h  |   8 +
 net/mctp/af_mctp.c         |  62 ++---
 net/mctp/route.c           | 563 ++++++++++++++++++++++++++++--------------
 net/mctp/test/route-test.c | 604 +++++++++++++++++++++++++++++----------------
 net/mctp/test/sock-test.c  | 229 +++++++++++++++++
 net/mctp/test/utils.c      | 196 ++++++++++++++-
 net/mctp/test/utils.h      |  44 ++++
 8 files changed, 1307 insertions(+), 451 deletions(-)
---
base-commit: 0097c4195b1d0ca57d15979626c769c74747b5a0
change-id: 20250520-dev-forwarding-0711973470bf

Best regards,
-- 
Jeremy Kerr <jk@codeconstruct.com.au>


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

end of thread, other threads:[~2025-06-18 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-13  7:34 [PATCH net-next 12/13] net: mctp: add gateway routing support kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-06-11  6:30 [PATCH net-next 00/13] net: mctp: Add support for gateway routing Jeremy Kerr
2025-06-11  6:30 ` [PATCH net-next 12/13] net: mctp: add gateway routing support Jeremy Kerr
2025-06-13 17:11   ` Simon Horman
2025-06-18 17:26   ` Dan Carpenter

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.