bat_v_elp.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* Copyright (C) 2011-2018 B.A.T.M.A.N. contributors:
  3. *
  4. * Linus Lüssing, Marek Lindner
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of version 2 of the GNU General Public
  8. * License as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "bat_v_elp.h"
  19. #include "main.h"
  20. #include <linux/atomic.h>
  21. #include <linux/bitops.h>
  22. #include <linux/byteorder/generic.h>
  23. #include <linux/errno.h>
  24. #include <linux/etherdevice.h>
  25. #include <linux/ethtool.h>
  26. #include <linux/gfp.h>
  27. #include <linux/if_ether.h>
  28. #include <linux/jiffies.h>
  29. #include <linux/kernel.h>
  30. #include <linux/kref.h>
  31. #include <linux/netdevice.h>
  32. #include <linux/nl80211.h>
  33. #include <linux/random.h>
  34. #include <linux/rculist.h>
  35. #include <linux/rcupdate.h>
  36. #include <linux/rtnetlink.h>
  37. #include <linux/skbuff.h>
  38. #include <linux/stddef.h>
  39. #include <linux/string.h>
  40. #include <linux/types.h>
  41. #include <linux/workqueue.h>
  42. #include <net/cfg80211.h>
  43. #include <uapi/linux/batadv_packet.h>
  44. #include "bat_algo.h"
  45. #include "bat_v_ogm.h"
  46. #include "hard-interface.h"
  47. #include "log.h"
  48. #include "originator.h"
  49. #include "routing.h"
  50. #include "send.h"
  51. /**
  52. * batadv_v_elp_start_timer() - restart timer for ELP periodic work
  53. * @hard_iface: the interface for which the timer has to be reset
  54. */
  55. static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface)
  56. {
  57. unsigned int msecs;
  58. msecs = atomic_read(&hard_iface->bat_v.elp_interval) - BATADV_JITTER;
  59. msecs += prandom_u32() % (2 * BATADV_JITTER);
  60. queue_delayed_work(batadv_event_workqueue, &hard_iface->bat_v.elp_wq,
  61. msecs_to_jiffies(msecs));
  62. }
  63. /**
  64. * batadv_v_elp_get_throughput() - get the throughput towards a neighbour
  65. * @neigh: the neighbour for which the throughput has to be obtained
  66. *
  67. * Return: The throughput towards the given neighbour in multiples of 100kpbs
  68. * (a value of '1' equals to 0.1Mbps, '10' equals 1Mbps, etc).
  69. */
  70. static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
  71. {
  72. struct batadv_hard_iface *hard_iface = neigh->if_incoming;
  73. struct ethtool_link_ksettings link_settings;
  74. struct net_device *real_netdev;
  75. struct station_info sinfo;
  76. u32 throughput;
  77. int ret;
  78. /* if the user specified a customised value for this interface, then
  79. * return it directly
  80. */
  81. throughput = atomic_read(&hard_iface->bat_v.throughput_override);
  82. if (throughput != 0)
  83. return throughput;
  84. /* if this is a wireless device, then ask its throughput through
  85. * cfg80211 API
  86. */
  87. if (batadv_is_wifi_hardif(hard_iface)) {
  88. if (!batadv_is_cfg80211_hardif(hard_iface))
  89. /* unsupported WiFi driver version */
  90. goto default_throughput;
  91. real_netdev = batadv_get_real_netdev(hard_iface->net_dev);
  92. if (!real_netdev)
  93. goto default_throughput;
  94. ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo);
  95. if (!ret) {
  96. /* free the TID stats immediately */
  97. cfg80211_sinfo_release_content(&sinfo);
  98. }
  99. dev_put(real_netdev);
  100. if (ret == -ENOENT) {
  101. /* Node is not associated anymore! It would be
  102. * possible to delete this neighbor. For now set
  103. * the throughput metric to 0.
  104. */
  105. return 0;
  106. }
  107. if (ret)
  108. goto default_throughput;
  109. if (!(sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
  110. goto default_throughput;
  111. return sinfo.expected_throughput / 100;
  112. }
  113. /* if not a wifi interface, check if this device provides data via
  114. * ethtool (e.g. an Ethernet adapter)
  115. */
  116. memset(&link_settings, 0, sizeof(link_settings));
  117. rtnl_lock();
  118. ret = __ethtool_get_link_ksettings(hard_iface->net_dev, &link_settings);
  119. rtnl_unlock();
  120. /* Virtual interface drivers such as tun / tap interfaces, VLAN, etc
  121. * tend to initialize the interface throughput with some value for the
  122. * sake of having a throughput number to export via ethtool. This
  123. * exported throughput leaves batman-adv to conclude the interface
  124. * throughput is genuine (reflecting reality), thus no measurements
  125. * are necessary.
  126. *
  127. * Based on the observation that those interface types also tend to set
  128. * the link auto-negotiation to 'off', batman-adv shall check this
  129. * setting to differentiate between genuine link throughput information
  130. * and placeholders installed by virtual interfaces.
  131. */
  132. if (ret == 0 && link_settings.base.autoneg == AUTONEG_ENABLE) {
  133. /* link characteristics might change over time */
  134. if (link_settings.base.duplex == DUPLEX_FULL)
  135. hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;
  136. else
  137. hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX;
  138. throughput = link_settings.base.speed;
  139. if (throughput && throughput != SPEED_UNKNOWN)
  140. return throughput * 10;
  141. }
  142. default_throughput:
  143. if (!(hard_iface->bat_v.flags & BATADV_WARNING_DEFAULT)) {
  144. batadv_info(hard_iface->soft_iface,
  145. "WiFi driver or ethtool info does not provide information about link speeds on interface %s, therefore defaulting to hardcoded throughput values of %u.%1u Mbps. Consider overriding the throughput manually or checking your driver.\n",
  146. hard_iface->net_dev->name,
  147. BATADV_THROUGHPUT_DEFAULT_VALUE / 10,
  148. BATADV_THROUGHPUT_DEFAULT_VALUE % 10);
  149. hard_iface->bat_v.flags |= BATADV_WARNING_DEFAULT;
  150. }
  151. /* if none of the above cases apply, return the base_throughput */
  152. return BATADV_THROUGHPUT_DEFAULT_VALUE;
  153. }
  154. /**
  155. * batadv_v_elp_throughput_metric_update() - worker updating the throughput
  156. * metric of a single hop neighbour
  157. * @work: the work queue item
  158. */
  159. void batadv_v_elp_throughput_metric_update(struct work_struct *work)
  160. {
  161. struct batadv_hardif_neigh_node_bat_v *neigh_bat_v;
  162. struct batadv_hardif_neigh_node *neigh;
  163. neigh_bat_v = container_of(work, struct batadv_hardif_neigh_node_bat_v,
  164. metric_work);
  165. neigh = container_of(neigh_bat_v, struct batadv_hardif_neigh_node,
  166. bat_v);
  167. ewma_throughput_add(&neigh->bat_v.throughput,
  168. batadv_v_elp_get_throughput(neigh));
  169. /* decrement refcounter to balance increment performed before scheduling
  170. * this task
  171. */
  172. batadv_hardif_neigh_put(neigh);
  173. }
  174. /**
  175. * batadv_v_elp_wifi_neigh_probe() - send link probing packets to a neighbour
  176. * @neigh: the neighbour to probe
  177. *
  178. * Sends a predefined number of unicast wifi packets to a given neighbour in
  179. * order to trigger the throughput estimation on this link by the RC algorithm.
  180. * Packets are sent only if there there is not enough payload unicast traffic
  181. * towards this neighbour..
  182. *
  183. * Return: True on success and false in case of error during skb preparation.
  184. */
  185. static bool
  186. batadv_v_elp_wifi_neigh_probe(struct batadv_hardif_neigh_node *neigh)
  187. {
  188. struct batadv_hard_iface *hard_iface = neigh->if_incoming;
  189. struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
  190. unsigned long last_tx_diff;
  191. struct sk_buff *skb;
  192. int probe_len, i;
  193. int elp_skb_len;
  194. /* this probing routine is for Wifi neighbours only */
  195. if (!batadv_is_wifi_hardif(hard_iface))
  196. return true;
  197. /* probe the neighbor only if no unicast packets have been sent
  198. * to it in the last 100 milliseconds: this is the rate control
  199. * algorithm sampling interval (minstrel). In this way, if not
  200. * enough traffic has been sent to the neighbor, batman-adv can
  201. * generate 2 probe packets and push the RC algorithm to perform
  202. * the sampling
  203. */
  204. last_tx_diff = jiffies_to_msecs(jiffies - neigh->bat_v.last_unicast_tx);
  205. if (last_tx_diff <= BATADV_ELP_PROBE_MAX_TX_DIFF)
  206. return true;
  207. probe_len = max_t(int, sizeof(struct batadv_elp_packet),
  208. BATADV_ELP_MIN_PROBE_SIZE);
  209. for (i = 0; i < BATADV_ELP_PROBES_PER_NODE; i++) {
  210. elp_skb_len = hard_iface->bat_v.elp_skb->len;
  211. skb = skb_copy_expand(hard_iface->bat_v.elp_skb, 0,
  212. probe_len - elp_skb_len,
  213. GFP_ATOMIC);
  214. if (!skb)
  215. return false;
  216. /* Tell the skb to get as big as the allocated space (we want
  217. * the packet to be exactly of that size to make the link
  218. * throughput estimation effective.
  219. */
  220. skb_put_zero(skb, probe_len - hard_iface->bat_v.elp_skb->len);
  221. batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
  222. "Sending unicast (probe) ELP packet on interface %s to %pM\n",
  223. hard_iface->net_dev->name, neigh->addr);
  224. batadv_send_skb_packet(skb, hard_iface, neigh->addr);
  225. }
  226. return true;
  227. }
  228. /**
  229. * batadv_v_elp_periodic_work() - ELP periodic task per interface
  230. * @work: work queue item
  231. *
  232. * Emits broadcast ELP message in regular intervals.
  233. */
  234. static void batadv_v_elp_periodic_work(struct work_struct *work)
  235. {
  236. struct batadv_hardif_neigh_node *hardif_neigh;
  237. struct batadv_hard_iface *hard_iface;
  238. struct batadv_hard_iface_bat_v *bat_v;
  239. struct batadv_elp_packet *elp_packet;
  240. struct batadv_priv *bat_priv;
  241. struct sk_buff *skb;
  242. u32 elp_interval;
  243. bool ret;
  244. bat_v = container_of(work, struct batadv_hard_iface_bat_v, elp_wq.work);
  245. hard_iface = container_of(bat_v, struct batadv_hard_iface, bat_v);
  246. bat_priv = netdev_priv(hard_iface->soft_iface);
  247. if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING)
  248. goto out;
  249. /* we are in the process of shutting this interface down */
  250. if (hard_iface->if_status == BATADV_IF_NOT_IN_USE ||
  251. hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)
  252. goto out;
  253. /* the interface was enabled but may not be ready yet */
  254. if (hard_iface->if_status != BATADV_IF_ACTIVE)
  255. goto restart_timer;
  256. skb = skb_copy(hard_iface->bat_v.elp_skb, GFP_ATOMIC);
  257. if (!skb)
  258. goto restart_timer;
  259. elp_packet = (struct batadv_elp_packet *)skb->data;
  260. elp_packet->seqno = htonl(atomic_read(&hard_iface->bat_v.elp_seqno));
  261. elp_interval = atomic_read(&hard_iface->bat_v.elp_interval);
  262. elp_packet->elp_interval = htonl(elp_interval);
  263. batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
  264. "Sending broadcast ELP packet on interface %s, seqno %u\n",
  265. hard_iface->net_dev->name,
  266. atomic_read(&hard_iface->bat_v.elp_seqno));
  267. batadv_send_broadcast_skb(skb, hard_iface);
  268. atomic_inc(&hard_iface->bat_v.elp_seqno);
  269. /* The throughput metric is updated on each sent packet. This way, if a
  270. * node is dead and no longer sends packets, batman-adv is still able to
  271. * react timely to its death.
  272. *
  273. * The throughput metric is updated by following these steps:
  274. * 1) if the hard_iface is wifi => send a number of unicast ELPs for
  275. * probing/sampling to each neighbor
  276. * 2) update the throughput metric value of each neighbor (note that the
  277. * value retrieved in this step might be 100ms old because the
  278. * probing packets at point 1) could still be in the HW queue)
  279. */
  280. rcu_read_lock();
  281. hlist_for_each_entry_rcu(hardif_neigh, &hard_iface->neigh_list, list) {
  282. if (!batadv_v_elp_wifi_neigh_probe(hardif_neigh))
  283. /* if something goes wrong while probing, better to stop
  284. * sending packets immediately and reschedule the task
  285. */
  286. break;
  287. if (!kref_get_unless_zero(&hardif_neigh->refcount))
  288. continue;
  289. /* Reading the estimated throughput from cfg80211 is a task that
  290. * may sleep and that is not allowed in an rcu protected
  291. * context. Therefore schedule a task for that.
  292. */
  293. ret = queue_work(batadv_event_workqueue,
  294. &hardif_neigh->bat_v.metric_work);
  295. if (!ret)
  296. batadv_hardif_neigh_put(hardif_neigh);
  297. }
  298. rcu_read_unlock();
  299. restart_timer:
  300. batadv_v_elp_start_timer(hard_iface);
  301. out:
  302. return;
  303. }
  304. /**
  305. * batadv_v_elp_iface_enable() - setup the ELP interface private resources
  306. * @hard_iface: interface for which the data has to be prepared
  307. *
  308. * Return: 0 on success or a -ENOMEM in case of failure.
  309. */
  310. int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface)
  311. {
  312. static const size_t tvlv_padding = sizeof(__be32);
  313. struct batadv_elp_packet *elp_packet;
  314. unsigned char *elp_buff;
  315. u32 random_seqno;
  316. size_t size;
  317. int res = -ENOMEM;
  318. size = ETH_HLEN + NET_IP_ALIGN + BATADV_ELP_HLEN + tvlv_padding;
  319. hard_iface->bat_v.elp_skb = dev_alloc_skb(size);
  320. if (!hard_iface->bat_v.elp_skb)
  321. goto out;
  322. skb_reserve(hard_iface->bat_v.elp_skb, ETH_HLEN + NET_IP_ALIGN);
  323. elp_buff = skb_put_zero(hard_iface->bat_v.elp_skb,
  324. BATADV_ELP_HLEN + tvlv_padding);
  325. elp_packet = (struct batadv_elp_packet *)elp_buff;
  326. elp_packet->packet_type = BATADV_ELP;
  327. elp_packet->version = BATADV_COMPAT_VERSION;
  328. /* randomize initial seqno to avoid collision */
  329. get_random_bytes(&random_seqno, sizeof(random_seqno));
  330. atomic_set(&hard_iface->bat_v.elp_seqno, random_seqno);
  331. /* assume full-duplex by default */
  332. hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;
  333. /* warn the user (again) if there is no throughput data is available */
  334. hard_iface->bat_v.flags &= ~BATADV_WARNING_DEFAULT;
  335. if (batadv_is_wifi_hardif(hard_iface))
  336. hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX;
  337. INIT_DELAYED_WORK(&hard_iface->bat_v.elp_wq,
  338. batadv_v_elp_periodic_work);
  339. batadv_v_elp_start_timer(hard_iface);
  340. res = 0;
  341. out:
  342. return res;
  343. }
  344. /**
  345. * batadv_v_elp_iface_disable() - release ELP interface private resources
  346. * @hard_iface: interface for which the resources have to be released
  347. */
  348. void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
  349. {
  350. cancel_delayed_work_sync(&hard_iface->bat_v.elp_wq);
  351. dev_kfree_skb(hard_iface->bat_v.elp_skb);
  352. hard_iface->bat_v.elp_skb = NULL;
  353. }
  354. /**
  355. * batadv_v_elp_iface_activate() - update the ELP buffer belonging to the given
  356. * hard-interface
  357. * @primary_iface: the new primary interface
  358. * @hard_iface: interface holding the to-be-updated buffer
  359. */
  360. void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
  361. struct batadv_hard_iface *hard_iface)
  362. {
  363. struct batadv_elp_packet *elp_packet;
  364. struct sk_buff *skb;
  365. if (!hard_iface->bat_v.elp_skb)
  366. return;
  367. skb = hard_iface->bat_v.elp_skb;
  368. elp_packet = (struct batadv_elp_packet *)skb->data;
  369. ether_addr_copy(elp_packet->orig,
  370. primary_iface->net_dev->dev_addr);
  371. }
  372. /**
  373. * batadv_v_elp_primary_iface_set() - change internal data to reflect the new
  374. * primary interface
  375. * @primary_iface: the new primary interface
  376. */
  377. void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
  378. {
  379. struct batadv_hard_iface *hard_iface;
  380. /* update orig field of every elp iface belonging to this mesh */
  381. rcu_read_lock();
  382. list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
  383. if (primary_iface->soft_iface != hard_iface->soft_iface)
  384. continue;
  385. batadv_v_elp_iface_activate(primary_iface, hard_iface);
  386. }
  387. rcu_read_unlock();
  388. }
  389. /**
  390. * batadv_v_elp_neigh_update() - update an ELP neighbour node
  391. * @bat_priv: the bat priv with all the soft interface information
  392. * @neigh_addr: the neighbour interface address
  393. * @if_incoming: the interface the packet was received through
  394. * @elp_packet: the received ELP packet
  395. *
  396. * Updates the ELP neighbour node state with the data received within the new
  397. * ELP packet.
  398. */
  399. static void batadv_v_elp_neigh_update(struct batadv_priv *bat_priv,
  400. u8 *neigh_addr,
  401. struct batadv_hard_iface *if_incoming,
  402. struct batadv_elp_packet *elp_packet)
  403. {
  404. struct batadv_neigh_node *neigh;
  405. struct batadv_orig_node *orig_neigh;
  406. struct batadv_hardif_neigh_node *hardif_neigh;
  407. s32 seqno_diff;
  408. s32 elp_latest_seqno;
  409. orig_neigh = batadv_v_ogm_orig_get(bat_priv, elp_packet->orig);
  410. if (!orig_neigh)
  411. return;
  412. neigh = batadv_neigh_node_get_or_create(orig_neigh,
  413. if_incoming, neigh_addr);
  414. if (!neigh)
  415. goto orig_free;
  416. hardif_neigh = batadv_hardif_neigh_get(if_incoming, neigh_addr);
  417. if (!hardif_neigh)
  418. goto neigh_free;
  419. elp_latest_seqno = hardif_neigh->bat_v.elp_latest_seqno;
  420. seqno_diff = ntohl(elp_packet->seqno) - elp_latest_seqno;
  421. /* known or older sequence numbers are ignored. However always adopt
  422. * if the router seems to have been restarted.
  423. */
  424. if (seqno_diff < 1 && seqno_diff > -BATADV_ELP_MAX_AGE)
  425. goto hardif_free;
  426. neigh->last_seen = jiffies;
  427. hardif_neigh->last_seen = jiffies;
  428. hardif_neigh->bat_v.elp_latest_seqno = ntohl(elp_packet->seqno);
  429. hardif_neigh->bat_v.elp_interval = ntohl(elp_packet->elp_interval);
  430. hardif_free:
  431. if (hardif_neigh)
  432. batadv_hardif_neigh_put(hardif_neigh);
  433. neigh_free:
  434. if (neigh)
  435. batadv_neigh_node_put(neigh);
  436. orig_free:
  437. if (orig_neigh)
  438. batadv_orig_node_put(orig_neigh);
  439. }
  440. /**
  441. * batadv_v_elp_packet_recv() - main ELP packet handler
  442. * @skb: the received packet
  443. * @if_incoming: the interface this packet was received through
  444. *
  445. * Return: NET_RX_SUCCESS and consumes the skb if the packet was peoperly
  446. * processed or NET_RX_DROP in case of failure.
  447. */
  448. int batadv_v_elp_packet_recv(struct sk_buff *skb,
  449. struct batadv_hard_iface *if_incoming)
  450. {
  451. struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
  452. struct batadv_elp_packet *elp_packet;
  453. struct batadv_hard_iface *primary_if;
  454. struct ethhdr *ethhdr = (struct ethhdr *)skb_mac_header(skb);
  455. bool res;
  456. int ret = NET_RX_DROP;
  457. res = batadv_check_management_packet(skb, if_incoming, BATADV_ELP_HLEN);
  458. if (!res)
  459. goto free_skb;
  460. if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
  461. goto free_skb;
  462. /* did we receive a B.A.T.M.A.N. V ELP packet on an interface
  463. * that does not have B.A.T.M.A.N. V ELP enabled ?
  464. */
  465. if (strcmp(bat_priv->algo_ops->name, "BATMAN_V") != 0)
  466. goto free_skb;
  467. elp_packet = (struct batadv_elp_packet *)skb->data;
  468. batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
  469. "Received ELP packet from %pM seqno %u ORIG: %pM\n",
  470. ethhdr->h_source, ntohl(elp_packet->seqno),
  471. elp_packet->orig);
  472. primary_if = batadv_primary_if_get_selected(bat_priv);
  473. if (!primary_if)
  474. goto free_skb;
  475. batadv_v_elp_neigh_update(bat_priv, ethhdr->h_source, if_incoming,
  476. elp_packet);
  477. ret = NET_RX_SUCCESS;
  478. batadv_hardif_put(primary_if);
  479. free_skb:
  480. if (ret == NET_RX_SUCCESS)
  481. consume_skb(skb);
  482. else
  483. kfree_skb(skb);
  484. return ret;
  485. }