Re: Question on SOCK_RAW, implement a bpf->other host tee

From: Chuck Swiger (cswiger_at_mac.com)
Date: 07/17/04

  • Next message: Robert Watson: "Re: Question on SOCK_RAW, implement a bpf->other host tee"
    Date: Sat, 17 Jul 2004 15:43:55 -0400
    To: Don Bowman <don@sandvine.com>
    
    

    Don Bowman wrote:
    [ ... ]
    > Shouldn't the stack ARP for the destination
    > in my 'sendto', and fill in the ether header?

    By using SOCK_RAW, you are bypassing the IP layer (or PF_INET, whatever you
    wish to call it), which I think means that you are also bypassing the ARP
    lookup code which normally would do so.

    > The ether-source is filled in, presumably by
    > the driver.

    Yes, and probably recomputing the frame-level checksum, but that's about it.
    When using raw sockets, one should try to pass in a packet that is completely
    filled in. I've found using libnet (in ports as net/libnet) is a pretty
    reasonable way of constructing packets, if need be: you build a packet one ISO
    layer at a time, and it will fill in the things not being handled when using
    SOCK_RAW.

    Oh, if it's easier to swap sender and dest addresses within an existing
    packet, say for ICMP ECHO_REQUEST :-), by all means do so. Still, libnet and
    libpcap play nicely together.

    Is the problem that you don't know or have the MAC addr of the destination handy?

    -- 
    -Chuck
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
    

  • Next message: Robert Watson: "Re: Question on SOCK_RAW, implement a bpf->other host tee"

    Relevant Pages

    • RE: Transfer a sending packet to upper TCP/IP protocol layer in IM
      ... source and destination MAC addresses are the same for both IP versions. ... the destination NIC of IPv6 packet is the same as the destination NIC of my ... encapped IPv4 packet. ...
      (microsoft.public.development.device.drivers)
    • Re: TOE brain dump
      ... primarily over ATMish core networks. ... "if you can't find header address ... the flow, if you can find a VC from cache, send the packet there" ... destination node address selector bits in header, ...
      (Linux-Kernel)
    • Re: site to site vpn with internal NAT
      ... :interface. ... :192.168.1.101 tries to contact a peer on the remote side, ... so the *destination* IP 192.168.49.x will be changed to the destination ... and since there is a match, the packet will go out over the VPN. ...
      (comp.dcom.sys.cisco)
    • RE: Transfer a sending packet to upper TCP/IP protocol layer in IM
      ... the destination NIC of IPv6 packet is the same as the destination NIC of my ... encapped IPv4 packet. ... you should clearly realize that emulating non-existent IPv6 ...
      (microsoft.public.development.device.drivers)
    • IPFilter 5.0.0 - feedback?
      ... rewrite - change both source and address fields for incoming or ... encap - encapsulated the packet in a new IP header (this will be ... encap is pretty much the same as divert, minus the port numbers to ... REWRITING SOURCE AND DESTINATION ...
      (freebsd-net)