Networking Forums

Networking Forums > Computer Networking > Linux Networking > Wireless networking using sockets :Help !

Reply
Thread Tools Display Modes

Wireless networking using sockets :Help !

 
 
devesh
Guest
Posts: n/a

 
      01-10-2005, 05:28 AM
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)

 
Reply With Quote
 
 
 
 
Barry Margolin
Guest
Posts: n/a

 
      01-10-2005, 05:43 AM
In article <(E-Mail Removed) .com>,
"devesh" <(E-Mail Removed)> wrote:

> 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 ? .


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.

> 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.


Why do you need to use a raw socket instead of an ordinary TCP or UDP
socket?

> 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.


802.11b/g uses ARP just like Ethernet.

--
Barry Margolin, (E-Mail Removed)
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
 
Reply With Quote
 
devesh
Guest
Posts: n/a

 
      01-10-2005, 03:42 PM
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

 
Reply With Quote
 
manugarg
Guest
Posts: n/a

 
      01-10-2005, 10:10 PM
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
----------
Manu Garg
http://manugarg.freezope.org

 
Reply With Quote
 
Coenraad Loubser
Guest
Posts: n/a

 
      01-13-2005, 05:54 AM

> > 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.

>
> 802.11b/g uses ARP just like Ethernet.


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?!


 
Reply With Quote
 
godffreypratt@yahoo.co.uk
Guest
Posts: n/a

 
      01-13-2005, 08:19 PM
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:E14:1C:B2
Bit Rate=11 Mb/s Tx-Power=20 dBm
RTS thrff Fragment thrff
Encryption key:<KEY> Security mode:restricted
Power Managementff
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

 
Reply With Quote
 
manu
Guest
Posts: n/a

 
      01-14-2005, 06:17 AM
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 Garg
http://manugarg.freezope.org
"Wake up! Free yourself."

 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Max TCP sockets CJS Windows Networking 1 02-28-2007 06:20 PM
Homeplug networking and sockets Andy Pandy Home Networking 2 01-24-2007 11:13 PM
sockets Sam Linux Networking 2 07-07-2004 08:54 AM
sockets =?ISO-8859-1?Q?Andreas_R=F8sdal?= Linux Networking 5 02-03-2004 02:48 PM
raw sockets Linux Networking 1 12-22-2003 02:28 PM



1 2 3 4 5 6 7 8 9 10 11