blank.gif (43 bytes)

Church Of The
Swimming Elephant

Search:
2.2. Changes to Host Software to Support Subnets Connected: An Internet Encyclopedia
2.2. Changes to Host Software to Support Subnets

Up: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 950
Up: 2. Standards for Subnet Addressing
Prev: 2.1. Interpretation of Internet Addresses
Next: 2.3. Finding the Address Mask

2.2. Changes to Host Software to Support Subnets

2.2. Changes to Host Software to Support Subnets

In most implementations of IP, there is code in the module that handles outgoing datagrams to decide if a datagram can be sent directly to the destination on the local network or if it must be sent to a gateway.

Generally the code is something like this:

         IF ip_net_number(dg.ip_dest) = ip_net_number(my_ip_addr)
             THEN
                 send_dg_locally(dg, dg.ip_dest)
             ELSE
                 send_dg_locally(dg,
                                  gateway_to(ip_net_number(dg.ip_dest)))
(If the code supports multiply-connected networks, it will be more complicated, but this is irrelevant to the current discussion.)

To support subnets, it is necessary to store one more 32-bit quantity, called my_ip_mask. This is a bit-mask with bits set in the fields corresponding to the IP network number, and additional bits set corresponding to the subnet number field.

The code then becomes:

         IF bitwise_and(dg.ip_dest, my_ip_mask)
                                   = bitwise_and(my_ip_addr, my_ip_mask)
             THEN
                 send_dg_locally(dg, dg.ip_dest)
             ELSE
                 send_dg_locally(dg,
                        gateway_to(bitwise_and(dg.ip_dest, my_ip_mask)))
Of course, part of the expression in the conditional can be pre-computed.

It may or may not be necessary to modify the "gateway_to" function, so that it too takes the subnet field bits into account when performing comparisons.

To support multiply-connected hosts, the code can be changed to keep the "my_ip_addr" and "my_ip_mask" quantities on a per-interface basis; the expression in the conditional must then be evaluated for each interface.


Next: 2.3. Finding the Address Mask

Connected: An Internet Encyclopedia
2.2. Changes to Host Software to Support Subnets

Cotse.Net

Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

 
.
www.cotse.com
Have you gone to church today?
.
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 Cotse.com.
Cotse.com is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609