Skip to content

Instantly share code, notes, and snippets.

@userid
userid / netlink1.c
Last active August 15, 2025 09:18
使用rtnetlink监听和判断网卡的状态变化
/**
http://guochongxin.github.io/c/c/c++/linux/netlink/rj45/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/%E7%BD%91%E5%8D%A1/2014/12/05/tong_guo_netlink_jian_ce_wang_xian_cha_ba
最近有个需求需要检测RJ45网卡的网线有没有接上而最近正在了解Netlink相关资料刚好也看下通过Netlink可以进行检测故在此做下粗略笔记
1.首先要创建一个Netlink Socket在用户层使用如下参数来调用socket()函数
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
@eamirgh
eamirgh / gist:650f86393b1826dd5c5e5fc68dd5f06e
Last active September 6, 2025 16:51
RESET Goland Evaluation period LINUX
rm -rf ~/.config/JetBrains/GoLand2021.3/eval
rm -rf ~/.config/JetBrains/GoLand2021.3/options/other.xml
touch ~/.config/JetBrains/GoLand2021.3/options/other.xml
sed -i -E 's/<property name=\"evl.*\".*\/>//' ~/.config/JetBrains/GoLand2021.3/options/other.xml
rm -rf ~/.java/.userPrefs/jetbrains/goland