Unix Technical Forum

Re: how to manage ARP entries via ioctl(2) ?

This is a discussion on Re: how to manage ARP entries via ioctl(2) ? within the lucky.openbsd.tech forums, part of the OpenBSD category; --> On Thu, Aug 25, 2005 at 04:43:02PM +0300, oleyniko@jct.ac.il wrote: > how do i manage ARP entries via ioctl(2) ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > lucky.openbsd.tech

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2008, 12:45 PM
Claudio Jeker
 
Posts: n/a
Default Re: how to manage ARP entries via ioctl(2) ?

On Thu, Aug 25, 2005 at 04:43:02PM +0300, oleyniko@jct.ac.il wrote:
> how do i manage ARP entries via ioctl(2) in OpenBSD ?
> i have the folowing code that works in linux :
> ------start------------
> __int32_t func(__int32_t ip){
> #if defined(__OpenBSD__)|| defined(__NetBSD__)
> sockfd= socket(AF_INET,SOCK_DGRAM,0);
> #endif
> #if defined(__linux__)
> sockfd = socket(PF_INET,SOCK_DGRAM,0);
> #endif
> <... check return value ...>
>
> addr = (struct sockaddr_in*)&arp_req.arp_pa;
> bzero((void*)addr,sizeof(struct sockaddr_in));
>
> #if defined (__OpenBSD__)||defined(__NetBSD__)
> addr->sin_family = AF_INET;
> #endif
> #if defined (__linux__)
> addr->sin_family = PF_INET;
> #endif
>
> addr->sin_addr.s_addr = ip;
> ret_val = ioctl(sockfd, SIOCDARP,&arp_req);
> <... check return value ...>
> close(sockdf);
> return 0;
> }
> ----end--------------
>
> however i cannot even compile it under OpenBSD . the message i'm getting is
> :
> SIOCDARP : undaclared .
>
> i've looked at OpenBSD's arp.c and have not found and call ioctl(2) .
>
> can anybody explain me how ARP entries are managed in OpenBSD's arp.c ?
>


Via the routing socket: s = socket(PF_ROUTE, SOCK_RAW, 0);
Using ioctl() for routing changes is archaic and dead since the BSD 4.4
times.

--
:wq Claudio

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:28 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com