lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 16 Jan 2021 00:20:24 +0800
From:   kernel test robot <lkp@...el.com>
To:     Praveen Chaudhary <praveen5582@...il.com>, davem@...emloft.net,
        kuba@...nel.org, corbet@....net, kuznet@....inr.ac.ru,
        yoshfuji@...ux-ipv6.org, netdev@...r.kernel.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     kbuild-all@...ts.01.org, Zhenggen Xu <zxu@...kedin.com>
Subject: Re: [PATCH v2 net-next 1/1] Allow user to set metric on default
 route learned via Router Advertisement.

Hi Praveen,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 139711f033f636cc78b6aaf7363252241b9698ef]

url:    https://github.com/0day-ci/linux/commits/Praveen-Chaudhary/Allow-user-to-set-metric-on-default-route-learned-via-Router-Advertisement/20210115-160758
base:    139711f033f636cc78b6aaf7363252241b9698ef
config: nds32-randconfig-r015-20210115 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/35f232fe80f8b50430aee1c6e534cba119c88de8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Praveen-Chaudhary/Allow-user-to-set-metric-on-default-route-learned-via-Router-Advertisement/20210115-160758
        git checkout 35f232fe80f8b50430aee1c6e534cba119c88de8
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   net/ipv6/ndisc.c: In function 'ndisc_router_discovery':
>> net/ipv6/ndisc.c:1308:35: error: 'struct ipv6_devconf' has no member named 'accept_ra_defrtr_metric'; did you mean 'accept_ra_defrtr'?
    1308 |  defrtr_usr_metric = in6_dev->cnf.accept_ra_defrtr_metric;
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~
         |                                   accept_ra_defrtr

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for FRAME_POINTER
   Depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS
   Selected by
   - LATENCYTOP && DEBUG_KERNEL && STACKTRACE_SUPPORT && PROC_FS && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86


vim +1308 net/ipv6/ndisc.c

  1241	
  1242		if (in6_dev->if_flags & IF_RS_SENT) {
  1243			/*
  1244			 *	flag that an RA was received after an RS was sent
  1245			 *	out on this interface.
  1246			 */
  1247			in6_dev->if_flags |= IF_RA_RCVD;
  1248		}
  1249	
  1250		/*
  1251		 * Remember the managed/otherconf flags from most recently
  1252		 * received RA message (RFC 2462) -- yoshfuji
  1253		 */
  1254		old_if_flags = in6_dev->if_flags;
  1255		in6_dev->if_flags = (in6_dev->if_flags & ~(IF_RA_MANAGED |
  1256					IF_RA_OTHERCONF)) |
  1257					(ra_msg->icmph.icmp6_addrconf_managed ?
  1258						IF_RA_MANAGED : 0) |
  1259					(ra_msg->icmph.icmp6_addrconf_other ?
  1260						IF_RA_OTHERCONF : 0);
  1261	
  1262		if (old_if_flags != in6_dev->if_flags)
  1263			send_ifinfo_notify = true;
  1264	
  1265		if (!in6_dev->cnf.accept_ra_defrtr) {
  1266			ND_PRINTK(2, info,
  1267				  "RA: %s, defrtr is false for dev: %s\n",
  1268				  __func__, skb->dev->name);
  1269			goto skip_defrtr;
  1270		}
  1271	
  1272		/* Do not accept RA with source-addr found on local machine unless
  1273		 * accept_ra_from_local is set to true.
  1274		 */
  1275		net = dev_net(in6_dev->dev);
  1276		if (!in6_dev->cnf.accept_ra_from_local &&
  1277		    ipv6_chk_addr(net, &ipv6_hdr(skb)->saddr, in6_dev->dev, 0)) {
  1278			ND_PRINTK(2, info,
  1279				  "RA from local address detected on dev: %s: default router ignored\n",
  1280				  skb->dev->name);
  1281			goto skip_defrtr;
  1282		}
  1283	
  1284		lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime);
  1285	
  1286	#ifdef CONFIG_IPV6_ROUTER_PREF
  1287		pref = ra_msg->icmph.icmp6_router_pref;
  1288		/* 10b is handled as if it were 00b (medium) */
  1289		if (pref == ICMPV6_ROUTER_PREF_INVALID ||
  1290		    !in6_dev->cnf.accept_ra_rtr_pref)
  1291			pref = ICMPV6_ROUTER_PREF_MEDIUM;
  1292	#endif
  1293		/* routes added from RAs do not use nexthop objects */
  1294		rt = rt6_get_dflt_router(net, &ipv6_hdr(skb)->saddr, skb->dev);
  1295		if (rt) {
  1296			neigh = ip6_neigh_lookup(&rt->fib6_nh->fib_nh_gw6,
  1297						 rt->fib6_nh->fib_nh_dev, NULL,
  1298						  &ipv6_hdr(skb)->saddr);
  1299			if (!neigh) {
  1300				ND_PRINTK(0, err,
  1301					  "RA: %s got default router without neighbour\n",
  1302					  __func__);
  1303				fib6_info_release(rt);
  1304				return;
  1305			}
  1306		}
  1307		/* Set default route metric if specified by user */
> 1308		defrtr_usr_metric = in6_dev->cnf.accept_ra_defrtr_metric;
  1309		if (defrtr_usr_metric == 0)
  1310			defrtr_usr_metric = IP6_RT_PRIO_USER;
  1311		/* delete the route if lifetime is 0 or if metric needs change */
  1312		if (rt && ((lifetime == 0) || (rt->fib6_metric != defrtr_usr_metric)))  {
  1313			ip6_del_rt(net, rt, false);
  1314			rt = NULL;
  1315		}
  1316	
  1317		ND_PRINTK(3, info, "RA: rt: %p  lifetime: %d, metric: %d, for dev: %s\n",
  1318			  rt, lifetime, defrtr_usr_metric, skb->dev->name);
  1319		if (!rt && lifetime) {
  1320			ND_PRINTK(3, info, "RA: adding default router\n");
  1321	
  1322			rt = rt6_add_dflt_router(net, &ipv6_hdr(skb)->saddr,
  1323						 skb->dev, pref, defrtr_usr_metric);
  1324			if (!rt) {
  1325				ND_PRINTK(0, err,
  1326					  "RA: %s failed to add default route\n",
  1327					  __func__);
  1328				return;
  1329			}
  1330	
  1331			neigh = ip6_neigh_lookup(&rt->fib6_nh->fib_nh_gw6,
  1332						 rt->fib6_nh->fib_nh_dev, NULL,
  1333						  &ipv6_hdr(skb)->saddr);
  1334			if (!neigh) {
  1335				ND_PRINTK(0, err,
  1336					  "RA: %s got default router without neighbour\n",
  1337					  __func__);
  1338				fib6_info_release(rt);
  1339				return;
  1340			}
  1341			neigh->flags |= NTF_ROUTER;
  1342		} else if (rt) {
  1343			rt->fib6_flags = (rt->fib6_flags & ~RTF_PREF_MASK) | RTF_PREF(pref);
  1344		}
  1345	
  1346		if (rt)
  1347			fib6_set_expires(rt, jiffies + (HZ * lifetime));
  1348		if (in6_dev->cnf.accept_ra_min_hop_limit < 256 &&
  1349		    ra_msg->icmph.icmp6_hop_limit) {
  1350			if (in6_dev->cnf.accept_ra_min_hop_limit <= ra_msg->icmph.icmp6_hop_limit) {
  1351				in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;
  1352				fib6_metric_set(rt, RTAX_HOPLIMIT,
  1353						ra_msg->icmph.icmp6_hop_limit);
  1354			} else {
  1355				ND_PRINTK(2, warn, "RA: Got route advertisement with lower hop_limit than minimum\n");
  1356			}
  1357		}
  1358	
  1359	skip_defrtr:
  1360	
  1361		/*
  1362		 *	Update Reachable Time and Retrans Timer
  1363		 */
  1364	
  1365		if (in6_dev->nd_parms) {
  1366			unsigned long rtime = ntohl(ra_msg->retrans_timer);
  1367	
  1368			if (rtime && rtime/1000 < MAX_SCHEDULE_TIMEOUT/HZ) {
  1369				rtime = (rtime*HZ)/1000;
  1370				if (rtime < HZ/100)
  1371					rtime = HZ/100;
  1372				NEIGH_VAR_SET(in6_dev->nd_parms, RETRANS_TIME, rtime);
  1373				in6_dev->tstamp = jiffies;
  1374				send_ifinfo_notify = true;
  1375			}
  1376	
  1377			rtime = ntohl(ra_msg->reachable_time);
  1378			if (rtime && rtime/1000 < MAX_SCHEDULE_TIMEOUT/(3*HZ)) {
  1379				rtime = (rtime*HZ)/1000;
  1380	
  1381				if (rtime < HZ/10)
  1382					rtime = HZ/10;
  1383	
  1384				if (rtime != NEIGH_VAR(in6_dev->nd_parms, BASE_REACHABLE_TIME)) {
  1385					NEIGH_VAR_SET(in6_dev->nd_parms,
  1386						      BASE_REACHABLE_TIME, rtime);
  1387					NEIGH_VAR_SET(in6_dev->nd_parms,
  1388						      GC_STALETIME, 3 * rtime);
  1389					in6_dev->nd_parms->reachable_time = neigh_rand_reach_time(rtime);
  1390					in6_dev->tstamp = jiffies;
  1391					send_ifinfo_notify = true;
  1392				}
  1393			}
  1394		}
  1395	
  1396		/*
  1397		 *	Send a notify if RA changed managed/otherconf flags or timer settings
  1398		 */
  1399		if (send_ifinfo_notify)
  1400			inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
  1401	
  1402	skip_linkparms:
  1403	
  1404		/*
  1405		 *	Process options.
  1406		 */
  1407	
  1408		if (!neigh)
  1409			neigh = __neigh_lookup(&nd_tbl, &ipv6_hdr(skb)->saddr,
  1410					       skb->dev, 1);
  1411		if (neigh) {
  1412			u8 *lladdr = NULL;
  1413			if (ndopts.nd_opts_src_lladdr) {
  1414				lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr,
  1415							     skb->dev);
  1416				if (!lladdr) {
  1417					ND_PRINTK(2, warn,
  1418						  "RA: invalid link-layer address length\n");
  1419					goto out;
  1420				}
  1421			}
  1422			ndisc_update(skb->dev, neigh, lladdr, NUD_STALE,
  1423				     NEIGH_UPDATE_F_WEAK_OVERRIDE|
  1424				     NEIGH_UPDATE_F_OVERRIDE|
  1425				     NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
  1426				     NEIGH_UPDATE_F_ISROUTER,
  1427				     NDISC_ROUTER_ADVERTISEMENT, &ndopts);
  1428		}
  1429	
  1430		if (!ipv6_accept_ra(in6_dev)) {
  1431			ND_PRINTK(2, info,
  1432				  "RA: %s, accept_ra is false for dev: %s\n",
  1433				  __func__, skb->dev->name);
  1434			goto out;
  1435		}
  1436	

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

Download attachment ".config.gz" of type "application/gzip" (25610 bytes)

Powered by blists - more mailing lists