gluon-core: primary-mac: replace all eth0/eth1 lookups with lan/wan
The netdev() lookup is confusing to use: whenever a interface does not exist during boot (for example VLAN) or when the address is overridden from board.json (which is not obvious at all), it will yield either no address, or a different address than expected. To avoid this confusion, using board.json-based interface() is preferable. This converts all uses of netdev() to the corresponding lan/wan lookups, except for the final fallback for eth0.
This commit is contained in:
		
							parent
							
								
									02e4a13069
								
							
						
					
					
						commit
						e93dca7cb3
					
				| @ -57,14 +57,13 @@ end | ||||
| 
 | ||||
| -- Entries are matched in the order they are listed | ||||
| local primary_addrs = { | ||||
| 	{netdev('eth0'), { | ||||
| 		{'x86'}, | ||||
| 		{'brcm2708'}, | ||||
| 	{interface('lan'), { | ||||
| 		{'ar71xx', 'generic', { | ||||
| 			'a40', | ||||
| 			'a60', | ||||
| 			'archer-c25-v1', | ||||
| 			'archer-c60-v2', | ||||
| 			'archer-c5', | ||||
| 			'archer-c58-v1', | ||||
| 			'archer-c59-v1', | ||||
| 			'archer-c60-v1', | ||||
| 			'archer-c7', | ||||
| 			'archer-c7-v4', | ||||
| 			'archer-c7-v5', | ||||
| 			'carambola2', | ||||
| @ -77,11 +76,9 @@ local primary_addrs = { | ||||
| 			'mr1750v2', | ||||
| 			'om2p', | ||||
| 			'om2pv2', | ||||
| 			'om2pv4', | ||||
| 			'om2p-hs', | ||||
| 			'om2p-hsv2', | ||||
| 			'om2p-hsv3', | ||||
| 			'om2p-hsv4', | ||||
| 			'om2p-lc', | ||||
| 			'om5p', | ||||
| 			'om5p-an', | ||||
| @ -99,31 +96,44 @@ local primary_addrs = { | ||||
| 			'glinet,gl-ar750s-nor', | ||||
| 			'ocedo,raccoon', | ||||
| 		}}, | ||||
| 		{'brcm2708'}, | ||||
| 		{'ipq40xx', 'generic', { | ||||
| 			'avm,fritzbox-4040', | ||||
| 		}}, | ||||
| 		{'ipq806x', 'generic', { | ||||
| 			'netgear,r7800', | ||||
| 		}}, | ||||
| 		{'lantiq', 'xway', { | ||||
| 			'netgear,dgn3500b', | ||||
| 		}}, | ||||
| 		{'ramips', 'mt7620', { | ||||
| 			'c20-v1', | ||||
| 			'c20i', | ||||
| 			'c50', | ||||
| 			'tplink,c2-v1', | ||||
| 		}}, | ||||
| 		{'x86'}, | ||||
| 	}}, | ||||
| 	{interface('wan'), { | ||||
| 		{'ar71xx', 'generic', { | ||||
| 			'a40', | ||||
| 			'a60', | ||||
| 			'archer-c25-v1', | ||||
| 			'archer-c60-v2', | ||||
| 			'om2pv4', | ||||
| 			'om2p-hsv4', | ||||
| 		}}, | ||||
| 		{'ipq40xx', 'generic', { | ||||
| 			'linksys,ea6350v3', | ||||
| 			'openmesh,a42', | ||||
| 			'openmesh,a62', | ||||
| 		}}, | ||||
| 		{'mpc85xx', 'p1020', { | ||||
| 			'aerohive,hiveap-330', | ||||
| 			'ocedo,panda', | ||||
| 		}}, | ||||
| 		{'ramips', 'mt7620', { | ||||
| 			'miwifi-mini', 'tplink,c2-v1', 'c20-v1', 'c20i', 'c50', | ||||
| 		}}, | ||||
| 	}}, | ||||
| 	{netdev('eth0'), { | ||||
| 		{'ar71xx', 'generic', { | ||||
| 			'archer-c5', | ||||
| 			'archer-c58-v1', | ||||
| 			'archer-c59-v1', | ||||
| 			'archer-c60-v1', | ||||
| 			'archer-c7', | ||||
| 		}}, | ||||
| 		{'ipq806x', 'generic', { | ||||
| 			'netgear,r7800', | ||||
| 		}}, | ||||
| 		{'mpc85xx', 'p1020', { | ||||
| 			'ocedo,panda', | ||||
| 			'miwifi-mini', | ||||
| 		}}, | ||||
| 	}}, | ||||
| 	{phy(1), { | ||||
| @ -136,16 +146,6 @@ local primary_addrs = { | ||||
| 			'dir-860l-b1', | ||||
| 		}}, | ||||
| 	}}, | ||||
| 	{interface('lan'), { | ||||
| 		{'lantiq', 'xway', { | ||||
| 			'netgear,dgn3500b', | ||||
| 		}}, | ||||
| 	}}, | ||||
| 	{board('wan'), { | ||||
| 		{'ipq40xx', 'generic', { | ||||
| 			'linksys,ea6350v3', | ||||
| 		}}, | ||||
| 	}}, | ||||
| 	-- phy0 default | ||||
| 	{phy(0), { | ||||
| 		{}, -- matches everything | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user