From owner-freebsd-hackers Tue Nov 21 7:51: 6 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from online.dct.com (online.dct.com [204.29.185.1]) by hub.freebsd.org (Postfix) with ESMTP id 8B5F337B479; Tue, 21 Nov 2000 07:51:00 -0800 (PST) Received: (from markm@localhost) by online.dct.com (8.9.3/8.9.3) id JAA22896; Tue, 21 Nov 2000 09:50:53 -0600 (CST) Date: Tue, 21 Nov 2000 09:50:53 -0600 From: Mark To: Peter Pentchev Cc: questions@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: Systems programming questions... Message-ID: <20001121095053.B6568@online.dct.com> Reply-To: markm@gbonline.com References: <20001121092902.A6568@online.dct.com> <20001121173651.C9661@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <20001121173651.C9661@ringworld.oblivion.bg>; from roam@orbitel.bg on Tue, Nov 21, 2000 at 05:36:51PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Thus spake Peter Pentchev (roam@orbitel.bg): > On Tue, Nov 21, 2000 at 09:29:02AM -0600, Mark wrote: > > Hey all -- > > > > I'm trying to find a "correct" way to add virtual interfaces to my network > > card via a C program. right now, I've come up with 3 system() calls to do the > > work. I don't know if there is a better way or not, but if there is, I'd like > > to use it. Is there a better way to create and make active a virtual > > interface in a C program other than using system() to call an ifconfig, route, > > and arp command? > > Generally, the 'most correct' way to do almost anything regarding interfaces > can be found in the /sbin/ifconfig source. I do not really know why you > also need to do a route and arp though; I admin I know nothing about arp, > but I'm pretty sure that the FreeBSD kernel automagically installs a new route > for each newly-upped interface. > > Hope that helps.. Sure does... I guess I don't need the route and arp commands. Works just fine with the "ifconfig ... alias" system call. I guess the next step is to look at the source for /sbin/ifconfig, like you suggested. Thanks for the help, -- Mark Maurer markm@solinus.com Programmer, Solinus Inc. Play: markm@gbonline.com http://www.dct.com/~markm/ Other: mark@thecity.com mark@mail2go.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message