shill: Make the default Connection::metric_ work on IPv6

The kernel's IPv4 implementation allows routes with metric 0 to be
created, but the kernel's IPv6 implementation changes metric 0
routes to metric 1024.  This causes shill's route cache to get out
of sync with the running kernel, causing the default IPv6 route to
be unexpectedly deleted under some circumstances.  Fix this by
defaulting to kNonDefaultMetricBase (10) instead of 0.

BUG=chromium:727242
TEST=manually hack device.cc to delay IPv4 address assignment, then
     check the logs to see what happens when UpdateFromIPConfig() is
     run on an IPv6 configuration
TEST=unit tests

Change-Id: Iac4d6ef3a881f2820a4ef4dd3fdda6475937d5f9
Reviewed-on: https://chromium-review.googlesource.com/580643
Commit-Ready: Kevin Cernekee <cernekee@chromium.org>
Tested-by: Kevin Cernekee <cernekee@chromium.org>
Reviewed-by: Kevin Cernekee <cernekee@chromium.org>
2 files changed
tree: 4601ca3c908f2c631ddad305da934f5f4a7514aa
  1. bin/
  2. cellular/
  3. dbus/
  4. dbus_bindings/
  5. dhcp/
  6. doc/
  7. ethernet/
  8. init/
  9. mobile_operator_db/
  10. net/
  11. pppoe/
  12. setup_wifi/
  13. shims/
  14. supplicant/
  15. test-rpc-proxy/
  16. test-scripts/
  17. udev/
  18. upstart/
  19. vpn/
  20. wifi/
  21. wimax/
  22. .gitignore
  23. accessor_interface.h
  24. active_link_monitor.cc
  25. active_link_monitor.h
  26. active_link_monitor_unittest.cc
  27. adaptor_interfaces.h
  28. async_connection.cc
  29. async_connection.h
  30. async_connection_unittest.cc
  31. callbacks.h
  32. certificate_file.cc
  33. certificate_file.h
  34. certificate_file_unittest.cc
  35. connection.cc
  36. connection.h
  37. connection_diagnostics.cc
  38. connection_diagnostics.h
  39. connection_diagnostics_unittest.cc
  40. connection_health_checker.cc
  41. connection_health_checker.h
  42. connection_health_checker_unittest.cc
  43. connection_info.cc
  44. connection_info.h
  45. connection_info_reader.cc
  46. connection_info_reader.h
  47. connection_info_reader_unittest.cc
  48. connection_info_unittest.cc
  49. connection_tester.cc
  50. connection_tester.h
  51. connection_tester_unittest.cc
  52. connection_unittest.cc
  53. connectivity_trial.cc
  54. connectivity_trial.h
  55. connectivity_trial_unittest.cc
  56. control_interface.h
  57. crypto_des_cbc.cc
  58. crypto_des_cbc.h
  59. crypto_des_cbc_unittest.cc
  60. crypto_interface.h
  61. crypto_provider.cc
  62. crypto_provider.h
  63. crypto_provider_unittest.cc
  64. crypto_rot47.cc
  65. crypto_rot47.h
  66. crypto_rot47_unittest.cc
  67. crypto_util_proxy.cc
  68. crypto_util_proxy.h
  69. crypto_util_proxy_unittest.cc
  70. daemon_task.cc
  71. daemon_task.h
  72. daemon_task_unittest.cc
  73. dbus_properties_proxy_interface.h
  74. default_profile.cc
  75. default_profile.h
  76. default_profile_unittest.cc
  77. device.cc
  78. device.h
  79. device_claimer.cc
  80. device_claimer.h
  81. device_claimer_unittest.cc
  82. device_info.cc
  83. device_info.h
  84. device_info_unittest.cc
  85. device_stub.h
  86. device_unittest.cc
  87. dns_client.cc
  88. dns_client.h
  89. dns_client_factory.cc
  90. dns_client_factory.h
  91. dns_client_unittest.cc
  92. dns_server_tester.cc
  93. dns_server_tester.h
  94. dns_server_tester_unittest.cc
  95. eap_credentials.cc
  96. eap_credentials.h
  97. eap_credentials_unittest.cc
  98. eap_listener.cc
  99. eap_listener.h
  100. eap_listener_unittest.cc
  101. eap_protocol.h
  102. ephemeral_profile.cc
  103. ephemeral_profile.h
  104. error.cc
  105. error.h
  106. error_unittest.cc
  107. event_dispatcher.cc
  108. event_dispatcher.h
  109. external_task.cc
  110. external_task.h
  111. external_task_unittest.cc
  112. fake_store.cc
  113. fake_store.h
  114. file_io.cc
  115. file_io.h
  116. file_reader.cc
  117. file_reader.h
  118. file_reader_unittest.cc
  119. firewall_proxy_interface.h
  120. geolocation_info.cc
  121. geolocation_info.h
  122. HACKING
  123. hook_table.cc
  124. hook_table.h
  125. hook_table_unittest.cc
  126. http_request.cc
  127. http_request.h
  128. http_request_unittest.cc
  129. http_url.cc
  130. http_url.h
  131. http_url_unittest.cc
  132. icmp.cc
  133. icmp.h
  134. icmp_session.cc
  135. icmp_session.h
  136. icmp_session_factory.cc
  137. icmp_session_factory.h
  138. icmp_session_unittest.cc
  139. icmp_unittest.cc
  140. ip_address_store.cc
  141. ip_address_store.h
  142. ip_address_store_unittest.cc
  143. ipconfig.cc
  144. ipconfig.h
  145. ipconfig_unittest.cc
  146. json_store.cc
  147. json_store.h
  148. json_store_unittest.cc
  149. key_file_store.cc
  150. key_file_store.h
  151. key_file_store_unittest.cc
  152. key_value_store.cc
  153. key_value_store.h
  154. key_value_store_unittest.cc
  155. libshill-client-test.pc.in
  156. libshill-client.pc.in
  157. link_monitor.cc
  158. link_monitor.h
  159. link_monitor_unittest.cc
  160. logging.cc
  161. logging.h
  162. manager.cc
  163. manager.h
  164. manager_unittest.cc
  165. metrics.cc
  166. metrics.h
  167. metrics_unittest.cc
  168. mock_active_link_monitor.cc
  169. mock_active_link_monitor.h
  170. mock_adaptors.cc
  171. mock_adaptors.h
  172. mock_ares.cc
  173. mock_ares.h
  174. mock_async_connection.cc
  175. mock_async_connection.h
  176. mock_certificate_file.cc
  177. mock_certificate_file.h
  178. mock_connection.cc
  179. mock_connection.h
  180. mock_connection_health_checker.cc
  181. mock_connection_health_checker.h
  182. mock_connection_info_reader.cc
  183. mock_connection_info_reader.h
  184. mock_connectivity_trial.cc
  185. mock_connectivity_trial.h
  186. mock_control.cc
  187. mock_control.h
  188. mock_crypto_util_proxy.cc
  189. mock_crypto_util_proxy.h
  190. mock_dbus_properties_proxy.cc
  191. mock_dbus_properties_proxy.h
  192. mock_device.cc
  193. mock_device.h
  194. mock_device_claimer.cc
  195. mock_device_claimer.h
  196. mock_device_info.cc
  197. mock_device_info.h
  198. mock_dns_client.cc
  199. mock_dns_client.h
  200. mock_dns_client_factory.cc
  201. mock_dns_client_factory.h
  202. mock_dns_server_tester.cc
  203. mock_dns_server_tester.h
  204. mock_eap_credentials.cc
  205. mock_eap_credentials.h
  206. mock_eap_listener.cc
  207. mock_eap_listener.h
  208. mock_event_dispatcher.cc
  209. mock_event_dispatcher.h
  210. mock_external_task.cc
  211. mock_external_task.h
  212. mock_file_io.h
  213. mock_firewall_proxy.h
  214. mock_http_request.cc
  215. mock_http_request.h
  216. mock_icmp.cc
  217. mock_icmp.h
  218. mock_icmp_session.cc
  219. mock_icmp_session.h
  220. mock_icmp_session_factory.cc
  221. mock_icmp_session_factory.h
  222. mock_ip_address_store.cc
  223. mock_ip_address_store.h
  224. mock_ipconfig.cc
  225. mock_ipconfig.h
  226. mock_link_monitor.cc
  227. mock_link_monitor.h
  228. mock_log.cc
  229. mock_log.h
  230. mock_log_unittest.cc
  231. mock_manager.cc
  232. mock_manager.h
  233. mock_metrics.cc
  234. mock_metrics.h
  235. mock_passive_link_monitor.cc
  236. mock_passive_link_monitor.h
  237. mock_pending_activation_store.cc
  238. mock_pending_activation_store.h
  239. mock_portal_detector.cc
  240. mock_portal_detector.h
  241. mock_power_manager.cc
  242. mock_power_manager.h
  243. mock_power_manager_proxy.cc
  244. mock_power_manager_proxy.h
  245. mock_ppp_device.cc
  246. mock_ppp_device.h
  247. mock_ppp_device_factory.cc
  248. mock_ppp_device_factory.h
  249. mock_process_manager.cc
  250. mock_process_manager.h
  251. mock_profile.cc
  252. mock_profile.h
  253. mock_property_store.cc
  254. mock_property_store.h
  255. mock_resolver.cc
  256. mock_resolver.h
  257. mock_routing_table.cc
  258. mock_routing_table.h
  259. mock_service.cc
  260. mock_service.h
  261. mock_socket_info_reader.cc
  262. mock_socket_info_reader.h
  263. mock_store.cc
  264. mock_store.h
  265. mock_throttler.cc
  266. mock_throttler.h
  267. mock_traffic_monitor.cc
  268. mock_traffic_monitor.h
  269. mock_virtual_device.cc
  270. mock_virtual_device.h
  271. MODULE_LICENSE_APACHE2
  272. NETLINK_MESSAGES.txt
  273. nice_mock_control.cc
  274. nice_mock_control.h
  275. NOTICE
  276. OWNERS
  277. passive_link_monitor.cc
  278. passive_link_monitor.h
  279. passive_link_monitor_unittest.cc
  280. pending_activation_store.cc
  281. pending_activation_store.h
  282. pending_activation_store_unittest.cc
  283. portal_detector.cc
  284. portal_detector.h
  285. portal_detector_unittest.cc
  286. power_manager.cc
  287. power_manager.h
  288. power_manager_proxy_interface.h
  289. power_manager_unittest.cc
  290. ppp_daemon.cc
  291. ppp_daemon.h
  292. ppp_daemon_unittest.cc
  293. ppp_device.cc
  294. ppp_device.h
  295. ppp_device_factory.cc
  296. ppp_device_factory.h
  297. ppp_device_unittest.cc
  298. PRESUBMIT.cfg
  299. process_manager.cc
  300. process_manager.h
  301. process_manager_unittest.cc
  302. profile.cc
  303. profile.h
  304. profile_unittest.cc
  305. property_accessor.h
  306. property_accessor_unittest.cc
  307. property_iterator.h
  308. property_observer.h
  309. property_observer_interface.h
  310. property_observer_unittest.cc
  311. property_store.cc
  312. property_store.h
  313. property_store_unittest.cc
  314. property_store_unittest.h
  315. protobuf_lite_streams.cc
  316. protobuf_lite_streams.h
  317. provider_db_unittest.bfd
  318. provider_interface.h
  319. refptr_types.h
  320. resolver.cc
  321. resolver.h
  322. resolver_unittest.cc
  323. result_aggregator.cc
  324. result_aggregator.h
  325. result_aggregator_unittest.cc
  326. routing_table.cc
  327. routing_table.h
  328. routing_table_entry.h
  329. routing_table_unittest.cc
  330. rpc_service_watcher_interface.h
  331. rpc_task.cc
  332. rpc_task.h
  333. rpc_task_unittest.cc
  334. scope_logger.cc
  335. scope_logger.h
  336. scope_logger_unittest.cc
  337. scoped_umask.cc
  338. scoped_umask.h
  339. service.cc
  340. service.h
  341. service_property_change_notifier.cc
  342. service_property_change_notifier.h
  343. service_property_change_test.cc
  344. service_property_change_test.h
  345. service_sorter.h
  346. service_under_test.cc
  347. service_under_test.h
  348. service_unittest.cc
  349. shill-client.gyp
  350. shill.gyp
  351. shill.gypi
  352. shill_ares.cc
  353. shill_ares.h
  354. shill_config.cc
  355. shill_config.h
  356. shill_daemon.cc
  357. shill_daemon.h
  358. shill_main.cc
  359. shill_test_config.cc
  360. shill_test_config.h
  361. socket_info.cc
  362. socket_info.h
  363. socket_info_reader.cc
  364. socket_info_reader.h
  365. socket_info_reader_unittest.cc
  366. socket_info_unittest.cc
  367. static_ip_parameters.cc
  368. static_ip_parameters.h
  369. static_ip_parameters_unittest.cc
  370. store_interface.h
  371. stub_storage.h
  372. technology.cc
  373. technology.h
  374. technology_unittest.cc
  375. test_event_dispatcher.h
  376. TESTING
  377. testing.h
  378. testrunner.cc
  379. tethering.cc
  380. tethering.h
  381. throttler.cc
  382. throttler.h
  383. throttler_unittest.cc
  384. traffic_monitor.cc
  385. traffic_monitor.h
  386. traffic_monitor_unittest.cc
  387. virtual_device.cc
  388. virtual_device.h
  389. virtual_device_unittest.cc