Skip to content

Commit

Permalink
Find destination MAC by IP in traceflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangYW18 committed Jul 27, 2020
1 parent acf42de commit 3bf05af
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/agent/controller/traceflow/traceflow_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,12 @@ func (c *Controller) injectPacket(tf *opsv1alpha1.Traceflow) error {
dstMAC := ""
dstIP := tf.Spec.Destination.IP
dstNodeIP := ""
// TODO: Find MAC by dstIP
if dstIP == "" {
if dstIP != "" {
dstPodInterface, hasInterface := c.interfaceStore.GetInterfaceByIP(dstIP)
if hasInterface {
dstMAC = dstPodInterface.MAC.String()
}
} else {
dstPodInterfaces := c.interfaceStore.GetContainerInterfacesByPod(tf.Spec.Destination.Pod, tf.Spec.Destination.Namespace)
if len(dstPodInterfaces) > 0 {
dstMAC = dstPodInterfaces[0].MAC.String()
Expand Down

0 comments on commit 3bf05af

Please sign in to comment.