A method and apparatus for rerouting traffic in a computer network select
a routing element, apply a subnet mask to an interface address of the
routing element to generate subnet addresses, determine the address of
neighboring elements from the subnet addresses, and obtain configuration
information from the neighboring elements. Network topology is determined
from the configuration information, a link in the network topology is
selected, and a cost associated with the link is modified. The modified
cost renders the link less desirable for routing. A method and apparatus
for determining the address of neighboring routing elements in a computer
network, combine a subnet mask and interface address associated in a
bitwise AND operation to generate subnet addresses, disregard the highest
and lowest subnet addresses and the address of the selected routing
element from the subnet addresses, and identify the remaining subnet
address as associated with the neighboring routing element.