Wireless networking using sockets :Help !

Discussion in 'Linux Networking' started by devesh, Jan 10, 2005.

  1. devesh

    devesh Guest

    Hi,
    I am a newbie to writing networking programs over wireless. Firstly I
    am not sure if this is the appropriate group to post this , my
    apologies , can someone guide to appropriate groups which cover
    wireless using sockets ? .
    Basically what I have to do is this : given a ip address , I wish to
    send a ip packet to it.For this I have a raw socket with IP_HDRINCL and
    SO_BROADCAST set , and then to send I just use sendto specifying the ip
    address.
    However I am puzzled where does the ip-mac translation come in , is
    there something similar like arp in 802.11b ? Or is the packet just
    send on a broadcast mac address and each node works in promiscuous mode
    and then filters at the ip layer , based on the ip address.
    Sincerely
    Devesh Agrawal.
    devesh DOT agrawal AT gmail DOT com
    (You are welcome to send your replies via email)
     
    devesh, Jan 10, 2005
    #1
    1. Advertisements

  2. When you program using TCP/IP sockets, the the media type is not
    normally an issue. As far as applications are concerned, there's no
    difference between Ethernet, WiFi, dialup, etc. You just send to an IP
    address and the network stack takes care of the rest.
    Why do you need to use a raw socket instead of an ordinary TCP or UDP
    socket?
    802.11b/g uses ARP just like Ethernet.
     
    Barry Margolin, Jan 10, 2005
    #2
    1. Advertisements

  3. devesh

    devesh Guest

    Thanks for replying to my post .
    Plz let me be more clear about my problem :
    I am working on someone's code which basically is an implementation of
    source routing using a custom IP option. I have a socket on which I
    need to send an IP packet in nodes with wireless card's configured in
    adhoc mode, which I assemble with the destIp as the next hop's IP,
    which I get from the incoming IP packet (normal source routing) .
    On this socket I just use sendto(sockfd,rawIpPacket) . Now my question
    is : 1) Where does the ip to mac translation occur ? , for it to
    occur obviously neighbour info will have to be maintained (cached) or
    something like a arp request will have to be send (bcast), with that
    neighbour replying with its mac address , and then the device shall
    just forward the packet to that particular node.
    2)Or will this packet be simply mac broadcasted ? , where in my code
    does the ip level filtering (ie accept packets only whose destIp
    matches my own).
    I am using the ornico wlan device driver in linux . Is this arp called
    by a different name in 802.11b ? , (I wasn't able to find something
    like a arp request in the driver source code.).
    Thanks a lot in advance ...
    Sincerely
    Devesh Agrawal
     
    devesh, Jan 10, 2005
    #3
  4. devesh

    manugarg Guest

    ARP in 802.11 works exactly same way as in ethernet. When the system
    gets (before driver) the packet, it tries to determine the
    corresponding address before giving the packet to device. For that, it
    sends an ARP broadcast request looking for MAC address corresponding to
    IP address. Of course this request goes through your wl card. After
    getting ARP reply, your system updates the packet with MAC address and
    gives it to your card.

    Device driver just handles frames. It doesn't have any protocol code
    inside it. So don't look there. You'll find that code in protocol
    stack.

    Hope it clears your doubt.
    cheers,
    Manu
     
    manugarg, Jan 10, 2005
    #4
  5. No the packet is sent directly to the client, none of the other clients can
    pick it up. Smartass.

    Obviously it's broadcast and when a client adapter is "connected" to an AP,
    it only translates packets marked with it's MAC address. Promisc mode simply
    means it's not filtering. Get some sleep brah.

    Arp is a tcp-ip thing. 802.11 is what it's encapsulated in, with it's own
    packet overheads, nothing like ethernet, yet totally transparent to most
    programming interfaces. Unless you're writing a radio scanner and
    communicating directly with the hardware/NDIS/Prism interfaces.

    AM I Not right, you Wi Fi Geniuses?!
     
    Coenraad Loubser, Jan 13, 2005
    #5
  6. I'm afraid I'm not able to help on the problem the thread-originator is
    having but you seem to be a knowledgeable bunch (which is a rare thing
    on Linux help-groups) and I hope you won't mind my picking your (WIFI)
    brains, for I'm having a networking problem of my own. (It may not be
    entirely separate from the aforementioned problems. We'll see).

    The Problem:
    ========================================================================
    I have LAN access but cannot access any remote (WAN) host (or website).

    Examples:
    --------
    What I CAN do:
    a) Able to ping router on 192.168.2.1
    b) Able to ping colleague's PC 192.168.2.2
    c) Able to configure router using web interface on 192.168.2.1 fine.

    What I CANNOT do:
    http://www.google.co.uk (Error = "www.google.co.uk could not be found.
    Please check the name and try again.")
    ========================================================================


    Configuration:
    --------------
    Linux Suse 9.2

    Belkin ADSL Modem with Built-in Wireless Router
    Model: F5D7630-4A (ver 1212uk)

    D-Link DWL-610 Wireless PCMCIA Card
    Driver: DriverLoader

    Network:
    DHCP Enabled
    Infrastructure
    Channel 11
    IP Forwarding ON
    128 bit WEP (enabled) HEX
    Gateway 192.168.2.1
    ESSID belkin54g


    Troubleshooting
    ----------------
    Failed attempts:
    X) I've disabled the firewall.
    X) I've disabled WEP.
    x) I've upgraded router's firmware.
    x) Various command-line utilities (see below)


    (Console Output):

    Traceroute
    ----------

    (Using DNS)
    localhost:~# traceroute www.google.co.uk <return>
    www.google.co.uk: Temporary failure in name resolution

    (Using IP Address)
    localhost:~# traceroute 66.102.9.104 <return>
    traceroute to 66.102.9.104 (66.102.9.104), 30 hops max, 40 byte packets
    Unable to connect to 66.102.9.104: Network is unreachable


    IWCONFIG
    ---------
    localhost:~# iwconfig <return>

    wlan0 IEEE 802.11-DS ESSID:"belkin54g" Nickname:"atlantis"
    Mode:Managed Frequency:2.462 GHz Access Point:
    00:20:E1:D4:1C:B2
    Bit Rate=11 Mb/s Tx-Power=20 dBm
    RTS thr:eek:ff Fragment thr:eek:ff
    Encryption key:<KEY> Security mode:restricted
    Power Management:eek:ff
    Link Quality:35/94 Signal level:-51 dBm Noise level:-154
    dBm
    Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
    Tx excessive retries:0 Invalid misc:0 Missed beacon:0

    IFCONFIG
    ---------
    localhost:~# ifconfig <return>

    wlan0 Link encap:Ethernet HWaddr 00:12:66:58:23:1C
    inet addr:192.168.2.3 Bcast:192.168.2.255
    Mask:255.255.255.0
    inet6 addr: fe80::20d:88ff:fe58:531c/64 Scope:Link
    UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:530 errors:0 dropped:0 overruns:0 frame:0
    TX packets:590 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:195057 (190.4 Kb) TX bytes:56885 (55.5 Kb)

    IFUP
    -----
    localhost:~# ifup wlan0 <return>

    wlan0 device: D-Link System Inc DWL-510 2.4GHz Wireless PCI Adapter
    (rev 20)
    wlan0 configuration: wlan-id-00:12:66:58:23:1C
    Starting DHCP Client Daemon on wlan0... . IP/Netmask: 192.168.2.3 /
    255.255.255.0

    RESOLV.CONF
    Contents of /etc/resolv.conf (actual IP addresses are of course
    different):
    search home
    nameserver 192.168.168.1
    nameserver 192.168.168.8
     
    godffreypratt, Jan 13, 2005
    #6
  7. devesh

    manu Guest

    godffreypr..., Can you post the output of 'netstat -rn' or 'route'?
    Seems like your gateway is not getting configured properly. Also, check
    the status of WAN link from web interface of the router
    administration.

    Coenraad, you need to get some rest/medicine. you sound insane :)

    -Manu
     
    manu, Jan 14, 2005
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.