blakegardner / php-mac-address Goto Github PK
View Code? Open in Web Editor NEWA PHP library to get, validate and generate MAC addresses.
License: MIT License
A PHP library to get, validate and generate MAC addresses.
License: MIT License
boolean false
string '00:A1:0A:F7:91:D4' (length=17)
boolean true
boolean false
boolean false
When this package is used on an OpenVZ virtual server with virtual interfaces it incorrectly detects venet0
as the interface for grabbing the MAC address from even though the VPS has an eth0 interface I manually create for that purpose. Since virtual interfaces venet0
and venet0:0
can not have a MAC address it fails to grab it.
ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 127.0.0.2 netmask 255.255.255.255 broadcast 0.0.0.0
ether 00:17:54:7b:b6:4c txqueuelen 0 (Ethernet)
RX packets 1 bytes 76 (76.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 168 (168.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 0 (Local Loopback)
RX packets 26549593 bytes 3905852680 (3.6 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 26549593 bytes 3905852680 (3.6 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500
inet 127.0.0.1 netmask 255.255.255.255 broadcast 0.0.0.0 destination 127.0.0.1
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC)
RX packets 17385507 bytes 5207240613 (4.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15444595 bytes 2569783211 (2.3 GiB)
TX errors 0 dropped 45 overruns 0 carrier 0 collisions 0
venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500
inet 77.25.34.23 netmask 255.255.255.255 broadcast 77.25.34.23 destination 77.25.34.23
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC
The above MAC and public IP have been changed and are not my real ones. The eth0
interface was created for this container, specifically for attaching a MAC address to, using the following command on the physical server. $VEID
is the virtual server ID #.
vzctl set $VEID --netif_add eth0 --save
I would be helpful if this package was updated to ignore virtual interfaces, such as venet0
and venet0:0
, and only detect MAC capable interfaces, if they exist, instead.
Code
// require the class
require_once $_SERVER['DOCUMENT_ROOT'].'/src/BlakeGardner/MacAddress.php';
// import the class
use BlakeGardner\MacAddress;
var_dump(MacAddress::getCurrentMacAddress('eth0'));
/Code
returns bool(false)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.