mesh.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. // Copyright 2019 the Kilo authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package mesh
  15. import (
  16. "fmt"
  17. "io/ioutil"
  18. "net"
  19. "os"
  20. "sync"
  21. "time"
  22. "github.com/go-kit/kit/log"
  23. "github.com/go-kit/kit/log/level"
  24. "github.com/prometheus/client_golang/prometheus"
  25. "github.com/vishvananda/netlink"
  26. "github.com/squat/kilo/pkg/iproute"
  27. "github.com/squat/kilo/pkg/ipset"
  28. "github.com/squat/kilo/pkg/iptables"
  29. "github.com/squat/kilo/pkg/route"
  30. "github.com/squat/kilo/pkg/wireguard"
  31. )
  32. const resyncPeriod = 30 * time.Second
  33. const (
  34. // KiloPath is the directory where Kilo stores its configuration.
  35. KiloPath = "/var/lib/kilo"
  36. // PrivateKeyPath is the filepath where the WireGuard private key is stored.
  37. PrivateKeyPath = KiloPath + "/key"
  38. // ConfPath is the filepath where the WireGuard configuration is stored.
  39. ConfPath = KiloPath + "/conf"
  40. )
  41. // Granularity represents the abstraction level at which the network
  42. // should be meshed.
  43. type Granularity string
  44. // Encapsulate identifies what packets within a location should
  45. // be encapsulated.
  46. type Encapsulate string
  47. const (
  48. // DataCenterGranularity indicates that the network should create
  49. // a mesh between data-centers but not between nodes within a
  50. // single data-center.
  51. DataCenterGranularity Granularity = "data-center"
  52. // NodeGranularity indicates that the network should create
  53. // a mesh between every node.
  54. NodeGranularity Granularity = "node"
  55. // NeverEncapsulate indicates that no packets within a location
  56. // should be encapsulated.
  57. NeverEncapsulate Encapsulate = "never"
  58. // CrossSubnetEncapsulate indicates that only packets that
  59. // traverse subnets within a location should be encapsulated.
  60. CrossSubnetEncapsulate Encapsulate = "crosssubnet"
  61. // AlwaysEncapsulate indicates that all packets within a location
  62. // should be encapsulated.
  63. AlwaysEncapsulate Encapsulate = "always"
  64. )
  65. // Node represents a node in the network.
  66. type Node struct {
  67. ExternalIP *net.IPNet
  68. Key []byte
  69. InternalIP *net.IPNet
  70. // LastSeen is a Unix time for the last time
  71. // the node confirmed it was live.
  72. LastSeen int64
  73. // Leader is a suggestion to Kilo that
  74. // the node wants to lead its segment.
  75. Leader bool
  76. Location string
  77. Name string
  78. Subnet *net.IPNet
  79. }
  80. // Ready indicates whether or not the node is ready.
  81. func (n *Node) Ready() bool {
  82. return n != nil && n.ExternalIP != nil && n.Key != nil && n.InternalIP != nil && n.Subnet != nil && time.Now().Unix()-n.LastSeen < int64(resyncPeriod)*2/int64(time.Second)
  83. }
  84. // EventType describes what kind of an action an event represents.
  85. type EventType string
  86. const (
  87. // AddEvent represents an action where an item was added.
  88. AddEvent EventType = "add"
  89. // DeleteEvent represents an action where an item was removed.
  90. DeleteEvent EventType = "delete"
  91. // UpdateEvent represents an action where an item was updated.
  92. UpdateEvent EventType = "update"
  93. )
  94. // Event represents an update event concerning a node in the cluster.
  95. type Event struct {
  96. Type EventType
  97. Node *Node
  98. }
  99. // Backend can get nodes by name, init itself,
  100. // list the nodes that should be meshed,
  101. // set Kilo properties for a node,
  102. // clean up any changes applied to the backend,
  103. // and watch for changes to nodes.
  104. type Backend interface {
  105. CleanUp(string) error
  106. Get(string) (*Node, error)
  107. Init(<-chan struct{}) error
  108. List() ([]*Node, error)
  109. Set(string, *Node) error
  110. Watch() <-chan *Event
  111. }
  112. // Mesh is able to create Kilo network meshes.
  113. type Mesh struct {
  114. Backend
  115. encapsulate Encapsulate
  116. externalIP *net.IPNet
  117. granularity Granularity
  118. hostname string
  119. internalIP *net.IPNet
  120. ipset *ipset.Set
  121. ipTables *iptables.Controller
  122. kiloIface int
  123. key []byte
  124. local bool
  125. port int
  126. priv []byte
  127. privIface int
  128. pub []byte
  129. pubIface int
  130. stop chan struct{}
  131. subnet *net.IPNet
  132. table *route.Table
  133. tunlIface int
  134. // nodes is a mutable field in the struct
  135. // and needs to be guarded.
  136. nodes map[string]*Node
  137. mu sync.Mutex
  138. errorCounter *prometheus.CounterVec
  139. nodesGuage prometheus.Gauge
  140. logger log.Logger
  141. }
  142. // New returns a new Mesh instance.
  143. func New(backend Backend, encapsulate Encapsulate, granularity Granularity, hostname string, port int, subnet *net.IPNet, local bool, logger log.Logger) (*Mesh, error) {
  144. if err := os.MkdirAll(KiloPath, 0700); err != nil {
  145. return nil, fmt.Errorf("failed to create directory to store configuration: %v", err)
  146. }
  147. private, err := ioutil.ReadFile(PrivateKeyPath)
  148. if err != nil {
  149. level.Warn(logger).Log("msg", "no private key found on disk; generating one now")
  150. if private, err = wireguard.GenKey(); err != nil {
  151. return nil, err
  152. }
  153. }
  154. public, err := wireguard.PubKey(private)
  155. if err != nil {
  156. return nil, err
  157. }
  158. if err := ioutil.WriteFile(PrivateKeyPath, private, 0600); err != nil {
  159. return nil, fmt.Errorf("failed to write private key to disk: %v", err)
  160. }
  161. privateIP, publicIP, err := getIP(hostname)
  162. if err != nil {
  163. return nil, fmt.Errorf("failed to find public IP: %v", err)
  164. }
  165. ifaces, err := interfacesForIP(privateIP)
  166. if err != nil {
  167. return nil, fmt.Errorf("failed to find interface for private IP: %v", err)
  168. }
  169. privIface := ifaces[0].Index
  170. ifaces, err = interfacesForIP(publicIP)
  171. if err != nil {
  172. return nil, fmt.Errorf("failed to find interface for public IP: %v", err)
  173. }
  174. pubIface := ifaces[0].Index
  175. kiloIface, err := wireguard.New("kilo")
  176. if err != nil {
  177. return nil, fmt.Errorf("failed to create WireGuard interface: %v", err)
  178. }
  179. var tunlIface int
  180. if encapsulate != NeverEncapsulate {
  181. if tunlIface, err = iproute.NewIPIP(privIface); err != nil {
  182. return nil, fmt.Errorf("failed to create tunnel interface: %v", err)
  183. }
  184. if err := iproute.Set(tunlIface, true); err != nil {
  185. return nil, fmt.Errorf("failed to set tunnel interface up: %v", err)
  186. }
  187. }
  188. level.Debug(logger).Log("msg", fmt.Sprintf("using %s as the private IP address", privateIP.String()))
  189. level.Debug(logger).Log("msg", fmt.Sprintf("using %s as the public IP address", publicIP.String()))
  190. ipTables, err := iptables.New(len(subnet.IP))
  191. if err != nil {
  192. return nil, fmt.Errorf("failed to IP tables controller: %v", err)
  193. }
  194. return &Mesh{
  195. Backend: backend,
  196. encapsulate: encapsulate,
  197. externalIP: publicIP,
  198. granularity: granularity,
  199. hostname: hostname,
  200. internalIP: privateIP,
  201. // This is a patch until Calico supports
  202. // other hosts adding IPIP iptables rules.
  203. ipset: ipset.New("cali40all-hosts-net"),
  204. ipTables: ipTables,
  205. kiloIface: kiloIface,
  206. nodes: make(map[string]*Node),
  207. port: port,
  208. priv: private,
  209. privIface: privIface,
  210. pub: public,
  211. pubIface: pubIface,
  212. local: local,
  213. stop: make(chan struct{}),
  214. subnet: subnet,
  215. table: route.NewTable(),
  216. tunlIface: tunlIface,
  217. errorCounter: prometheus.NewCounterVec(prometheus.CounterOpts{
  218. Name: "kilo_errors_total",
  219. Help: "Number of errors that occurred while administering the mesh.",
  220. }, []string{"event"}),
  221. nodesGuage: prometheus.NewGauge(prometheus.GaugeOpts{
  222. Name: "kilo_nodes",
  223. Help: "Number of in the mesh.",
  224. }),
  225. logger: logger,
  226. }, nil
  227. }
  228. // Run starts the mesh.
  229. func (m *Mesh) Run() error {
  230. if err := m.Init(m.stop); err != nil {
  231. return fmt.Errorf("failed to initialize backend: %v", err)
  232. }
  233. ipsetErrors, err := m.ipset.Run(m.stop)
  234. if err != nil {
  235. return fmt.Errorf("failed to watch for ipset updates: %v", err)
  236. }
  237. ipTablesErrors, err := m.ipTables.Run(m.stop)
  238. if err != nil {
  239. return fmt.Errorf("failed to watch for IP tables updates: %v", err)
  240. }
  241. routeErrors, err := m.table.Run(m.stop)
  242. if err != nil {
  243. return fmt.Errorf("failed to watch for route table updates: %v", err)
  244. }
  245. go func() {
  246. for {
  247. var err error
  248. select {
  249. case err = <-ipsetErrors:
  250. case err = <-ipTablesErrors:
  251. case err = <-routeErrors:
  252. case <-m.stop:
  253. return
  254. }
  255. if err != nil {
  256. level.Error(m.logger).Log("error", err)
  257. m.errorCounter.WithLabelValues("run").Inc()
  258. }
  259. }
  260. }()
  261. defer m.cleanUp()
  262. t := time.NewTimer(resyncPeriod)
  263. w := m.Watch()
  264. for {
  265. var e *Event
  266. select {
  267. case e = <-w:
  268. m.sync(e)
  269. case <-t.C:
  270. m.checkIn()
  271. m.applyTopology()
  272. t.Reset(resyncPeriod)
  273. case <-m.stop:
  274. return nil
  275. }
  276. }
  277. }
  278. func (m *Mesh) sync(e *Event) {
  279. logger := log.With(m.logger, "event", e.Type)
  280. level.Debug(logger).Log("msg", "syncing", "event", e.Type)
  281. if isSelf(m.hostname, e.Node) {
  282. level.Debug(logger).Log("msg", "processing local node", "node", e.Node)
  283. m.handleLocal(e.Node)
  284. return
  285. }
  286. var diff bool
  287. m.mu.Lock()
  288. if !e.Node.Ready() {
  289. level.Debug(logger).Log("msg", "received incomplete node", "node", e.Node)
  290. // An existing node is no longer valid
  291. // so remove it from the mesh.
  292. if _, ok := m.nodes[e.Node.Name]; ok {
  293. level.Info(logger).Log("msg", "node is no longer in the mesh", "node", e.Node)
  294. delete(m.nodes, e.Node.Name)
  295. diff = true
  296. }
  297. } else {
  298. switch e.Type {
  299. case AddEvent:
  300. fallthrough
  301. case UpdateEvent:
  302. if !nodesAreEqual(m.nodes[e.Node.Name], e.Node) {
  303. m.nodes[e.Node.Name] = e.Node
  304. diff = true
  305. }
  306. case DeleteEvent:
  307. delete(m.nodes, e.Node.Name)
  308. diff = true
  309. }
  310. }
  311. m.mu.Unlock()
  312. if diff {
  313. level.Info(logger).Log("node", e.Node)
  314. m.applyTopology()
  315. }
  316. }
  317. // checkIn will try to update the local node's LastSeen timestamp
  318. // in the backend.
  319. func (m *Mesh) checkIn() {
  320. m.mu.Lock()
  321. n := m.nodes[m.hostname]
  322. m.mu.Unlock()
  323. if n == nil {
  324. level.Debug(m.logger).Log("msg", "no local node found in backend")
  325. return
  326. }
  327. n.LastSeen = time.Now().Unix()
  328. if err := m.Set(m.hostname, n); err != nil {
  329. level.Error(m.logger).Log("error", fmt.Sprintf("failed to set local node: %v", err), "node", n)
  330. m.errorCounter.WithLabelValues("checkin").Inc()
  331. return
  332. }
  333. level.Debug(m.logger).Log("msg", "successfully checked in local node in backend")
  334. }
  335. func (m *Mesh) handleLocal(n *Node) {
  336. // Allow the external IP to be overridden.
  337. if n.ExternalIP == nil {
  338. n.ExternalIP = m.externalIP
  339. }
  340. // Compare the given node to the calculated local node.
  341. // Take leader, location, and subnet from the argument, as these
  342. // are not determined by kilo.
  343. local := &Node{
  344. ExternalIP: n.ExternalIP,
  345. Key: m.pub,
  346. InternalIP: m.internalIP,
  347. LastSeen: time.Now().Unix(),
  348. Leader: n.Leader,
  349. Location: n.Location,
  350. Name: m.hostname,
  351. Subnet: n.Subnet,
  352. }
  353. if !nodesAreEqual(n, local) {
  354. level.Debug(m.logger).Log("msg", "local node differs from backend")
  355. if err := m.Set(m.hostname, local); err != nil {
  356. level.Error(m.logger).Log("error", fmt.Sprintf("failed to set local node: %v", err), "node", local)
  357. m.errorCounter.WithLabelValues("local").Inc()
  358. return
  359. }
  360. level.Debug(m.logger).Log("msg", "successfully reconciled local node against backend")
  361. }
  362. m.mu.Lock()
  363. n = m.nodes[m.hostname]
  364. if n == nil {
  365. n = &Node{}
  366. }
  367. m.mu.Unlock()
  368. if !nodesAreEqual(n, local) {
  369. m.mu.Lock()
  370. m.nodes[local.Name] = local
  371. m.mu.Unlock()
  372. m.applyTopology()
  373. }
  374. }
  375. func (m *Mesh) applyTopology() {
  376. m.mu.Lock()
  377. defer m.mu.Unlock()
  378. // Ensure all unready nodes are removed.
  379. var ready float64
  380. for n := range m.nodes {
  381. if !m.nodes[n].Ready() {
  382. delete(m.nodes, n)
  383. continue
  384. }
  385. ready++
  386. }
  387. m.nodesGuage.Set(ready)
  388. // We cannot do anything with the topology until the local node is available.
  389. if m.nodes[m.hostname] == nil {
  390. return
  391. }
  392. t, err := NewTopology(m.nodes, m.granularity, m.hostname, m.port, m.priv, m.subnet)
  393. if err != nil {
  394. level.Error(m.logger).Log("error", err)
  395. m.errorCounter.WithLabelValues("apply").Inc()
  396. return
  397. }
  398. conf, err := t.Conf()
  399. if err != nil {
  400. level.Error(m.logger).Log("error", err)
  401. m.errorCounter.WithLabelValues("apply").Inc()
  402. }
  403. if err := ioutil.WriteFile(ConfPath, conf, 0600); err != nil {
  404. level.Error(m.logger).Log("error", err)
  405. m.errorCounter.WithLabelValues("apply").Inc()
  406. return
  407. }
  408. var private *net.IPNet
  409. // If we are not encapsulating packets to the local private network,
  410. // then pass the private IP to add an exception to the NAT rule.
  411. if m.encapsulate != AlwaysEncapsulate {
  412. private = t.privateIP
  413. }
  414. rules := iptables.MasqueradeRules(private, m.nodes[m.hostname].Subnet, t.RemoteSubnets())
  415. rules = append(rules, iptables.ForwardRules(m.subnet)...)
  416. if err := m.ipTables.Set(rules); err != nil {
  417. level.Error(m.logger).Log("error", err)
  418. m.errorCounter.WithLabelValues("apply").Inc()
  419. return
  420. }
  421. if m.encapsulate != NeverEncapsulate {
  422. var peers []net.IP
  423. for _, s := range t.Segments {
  424. if s.Location == m.nodes[m.hostname].Location {
  425. peers = s.privateIPs
  426. break
  427. }
  428. }
  429. if err := m.ipset.Set(peers); err != nil {
  430. level.Error(m.logger).Log("error", err)
  431. m.errorCounter.WithLabelValues("apply").Inc()
  432. return
  433. }
  434. if m.local {
  435. if err := iproute.SetAddress(m.tunlIface, oneAddressCIDR(newAllocator(*m.nodes[m.hostname].Subnet).next().IP)); err != nil {
  436. level.Error(m.logger).Log("error", err)
  437. m.errorCounter.WithLabelValues("apply").Inc()
  438. return
  439. }
  440. }
  441. }
  442. if t.leader {
  443. if err := iproute.SetAddress(m.kiloIface, t.wireGuardCIDR); err != nil {
  444. level.Error(m.logger).Log("error", err)
  445. m.errorCounter.WithLabelValues("apply").Inc()
  446. return
  447. }
  448. link, err := linkByIndex(m.kiloIface)
  449. if err != nil {
  450. level.Error(m.logger).Log("error", err)
  451. m.errorCounter.WithLabelValues("apply").Inc()
  452. return
  453. }
  454. oldConf, err := wireguard.ShowConf(link.Attrs().Name)
  455. if err != nil {
  456. level.Error(m.logger).Log("error", err)
  457. m.errorCounter.WithLabelValues("apply").Inc()
  458. return
  459. }
  460. // Setting the WireGuard configuration interrupts existing connections
  461. // so only set the configuration if it has changed.
  462. equal, err := wireguard.CompareConf(conf, oldConf)
  463. if err != nil {
  464. level.Error(m.logger).Log("error", err)
  465. m.errorCounter.WithLabelValues("apply").Inc()
  466. // Don't return here, simply overwrite the old configuration.
  467. equal = false
  468. }
  469. if !equal {
  470. if err := wireguard.SetConf(link.Attrs().Name, ConfPath); err != nil {
  471. level.Error(m.logger).Log("error", err)
  472. m.errorCounter.WithLabelValues("apply").Inc()
  473. return
  474. }
  475. }
  476. if err := iproute.Set(m.kiloIface, true); err != nil {
  477. level.Error(m.logger).Log("error", err)
  478. m.errorCounter.WithLabelValues("apply").Inc()
  479. return
  480. }
  481. } else {
  482. level.Debug(m.logger).Log("msg", "local node is not the leader")
  483. if err := iproute.Set(m.kiloIface, false); err != nil {
  484. level.Error(m.logger).Log("error", err)
  485. m.errorCounter.WithLabelValues("apply").Inc()
  486. return
  487. }
  488. }
  489. // We need to add routes last since they may depend
  490. // on the WireGuard interface.
  491. routes := t.Routes(m.kiloIface, m.privIface, m.tunlIface, m.local, m.encapsulate)
  492. if err := m.table.Set(routes); err != nil {
  493. level.Error(m.logger).Log("error", err)
  494. m.errorCounter.WithLabelValues("apply").Inc()
  495. }
  496. }
  497. // RegisterMetrics registers Prometheus metrics on the given Prometheus
  498. // registerer.
  499. func (m *Mesh) RegisterMetrics(r prometheus.Registerer) {
  500. r.MustRegister(
  501. m.errorCounter,
  502. m.nodesGuage,
  503. )
  504. }
  505. // Stop stops the mesh.
  506. func (m *Mesh) Stop() {
  507. close(m.stop)
  508. }
  509. func (m *Mesh) cleanUp() {
  510. if err := m.ipTables.CleanUp(); err != nil {
  511. level.Error(m.logger).Log("error", fmt.Sprintf("failed to clean up IP tables: %v", err))
  512. m.errorCounter.WithLabelValues("cleanUp").Inc()
  513. }
  514. if err := m.table.CleanUp(); err != nil {
  515. level.Error(m.logger).Log("error", fmt.Sprintf("failed to clean up routes: %v", err))
  516. m.errorCounter.WithLabelValues("cleanUp").Inc()
  517. }
  518. if err := os.Remove(PrivateKeyPath); err != nil {
  519. level.Error(m.logger).Log("error", fmt.Sprintf("failed to delete private key: %v", err))
  520. m.errorCounter.WithLabelValues("cleanUp").Inc()
  521. }
  522. if err := os.Remove(ConfPath); err != nil {
  523. level.Error(m.logger).Log("error", fmt.Sprintf("failed to delete configuration file: %v", err))
  524. m.errorCounter.WithLabelValues("cleanUp").Inc()
  525. }
  526. if err := iproute.RemoveInterface(m.kiloIface); err != nil {
  527. level.Error(m.logger).Log("error", fmt.Sprintf("failed to remove wireguard interface: %v", err))
  528. m.errorCounter.WithLabelValues("cleanUp").Inc()
  529. }
  530. if err := m.CleanUp(m.hostname); err != nil {
  531. level.Error(m.logger).Log("error", fmt.Sprintf("failed to clean up backend: %v", err))
  532. m.errorCounter.WithLabelValues("cleanUp").Inc()
  533. }
  534. if err := m.ipset.CleanUp(); err != nil {
  535. level.Error(m.logger).Log("error", fmt.Sprintf("failed to clean up ipset: %v", err))
  536. m.errorCounter.WithLabelValues("cleanUp").Inc()
  537. }
  538. }
  539. func isSelf(hostname string, node *Node) bool {
  540. return node != nil && node.Name == hostname
  541. }
  542. func nodesAreEqual(a, b *Node) bool {
  543. if !(a != nil) == (b != nil) {
  544. return false
  545. }
  546. if a == b {
  547. return true
  548. }
  549. // Ignore LastSeen when comparing equality.
  550. return ipNetsEqual(a.ExternalIP, b.ExternalIP) && string(a.Key) == string(b.Key) && ipNetsEqual(a.InternalIP, b.InternalIP) && a.Leader == b.Leader && a.Location == b.Location && a.Name == b.Name && subnetsEqual(a.Subnet, b.Subnet)
  551. }
  552. func ipNetsEqual(a, b *net.IPNet) bool {
  553. if a == nil && b == nil {
  554. return true
  555. }
  556. if (a != nil) != (b != nil) {
  557. return false
  558. }
  559. if a.Mask.String() != b.Mask.String() {
  560. return false
  561. }
  562. return a.IP.Equal(b.IP)
  563. }
  564. func subnetsEqual(a, b *net.IPNet) bool {
  565. if a.Mask.String() != b.Mask.String() {
  566. return false
  567. }
  568. if !a.Contains(b.IP) {
  569. return false
  570. }
  571. if !b.Contains(a.IP) {
  572. return false
  573. }
  574. return true
  575. }
  576. func linkByIndex(index int) (netlink.Link, error) {
  577. link, err := netlink.LinkByIndex(index)
  578. if err != nil {
  579. return nil, fmt.Errorf("failed to get interface: %v", err)
  580. }
  581. return link, nil
  582. }