lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 13 Apr 2009 20:41:45 +0300 From: Cosmin Ratiu <cratiu@...acom.com> To: netdev@...r.kernel.org Subject: SIOCSARP auto resolve Hello, Is there a way to make the kernel send an ARP request from a user space program? If not, then I'd like to hear your opinions on the patch below, which extends SIOCSARP with a flag ATF_AUTORESOLVE that when set, will send out an ARP request instead of adding an entry to the cache. Thanks, Cosmin. --- include/linux/if_arp.h +++ include/linux/if_arp.h @@ -124,6 +124,7 @@ #define ATF_NETMASK 0x20 /* want to use a netmask (only for proxy entries) */ #define ATF_DONTPUB 0x40 /* don't answer this addresses */ +#define ATF_AUTORESOLVE 0x80 /* send ARP request instead */ /* * This structure defines an ethernet arp header. --- net/ipv4/arp.c +++ net/ipv4/arp.c @@ -1028,13 +1028,18 @@ neigh = __neigh_lookup_errno(&arp_tbl, &ip, dev); err = PTR_ERR(neigh); if (!IS_ERR(neigh)) { - unsigned state = NUD_STALE; - if (r->arp_flags & ATF_PERM) - state = NUD_PERMANENT; - err = neigh_update(neigh, (r->arp_flags&ATF_COM) ? - r->arp_ha.sa_data : NULL, state, - NEIGH_UPDATE_F_OVERRIDE| - NEIGH_UPDATE_F_ADMIN); + if (r->arp_flags & ATF_AUTORESOLVE) { + neigh_event_send(neigh, NULL); + err = 0; + } else { + unsigned state = NUD_STALE; + if (r->arp_flags & ATF_PERM) + state = NUD_PERMANENT; + err = neigh_update(neigh, (r->arp_flags&ATF_COM) ? + r->arp_ha.sa_data : NULL, state, + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_ADMIN); + } neigh_release(neigh); } return err; -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists