gratuitousARP sends gratuitous ARP messages at regular intervals, if this node is the HA master.
()
| 331 | // gratuitousARP sends gratuitous ARP messages at regular intervals, if this |
| 332 | // node is the HA master. |
| 333 | func (e *Engine) gratuitousARP() { |
| 334 | arpTicker := time.NewTicker(e.config.GratuitousARPInterval) |
| 335 | var announced bool |
| 336 | for { |
| 337 | select { |
| 338 | case <-arpTicker.C: |
| 339 | if e.haManager.state() != spb.HaState_LEADER { |
| 340 | if announced { |
| 341 | log.Info("Stopping gratuitous ARPs") |
| 342 | announced = false |
| 343 | } |
| 344 | continue |
| 345 | } |
| 346 | if !announced { |
| 347 | log.Infof("Starting gratuitous ARPs every %s", e.config.GratuitousARPInterval) |
| 348 | announced = true |
| 349 | } |
| 350 | e.arpLock.Lock() |
| 351 | arpMap := e.arpMap |
| 352 | e.arpLock.Unlock() |
| 353 | if err := e.ncc.ARPSendGratuitous(arpMap); err != nil { |
| 354 | log.Fatalf("Failed to send gratuitous ARP: %v", err) |
| 355 | } |
| 356 | |
| 357 | case <-e.shutdownARP: |
| 358 | e.shutdownARP <- true |
| 359 | return |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | // manager is responsible for managing and co-ordinating various parts of the |
| 365 | // seesaw engine. |
no test coverage detected