Skip to content

Commit

Permalink
fix: update guestinfo on incoming ping
Browse files Browse the repository at this point in the history
On incoming ping request send updated guest info. Exclude NIC info,
since that is already sent on incoming broadcastIP option request.

Signed-off-by: Robin Elfrink <robin.elfrink@eu.equinix.com>
  • Loading branch information
robinelfrink committed Oct 25, 2024
1 parent e8050cd commit 6bc5278
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/tboxcmds/guestinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,16 @@ func (cmd *GuestInfoCommands) PushGuestInfo() {
cmd.SendGuestInfoNIC()
}

// PingHandler pushes updated guest info on ping request.
func (cmd *GuestInfoCommands) PingHandler([]byte) ([]byte, error) {
cmd.SendGuestInfoDNSName()
cmd.SendGuestInfoOSNameFull()
cmd.SendGuestInfoOSName()
cmd.SendGuestInfoUptime()

return nil, nil
}

// RegisterGuestInfoCommands registers the guest info commands.
func RegisterGuestInfoCommands(svc *nanotoolbox.Service, delegate NicDelegate) {
cmd := &GuestInfoCommands{
Expand All @@ -220,6 +230,7 @@ func RegisterGuestInfoCommands(svc *nanotoolbox.Service, delegate NicDelegate) {
}
svc.RegisterResetHandler(cmd.PushGuestInfo)
svc.RegisterOptionHandler("broadcastIP", cmd.BroadcastIPOptionHandler)
svc.RegisterCommandHandler("ping", cmd.PingHandler)

// As stated in guestInfoServer.c, VMX expects uptime information in response
// to the capabilities request.
Expand Down

0 comments on commit 6bc5278

Please sign in to comment.