Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 2002 22:46:09 -0700
From:      "Crist J. Clark" <cjc@FreeBSD.ORG>
To:        Matt Impett <M.Impett@flarion.com>
Cc:        "'freebsd-net@FreeBSD.org'" <freebsd-net@FreeBSD.ORG>
Subject:   Re: source MAC address
Message-ID:  <20020502224609.A71286@blossom.cjclark.org>
In-Reply-To: <8C92E23A3E87FB479988285F9E22BE460236AE@ftmail>; from M.Impett@flarion.com on Thu, May 02, 2002 at 11:26:16AM -0400
References:  <8C92E23A3E87FB479988285F9E22BE460236AE@ftmail>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 02, 2002 at 11:26:16AM -0400, Matt Impett wrote:
> Hello all,
> 
> I am implementing mobileIP in user space on freeBSD and was curious about
> something.  In order to do mobileIP IP address assignment, my process on
> freeBSD has to be able to receive an IP packet and learn the source MAC
> address that it came from (I am sure that the packet is only going one hop).
> I have been able to do this using the BPF device, but am concerned about a
> few things:
> 1)  When using the BPF device, the IP packet still goes to the IP stack, and
> since I am no longer listening on the UDP port number, a ICMP port
> unreachable is sent.  I guess I could us ip_fw to fix this.

By the time the system learns its IP address, you can open up a UDP
socket and listen there. No need to use bpf(4). No ICMP unreachable
sent. In the initial phases, before the system learns its IP, this is
when you need to use bpf(4), but the system won't generate ICMP
unreachable since the packet doesn't go to the IP stack.

> 2)  When using the BPF device, I am bypassing the IP stack.  Therefore, I am
> losing things like reassembly, IPSEC, etc..

Make sure you don't need those things in the bootstrapping phases. ;)

> Is there another way to get this info up to an application without using
> BPF?

Even the dhclient(8) uses bpf(4) now. I seems to be the best tool for
the job.

> Likewise, I also want to be able to force IP packets out to a particular MAC
> address, regardless of the IP destination address of the packet.  Once
> again, I know BPF can do this, but then I have similar concerns to the ones
> above.  For example, what do I set the IP ID field to??

IP ID? Set the DF bit, then the IP ID field won't ever be used. Set it
to zero or the constant value of your choice.
-- 
Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020502224609.A71286>