Binding the IP address


 
Thread Tools Search this Thread
Special Forums IP Networking Binding the IP address
# 1  
Old 07-23-2009
Bug Binding the IP address

hi all,

i have an udp based application that doesn't bind to any particular address.

-->while sneding the packets, i have some doubts....
1) can the packet be transmitted with an source ip address as 0.0.0.0
2) if we select an interface based on destination ip address, and the ip address of the interface should be filled in the ip header.

3) will the remote host transfers the packet with destination ip address field as 0.0.0.0.....

Thanks in advance .....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ftp binding error

Hi, I am rite now made my unix box machine as ftp server that is it acting both ways..Now I have sftp script but when I execute get the following error ftp: bind: Address already in use $ From Secure4Access server process at 31-Oct-11 04:52... Your session is inactive and will... (5 Replies)
Discussion started by: rahul125
5 Replies

2. UNIX for Dummies Questions & Answers

Binding command in wget.

I was recently reading a manual of wget and there was command as "binding-address" and I read about tcp/ip binding but i don't understand one thing is...what is the use of binding address in wget.. Can anyone help me with this. (6 Replies)
Discussion started by: jFreak619
6 Replies

3. Red Hat

Lazy binding related

Hi, I'm building an application that would connect to either one of the 2 databases in production. I want to keep the source code common for both environments. The problem lies in the fact that in the target servers there will be only one of the 2 databases installed, hence the application... (2 Replies)
Discussion started by: ishdeepanand
2 Replies

4. IP Networking

Binding the same port number on different interfaces

Hi, We can use the same port number for two applications based on protocols.(i.e one application is based on TCP and the other application based on UDP). But i don't know about interfaces, can anyone one help........ 1) Can we use same port number for different... (0 Replies)
Discussion started by: vijaypdp2006
0 Replies

5. IP Networking

Binding the port number.

Hi all, Application A is using an port number 100 and is binded to an interface 1. Application B is using an port number 100 and is binded to an interface 2. can we bind the two applications on same port number based on interfaces. what i want to know is two... (3 Replies)
Discussion started by: vijaypdp2006
3 Replies

6. AIX

TCP/IP socket binding problem

I have what appears to be a unique socket problem, although admittedly my tcp/ip programming experience is relatively limited. I have a AIX server process using TCP/IP berkely sockets, and a Windows (C#) process. The windows process takes input from a user and sends a message to the Unix... (1 Reply)
Discussion started by: adiaconou
1 Replies

7. IP Networking

binding problems

i had a problem when using the bind function.. that is when i create a socket and bind it with a address(usually some file name)... when i run it once it goes on fine but the second time it tells a error since there is already a socket file in that name created by my previous run... but when i... (2 Replies)
Discussion started by: damn_bkb
2 Replies

8. HP-UX

CPU Binding in HP UX (psrset)

Hi All, I would like to know the behaviour of psrset in the following model. I have a 4 CPU machine on which i have a couple of databases running and a web application running. supposing i have processers 0 1 2 and 3 I bind processor 0 and 1 to the web application. This ensures that... (3 Replies)
Discussion started by: nileshkarania
3 Replies

9. IP Networking

Binding Virtual IP address to NIC

Hi, I bound a virtual IP to a network card on my E450 server and I am getting this error when I reboot the server, saying, " retrying host, RPC time out. I had to break this sequence and allow other services to load. Of course they didn't load properly. Please how can I sort this out? I do need... (8 Replies)
Discussion started by: Ronny
8 Replies

10. Solaris

key binding in the terminal

Hello all I would like to make shift+insert a shortcut for "paste from clipboard". how do I do it? where can I find the format to set this key binding, or others? thanks Ori (4 Replies)
Discussion started by: orid
4 Replies
Login or Register to Ask a Question
DIVERT(4)						   BSD Kernel Interfaces Manual 						 DIVERT(4)

NAME
divert -- kernel packet diversion mechanism SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> int socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT); DESCRIPTION
Divert sockets are similar to raw IP sockets, except that they can be bound to a specific divert port via the bind(2) system call. The IP address in the bind is ignored; only the port number is significant. A divert socket bound to a divert port will receive all packets diverted to that port by some (here unspecified) kernel mechanism(s). Packets may also be written to a divert port, in which case they re- enter kernel IP packet processing. Divert sockets are normally used in conjunction with FreeBSD's packet filtering implementation and the ipfw(8) program. By reading from and writing to a divert socket, matching packets can be passed through an arbitrary ``filter'' as they travel through the host machine, special routing tricks can be done, etc. READING PACKETS
Packets are diverted either as they are ``incoming'' or ``outgoing.'' Incoming packets are diverted after reception on an IP interface, whereas outgoing packets are diverted before next hop forwarding. Diverted packets may be read unaltered via read(2), recv(2), or recvfrom(2). In the latter case, the address returned will have its port set to the some tag supplied by the packet diverter, (usually the ipfw rule number) and the IP address set to the (first) address of the inter- face on which the packet was received (if the packet was incoming) or INADDR_ANY (if the packet was outgoing). In the case of an incoming packet the interface name will also be placed in the 8 bytes following the address, (assuming it fits). WRITING PACKETS
Writing to a divert socket is similar to writing to a raw IP socket; the packet is injected ``as is'' into the normal kernel IP packet pro- cessing and minimal error checking is done. Packets are written as either incoming or outgoing: if write(2) or send(2) is used to deliver the packet, or if sendto(2) is used with a destination IP address of INADDR_ANY, then the packet is treated as if it were outgoing, i.e., destined for a non-local address. Otherwise, the packet is assumed to be incoming and full packet routing is done. In the latter case, the IP address specified must match the address of some local interface, or an interface name must be found after the IP address. If an interface name is found, that interface will be used and the value of the IP address will be ignored (other than the fact that it is not INADDR_ANY). This is to indicate on which interface the packet ``arrived.'' Normally, packets read as incoming should be written as incoming; similarly for outgoing packets. When reading and then writing back pack- ets, passing the same socket address supplied by recvfrom(2) unmodified to sendto(2) simplifies things (see below). The port part of the socket address passed to the sendto(2) contains a tag that should be meaningful to the diversion module. In the case of ipfw(8) the tag is interpreted as the rule number after which rule processing should restart. LOOP AVOIDANCE
Packets written into a divert socket (using sendto(2)) re-enter the packet filter at the rule number following the tag given in the port part of the socket address, which is usually already set at the rule number that caused the diversion (not the next rule if there are several at the same number). If the 'tag' is altered to indicate an alternative re-entry point, care should be taken to avoid loops, where the same packet is diverted more than once at the same rule. DETAILS
To enable divert sockets, your kernel must be compiled with the option IPDIVERT. If a packet is diverted but no socket is bound to the port, or if IPDIVERT is not enabled in the kernel, the packet is dropped. Incoming packet fragments which get diverted are fully reassembled before delivery; the diversion of any one fragment causes the entire packet to get diverted. If different fragments divert to different ports, then which port ultimately gets chosen is unpredictable. Packets are received and sent unchanged, except that packets read as outgoing have invalid IP header checksums, and packets written as outgo- ing have their IP header checksums overwritten with the correct value. Packets written as incoming and having incorrect checksums will be dropped. Otherwise, all header fields are unchanged (and therefore in network order). Binding to port numbers less than 1024 requires super-user access, as does creating a socket of type SOCK_RAW. ERRORS
Writing to a divert socket can return these errors, along with the usual errors possible when writing raw packets: [EINVAL] The packet had an invalid header, or the IP options in the packet and the socket options set were incompatible. [EADDRNOTAVAIL] The destination address contained an IP address not equal to INADDR_ANY that was not associated with any interface. SEE ALSO
bind(2), recvfrom(2), sendto(2), socket(2), ipfw(8) BUGS
This is an attempt to provide a clean way for user mode processes to implement various IP tricks like address translation, but it could be cleaner, and it's too dependent on ipfw(8). It's questionable whether incoming fragments should be reassembled before being diverted. For example, if only some fragments of a packet destined for another machine don't get routed through the local machine, the packet is lost. This should probably be a settable socket option in any case. AUTHORS
Archie Cobbs <archie@FreeBSD.org>, Whistle Communications Corp. BSD
June 18, 1996 BSD