MCPcopy Create free account
hub / github.com/bsauce/kernel-exploit-factory / network_interface_up

Function network_interface_up

CVE-2025-21702/exploit/exploit.c:623–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621}
622
623void network_interface_up(const char *ifname)
624{
625 struct ifreq ifr = {};
626 strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
627 int sockfd = Socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
628 if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) < 0) { // SIOCGIFFLAGS - 请求获取网络接口的标志位
629 perror("ioctl(SIOCGIFFLAGS)");
630 exit(EXIT_FAILURE);
631 }
632
633 strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
634 ifr.ifr_flags |= (IFF_UP | IFF_RUNNING);
635 if (ioctl(sockfd, SIOCSIFFLAGS, &ifr) < 0) { // SIOCSIFFLAGS - 设置接口标志
636 perror("ioctl(SIOCSIFFLAGS)");
637 exit(EXIT_FAILURE);
638 }
639}
640
641void create_dummy_network_interface(struct mnl_socket *route_socket, const char *ifname, u32 tx_queues, u32 mtu)
642{ // 对应的内核处理函数是 __rtnl_newlink() - 可看出输入结构: nlmsghdr + ifinfomsg + IFLA_LINKINFO

Calls 1

SocketFunction · 0.85

Tested by

no test coverage detected