Skip to content

Commit abf386a

Browse files
committed
feat(socket): Add some constants ARPHRD_*
Signed-off-by: Jianhui Zhao <[email protected]>
1 parent d8aa67f commit abf386a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

examples/netlink/link_dump.lua

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ while true do
4040
for k, v in pairs(info) do
4141
if k == 'flags' or k == 'change' then
4242
print(k .. ':', string.format('0x%x', v))
43+
elseif k == 'type' then
44+
if v == socket.ARPHRD_ETHER then
45+
print(k .. ':', 'ether')
46+
elseif v == socket.ARPHRD_LOOPBACK then
47+
print(k .. ':', 'loopback')
48+
elseif v == socket.ARPHRD_IEEE80211_RADIOTAP then
49+
print(k .. ':', 'ieee802.11/radiotap')
50+
else
51+
print(k .. ':', v)
52+
end
4353
else
4454
print(k .. ':', v)
4555
end

socket.c

+2
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,8 @@ int luaopen_eco_core_socket(lua_State *L)
11361136
lua_add_constant(L, "ETH_P_ALL", ETH_P_ALL);
11371137

11381138
lua_add_constant(L, "ARPHRD_ETHER", ARPHRD_ETHER);
1139+
lua_add_constant(L, "ARPHRD_LOOPBACK", ARPHRD_LOOPBACK);
1140+
lua_add_constant(L, "ARPHRD_IEEE80211_RADIOTAP", ARPHRD_IEEE80211_RADIOTAP);
11391141

11401142
lua_add_constant(L, "ARPOP_REQUEST", ARPOP_REQUEST);
11411143
lua_add_constant(L, "ARPOP_REPLY", ARPOP_REPLY);

0 commit comments

Comments
 (0)