# \[bug query\] duplication mac address in hosts metadata - concern?

**URL:** <https://discuss.elastic.co/t/bug-query-duplication-mac-address-in-hosts-metadata-concern/278370>\
**Category:** Beats\
**Tags:** libbeat\
**Created:** [July 11, 2021, 11:03pm UTC](https://discuss.elastic.co/t/bug-query-duplication-mac-address-in-hosts-metadata-concern/278370 "2021-07-11T23:03:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kortschak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kortschak/32/91487_2.png) [@kortschak](https://discuss.elastic.co/u/kortschak)\
**Post date:** [July 11, 2021, 11:03pm UTC](https://discuss.elastic.co/t/bug-query-duplication-mac-address-in-hosts-metadata-concern/278370/1 "2021-07-11T23:03:44Z")

</div>

Hi,

While working through the [creating a beat tutorial](https://www.elastic.co/guide/en/beats/devguide/current/new-beat.html) I noticed that mac addresses may be duplicated in the hosts metadata on linux. This occurs for virbr interfaces due to virtual bridges generating two interfaces, sharing the same hardware address.

```auto
$ ip addr show | grep -A1 ': virb'
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:bf:91:c4 brd ff:ff:ff:ff:ff:ff
--
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:bf:91:c4 brd ff:ff:ff:ff:ff:ff

```

The function that collates network interface info, [`util.GetNetInfo`](https://github.com/elastic/beats/blob/4933aef29ae45f75930af62a27f066be418aa733/libbeat/processors/util/netinfo.go#L27-L67), assumes that addresses are unique or is not concerned whether they are.

This shows up as so

```auto
  "host": {
<snip>
    "containerized": false,
    "ip": [
<snip>
    ],
    "mac": [
<snip>
      "52:54:00:bf:91:c4",
      "52:54:00:bf:91:c4",
<snip>
    ],

```

My question is whether this is a concern worth fixing (the fix is trivial and I'm happy to send a PR for it) or whether it's both infrequent enough (only hosts with virtual bridges will see it) and innocuous enough to not bother with.

thanks

---

<div class="post-metadata">

**Author:** ![legoguy1000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/legoguy1000/32/54301_2.png) [@legoguy1000](https://discuss.elastic.co/u/legoguy1000)\
**Post date:** [July 13, 2021, 12:51pm UTC](https://discuss.elastic.co/t/bug-query-duplication-mac-address-in-hosts-metadata-concern/278370/2 "2021-07-13T12:51:00Z")

</div>

I'd say it's not a bad thing to fix. There's no reason to have duplicated values.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 10, 2021, 2:51pm UTC](https://discuss.elastic.co/t/bug-query-duplication-mac-address-in-hosts-metadata-concern/278370/3 "2021-08-10T14:51:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
