1
0
Fork 0
mirror of https://passt.top/passt synced 2025-05-31 13:25:34 +02:00

treewide: Rename MAC address fields for clarity

c->mac isn't a great name, because it doesn't say whose mac address it is
and it's not necessarily obvious in all the contexts we use it.  Since this
is specifically the address that we (passt/pasta) use on the tap interface,
rename it to "our_tap_mac".  Rename the "mac_guest" field to "guest_mac"
to be grammatically consistent.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2024-08-21 14:19:59 +10:00 committed by Stefano Brivio
parent 066e69986b
commit 905ecd2b0b
8 changed files with 28 additions and 26 deletions

10
conf.c
View file

@ -956,7 +956,7 @@ static void conf_print(const struct ctx *c)
info("Namespace interface: %s", c->pasta_ifn);
info("MAC:");
info(" host: %s", eth_ntop(c->mac, bufmac, sizeof(bufmac)));
info(" host: %s", eth_ntop(c->our_tap_mac, bufmac, sizeof(bufmac)));
if (c->ifi4) {
if (!c->no_dhcp) {
@ -1289,7 +1289,7 @@ void conf(struct ctx *c, int argc, char **argv)
if (c->mode != MODE_PASTA)
die("--ns-mac-addr is for pasta mode only");
parse_mac(c->mac_guest, optarg);
parse_mac(c->guest_mac, optarg);
break;
case 5:
if (c->mode != MODE_PASTA)
@ -1500,7 +1500,7 @@ void conf(struct ctx *c, int argc, char **argv)
break;
case 'M':
parse_mac(c->mac, optarg);
parse_mac(c->our_tap_mac, optarg);
break;
case 'g':
if (inet_pton(AF_INET6, optarg, &c->ip6.gw) &&
@ -1629,9 +1629,9 @@ void conf(struct ctx *c, int argc, char **argv)
nl_sock_init(c, false);
if (!v6_only)
c->ifi4 = conf_ip4(ifi4, &c->ip4, c->mac);
c->ifi4 = conf_ip4(ifi4, &c->ip4, c->our_tap_mac);
if (!v4_only)
c->ifi6 = conf_ip6(ifi6, &c->ip6, c->mac);
c->ifi6 = conf_ip6(ifi6, &c->ip6, c->our_tap_mac);
if ((!c->ifi4 && !c->ifi6) ||
(*c->ip4.ifname_out && !c->ifi4) ||
(*c->ip6.ifname_out && !c->ifi6))