Commit 8579daba authored by ikumar's avatar ikumar

This is the first commit from indrajeet.

parent fe113e1a
'td' is a topology discovery program with a client/server
architecture. The design is platform independent, but this
instance of the implementation is not. In order to be detected, each machine in a network must
be running the td server in order to be detected. Closure is provided
using a hint: the user-estimated network diameter provided as a
command-line argument.
td is written such that topology is discovered in a recursive manner.
When a server receives an 'inquiry' packet
A single client broadcasts an 'inquiry' packet to its local server.
across all interfaces
that are
Limitations:
- This implementation is restricted to FreeBSD
......@@ -18,7 +18,7 @@
*
* ---------------------------
*
* $Id: cli.c,v 1.2 2000-07-13 18:52:51 kwright Exp $
* $Id: cli.c,v 1.3 2001-06-14 23:19:23 ikumar Exp $
*/
#include "discvr.h"
......@@ -62,6 +62,8 @@ find_nodeID(void)
* since the above is just a debug clause and may be
* compiled out eventually. -lkw
*/
// Why max is being talken ?! -ik
if ( ifi->ifi_hlen > 0) {
myNodeIDtmp = max_haddr(myNodeIDtmp, ifi->ifi_haddr);
}
......@@ -115,9 +117,10 @@ cli(int sockfd, const struct sockaddr *pservaddr, socklen_t servlen,
make_inquiry(&ti, ttl, factor);
sendto(sockfd, &ti, TOPD_INQ_SIZ, 0, pservaddr, servlen);
print_tdinq((char *)&ti);
//print_tdinq((char *)&ti);
n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
print_tdreply(recvline, n);
//printf("Receiving in client:==>\n");
//print_tdreply(recvline, n);
}
/*
......@@ -143,6 +146,7 @@ main(int argc, char **argv)
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
printf("calling client\n");
cli(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr), atoi(argv[2]), atoi(argv[3]));
exit(0);
......
/*$Id: discvr.h,v 1.3 2000-07-18 19:19:27 kwright Exp $*/
/*$Id: discvr.h,v 1.4 2001-06-14 23:19:23 ikumar Exp $*/
#ifndef _TOPD_DISCVR_H_
#define _TOPD_DISCVR_H_
......@@ -62,7 +62,7 @@ struct ifi_info {
void
serv_listen(int sockfd, struct sockaddr *pcliaddr, socklen_t clilen);
void
struct ifi_info *
forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
const char *mesg, const int mesglen);
struct ifi_info *
......@@ -90,5 +90,8 @@ get_rtaddrs(int, struct sockaddr *, struct sockaddr **);
u_int32_t
compose_reply(struct ifi_info *ifi, char *mesg, const int mesglen, int sendnbors);
int
is_my_packet(struct sockaddr *pcliaddr, struct ifi_info *ifihead) ;
#endif /* _TOPD_DISCVR_H_ */
......@@ -18,7 +18,7 @@
*
* ---------------------------
*
* $Id: forw_requests.c,v 1.5 2000-07-18 17:13:44 kwright Exp $
* $Id: forw_requests.c,v 1.6 2001-06-14 23:19:23 ikumar Exp $
*/
#include <math.h>
......@@ -47,7 +47,7 @@ tod(void)
}
void
struct ifi_info *
forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
const char *mesg, int mesglen)
{
......@@ -58,9 +58,14 @@ forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
char ifname[IFNAMSIZ];
struct topd_inqid *tdi;
struct topd_nborlist *save;
struct sockaddr_in sin;
struct sockaddr_in sin,tempAddr;
struct ifi_info *ifihead;
struct timeval tv;
int selectReturn;
struct sockaddr name;
int namelen=sizeof(name);
printf("The interface on which I received: \"%s\"\n",if_indextoname(pktinfo->ipi_ifindex, ifname));
for (ifihead = ifi = get_ifi_info(AF_INET, 0);
ifi != NULL; ifi = ifi->ifi_next) {
......@@ -72,18 +77,37 @@ forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
*
* Add check for control net? -lkw
*/
if (ifi->ifi_flags & !IFF_UP ||
ifi->ifi_flags & IFF_LOOPBACK ||
strcmp(ifi->ifi_name, if_indextoname(pktinfo->ipi_ifindex, ifname)) == 0) {
if ((ifi->ifi_flags & !IFF_UP) ||
(ifi->ifi_flags & IFF_LOOPBACK) ||
(strcmp(ifi->ifi_name, if_indextoname(pktinfo->ipi_ifindex, ifname)) == 0)) {
ifi->ifi_myflags |= MY_IFF_RECVIF; /* may be unnec. -lkw */
continue;
}
// Adding check for control net... -ik
if(strcmp(ifi->ifi_name,"fxp4")==0) continue;
printf("Forwarding the query to interface: \"%s\"\n",ifi->ifi_name);
bzero(&tempAddr, sizeof(tempAddr));
tempAddr.sin_family = AF_INET;
//inet_aton("192.168.2.2",&tempAddr.sin_addr.s_addr);
tempAddr.sin_addr.s_addr = htonl(INADDR_ANY);
tempAddr.sin_port = htons(0);
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == -1) {
perror("Unable to get socket");
exit(1);
}
if(bind(s, (struct sockaddr *) &tempAddr, sizeof(tempAddr))<0)
{
perror("bind");
}
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) != 0) {
perror("setsockopt died.");
/* Do something intelligent. -lkw */
......@@ -102,8 +126,9 @@ forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
* struct sockaddr *ifi_brdaddr
* -> ifi_brdaddr->sa_data
*/
sin.sin_addr.s_addr = inet_addr(ifi->ifi_brdaddr->sa_data);
/*sin.sin_addr.s_addr = inet_addr(ifi->ifi_brdaddr->sa_data); */
sin.sin_addr = ((struct sockaddr_in *)(ifi->ifi_brdaddr))->sin_addr;
printf("The dest. address: %s\n", inet_ntoa(sin.sin_addr));
/*
* though sendto() returns the correct number of bytes,
* tcpdump is showing two packets for this one line. -lkw
......@@ -114,11 +139,20 @@ forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
* 15:04:59.357528 eureka.cs.utah.edu.1192 > 155.99.212.255.9877: udp 15
* 15:20:02.075858 kamas.cs.utah.edu.9877 > eureka.cs.utah.edu.1214: udp 15
*/
fprintf(stderr, "$$$forwarding the enquiry: ");
print_tdinq(mesg);
n = sendto(s, mesg, mesglen, 0,
(struct sockaddr *)&sin, sizeof(struct sockaddr_in));
fprintf(stderr, "sent: ");
fprintf(stderr, "$$$after forwarding the enquiry: ");
print_tdinq(mesg);
if(getsockname(s, (struct sockaddr *)&name, &namelen)<0)
{
perror("getsockname\n");
}
printf("The address from where i am sending: %s\n",sock_ntop(&name,name.sa_len));
if (n != mesglen) {
perror("Didn't send all of packet");
exit(1);
......@@ -128,7 +162,7 @@ forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
* Can't wait forever because
* there may be either no nodes on this interface or
* the nodes that are there may not be responding.
* Our wait delay is equal to the factor times the ttl.
* Our wait delay is equal to the "factor times the ttl".
*
* The packet size *might* exceed our buffer size.
* Put in some mechanism to check. -lkw
......@@ -153,16 +187,26 @@ forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
* slowly. To cover this case, we should continue to try to
* read from the socket until our delay is up. -lkw
*/
begin = tod();
select(s + 1, &rset, NULL, NULL, &tv);
printf("entering select for %d, max = %d****\n", s, FD_SETSIZE);
selectReturn = select(FD_SETSIZE, &rset, NULL, NULL, &tv);
if( selectReturn < 0 ) {
printf("Error in Select call\n");
perror("select");
exit(1);
}
else if(selectReturn == 0)
{
printf("Select timed out****\n");
}
end = tod();
if (!FD_ISSET(s, &rset)) {
/* socket is not readable */
/* socket is not readable */
fprintf(stderr, "Socket not readable before timeout.\n");
more_time = 0;
/*continue;*/
/*continue; */
}
/* get ready for next select */
......@@ -175,13 +219,27 @@ forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
tv.tv_sec = floor(deadline);
tv.tv_usec = (deadline - tv.tv_sec) * 1e+6;
fprintf(stderr, "sec:%d usec:%d\n", tv.tv_sec, tv.tv_usec);
n = recvfrom(s, recvbuf, BUFSIZ, 0, NULL, NULL);
// receive one of my neighbors' list of neighbors through
// "ifi" interface to which I just forwarded the request -ik
n = recvfrom(s, recvbuf, BUFSIZ, 0, NULL, NULL);
//printf ("recvd %d\n", n);
printf ("received:==>\n");
print_tdreply(recvbuf,n);
/*
* Be sure to malloc enough space for all of the mesg.
* See note above about possible datagram truncation. -lkw
*/
save = ifi->ifi_nbors;
// save the existing list of neighbors which I just received through
// the "ifi" interface... -ik
save = ifi->ifi_nbors;
printf("The value of save: \"%d\"\n",save);
// create a new node for the neighbor link list pointed by "ifi_nbors"
// -ik
ifi->ifi_nbors = (struct topd_nborlist *)malloc(sizeof(struct topd_nborlist));
if ( ifi->ifi_nbors == NULL ) {
perror("Not enough memory for neighbor list.");
......@@ -193,9 +251,21 @@ forward_request(struct ifi_info *ifi, const struct in_pktinfo *pktinfo,
perror("Not enough memory for neighbor list.");
exit(1);
}
// why "recvbuf + sizeof(topd_inqid_t)" ?
// Ans: The reason we skip this first "sizeof(topd_inqid_t)" is because
// to every message there is a "inquiry ID" attached in the beginning...
// -ik
//print_tdpairs(recvbuf + sizeof(topd_inqid_t),n-sizeof(topd_inqid_t));
memcpy((void *)ifi->ifi_nbors->tdnbl_nbors, recvbuf + sizeof(topd_inqid_t), n);
// The "tdnbl_n" contains the number of neighbors that the node, along this
// interface, has ... -ik
ifi->ifi_nbors->tdnbl_n = n / sizeof(struct topd_nbor);
ifi->ifi_nbors->tdnbl_next = save;
//print_tdpairs(ifi->ifi_nbors->tdnbl_nbors,n-sizeof(topd_inqid_t));
}
}
print_tdifinbrs(ifihead);
return ifihead;
}
......@@ -29,6 +29,10 @@ get_ifi_info(int family, int doaliases)
struct sockaddr_dl *sdl;
struct ifi_info *ifi, *ifisave, *ifihead, **ifipnext;
// Get the temporary list of interfaces in the "buf" buffer and the
// length of the list in "len"...
// there may be some interfaces which are not up... or some may not
// be having network addresses already... -ik
buf = net_rt_iflist(family, 0, &len);
ifihead = NULL;
......@@ -37,20 +41,41 @@ get_ifi_info(int family, int doaliases)
lim = buf + len;
for (next = buf; next < lim; next += ifm->ifm_msglen) {
ifm = (struct if_msghdr *) next;
// "ifm_type" is the interface information message type
// RTM_IFINFO: interface going up or down
if (ifm->ifm_type == RTM_IFINFO) {
if ( ((flags = ifm->ifm_flags) & IFF_UP) == 0)
continue; /* ignore if interface not up */
// Interface is up.. get the list of addresses on the back of
// message header and proceed
sa = (struct sockaddr *) (ifm + 1);
// Get the sockadders in the rti_info array after reading from
// "sa" list
get_rtaddrs(ifm->ifm_addrs, sa, rti_info);
// The sockaddr at "RTAX_IFP" index has the name and link level
// address for the interface.
if ( (sa = rti_info[RTAX_IFP]) != NULL) {
// Make a node of the link list "ifi" to store information
// about an interface..
ifi = calloc(1, sizeof(struct ifi_info));
*ifipnext = ifi; /* prev points to this new one */
ifipnext = &ifi->ifi_next; /* ptr to next one goes here */
ifi->ifi_flags = flags;
// If its not a link layer interface then ignore
if (sa->sa_family == AF_LINK) {
// copy the sock adder to link level sockaddr
// coz we now know its a link level address
sdl = (struct sockaddr_dl *) sa;
// Now, get the name and address of the link level
// interface...
if (sdl->sdl_nlen > 0)
snprintf(ifi->ifi_name, IFNAMSIZ, "%*s",
sdl->sdl_nlen, &sdl->sdl_data[0]);
......@@ -63,6 +88,8 @@ get_ifi_info(int family, int doaliases)
min(IFHADDRSIZ, sdl->sdl_alen));
}
}
// Check if address is being added to the interface...
} else if (ifm->ifm_type == RTM_NEWADDR) {
if (ifi->ifi_addr) { /* already have an IP addr for i/f */
if (doaliases == 0)
......
......@@ -5,26 +5,38 @@
#include "discvr.h"
//
char *
net_rt_iflist(int family, int flags, size_t *lenp)
{
int mib[6];
char *buf;
mib[0] = CTL_NET;
mib[1] = AF_ROUTE;
mib[2] = 0;
mib[3] = family; /* only addresses of this family */
mib[4] = NET_RT_IFLIST;
mib[5] = flags; /* interface index, or 0 */
// Meaning of each parameter is explained below -ik
mib[0] = CTL_NET; // network related system information
mib[1] = PF_ROUTE; // get the routing messages
mib[2] = 0; // protocol number (always zero!)
mib[3] = family; // get addresses of only this family
mib[4] = NET_RT_IFLIST; // return "interface" list
mib[5] = flags; /* interface index, or 0*/ // "man" says NONE?!
// Call "sysctl" to get the length of buffer needed for storing the list
// of interfaces. The "oldp" parameter is supplied with NULL to get just
// the size. -ik
if (sysctl(mib, 6, NULL, lenp, NULL, 0) < 0)
return(NULL);
// Allocate a buffer to store the list of interfaces. -ik
if ( (buf = malloc(*lenp)) == NULL)
return(NULL);
// Get the list of interfaces in the "buf". -ik
if (sysctl(mib, 6, buf, lenp, NULL, 0) < 0)
return(NULL);
// Return the list of interfaces. -ik
return(buf);
}
......
......@@ -18,7 +18,7 @@
*
* ---------------------------
*
* $Id: reply.c,v 1.5 2000-07-18 19:19:28 kwright Exp $
* $Id: reply.c,v 1.6 2001-06-14 23:19:23 ikumar Exp $
*/
......@@ -53,7 +53,7 @@ compose_reply(struct ifi_info *ifi, char *mesg, const int mesglen, int sendnbors
/* Add check for control net -LKW */
if (ifi->ifi_flags & !IFF_UP ||
ifi->ifi_flags & IFF_LOOPBACK) {
ifi->ifi_flags & IFF_LOOPBACK || (strcmp(ifi->ifi_name,"fxp4")==0)) {
continue;
}
......
......@@ -18,7 +18,7 @@
*
* ---------------------------
*
* $Id: serv.c,v 1.2 2000-07-13 18:52:52 kwright Exp $
* $Id: serv.c,v 1.3 2001-06-14 23:19:23 ikumar Exp $
*/
#include "discvr.h"
......@@ -32,6 +32,8 @@ main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr, cliaddr;
struct sockaddr name;
int namelen=sizeof(name);
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
......@@ -40,8 +42,16 @@ main(int argc, char **argv)
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(SERV_PORT);
bind(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr));
if(bind(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr))<0)
{
perror("bind");
}
printf("The address I am listening on is: %s\n",inet_ntoa(servaddr.sin_addr));
if(getsockname(sockfd, (struct sockaddr *)&name, &namelen)<0)
{
perror("getsockname\n");
}
printf("No I am listening on: \"%s\"\n",sock_ntop(&name,name.sa_len));
serv_listen(sockfd, (struct sockaddr *) &cliaddr, sizeof(cliaddr));
/* We'll never get here */
......
......@@ -18,7 +18,7 @@
*
* ---------------------------
*
* $Id: serv_listen.c,v 1.5 2000-07-18 19:19:28 kwright Exp $
* $Id: serv_listen.c,v 1.6 2001-06-14 23:19:23 ikumar Exp $
*/
#include "discvr.h"
......@@ -58,6 +58,20 @@ from_us(struct in_pktinfo *pktinfo, struct ifi_info *ifihead)
return 0;
}
int is_my_packet(struct sockaddr *pcliaddr, struct ifi_info *ifihead)
{
char *name1,*name2;
struct ifi_info *ifi;
for( ifi = ifihead; ifi != NULL; ifi = ifi->ifi_next) {
name1=inet_ntoa(((struct sockaddr_in *)ifi->ifi_addr)->sin_addr);
name2=inet_ntoa(((struct sockaddr_in *)pcliaddr)->sin_addr);
fprintf(stderr,"name1:\"%s\" name2:\"%s\"\n",name1,name2);
if(strcmp(name1,name2)==0)
return 1;
}
return 0;
}
/*
* Return 0 if the two inquiries are identical, non-zero if not.
*/
......@@ -81,7 +95,7 @@ print_ifi_info(struct ifi_info *ifihead)
if (ifi->ifi_flags & IFF_BROADCAST) printf("BCAST ");
if (ifi->ifi_flags & IFF_MULTICAST) printf("MCAST ");
if (ifi->ifi_flags & IFF_LOOPBACK) printf("LOOP ");
if (ifi->ifi_flags & IFF_POINTOPOINT) printf("P2P ");
if (ifi->ifi_flags & IFF_POINTOPOINT) printf("P2P ");
printf(">\n");
print_nodeID(ifi->ifi_haddr);
......@@ -109,6 +123,7 @@ serv_listen(int sockfd, struct sockaddr *pcliaddr, socklen_t clilen)
struct ifi_info *ifi, *ifihead;
struct in_pktinfo pktinfo;
struct topd_inqnode *inqn, *inqhead = 0;
int i=0,j=0;
/*
* Use this option to specify that the receiving interface
......@@ -130,6 +145,9 @@ serv_listen(int sockfd, struct sockaddr *pcliaddr, socklen_t clilen)
/*
* Find and set our node ID
*/
//ik: get the list of interfaces using the function "get_ifi_info" into the
//link list "ifi"
for (ifihead = ifi = get_ifi_info(AF_INET, 0);
ifi != NULL; ifi = ifi->ifi_next) {
if ( ifi->ifi_hlen > 0) {
......@@ -147,13 +165,16 @@ serv_listen(int sockfd, struct sockaddr *pcliaddr, socklen_t clilen)
* Wait for requests. When a request comes in, send the request
* on to each interface.
*/
i=0;
for ( ; ; ) {
fprintf(stderr,"**********for==>%d\n",i++);
len = clilen;
flags = 0;
n = recvfrom_flags(sockfd, mesg, MAXLINE, &flags,
pcliaddr, &len, &pktinfo);
printf("%d-byte datagram from %s", n, sock_ntop(pcliaddr, len));
if (memcmp(&pktinfo.ipi_addr, &in_zero, sizeof(in_zero)) != 0)
// came to my "below" IP address... -ik
printf(", to %s", inet_ntop(AF_INET, &pktinfo.ipi_addr,
str, sizeof(str)));
if (pktinfo.ipi_ifindex > 0)
......@@ -166,6 +187,10 @@ serv_listen(int sockfd, struct sockaddr *pcliaddr, socklen_t clilen)
#endif
printf("\n");
//printf("The message received is: ==>\n%s\n====\n",*mesg);
// -ik: just to check what was recevied:
print_tdinq(mesg);
/*
* There are 3 possible classifications for this inquiry.
* Our response to the inquiry depends upon its classification:
......@@ -178,16 +203,32 @@ serv_listen(int sockfd, struct sockaddr *pcliaddr, socklen_t clilen)
* We now classify each inquiry.
*/
if(inqhead==NULL) class = NEW;
j=0;
for ( inqn = inqhead; inqn != NULL; inqn = inqn->inqn_next ) {
fflush(stdin);
fflush(stderr);
fprintf(stderr,"inquiry loop ##### %d\n",j++);
fprintf(stderr,"Comparing #### ==>\n\"");
print_tdinq((char*)inqn->inqn_inq);
fprintf(stderr,"\"and\n\"");
print_tdinq(mesg);
fprintf(stderr,"\"\n");
if (inqid_cmp(inqn->inqn_inq, (struct topd_inqid *)mesg) == NULL) {
/* Duplicate inquiry */
if (from_us(&pktinfo, ifihead)) {
//if (from_us(&pktinfo, ifihead))...
if(is_my_packet(pcliaddr, ifihead)) {
fprintf(stderr,"Duplicate inquiry from me\n");
class = DUP;
break;
} else {
fprintf(stderr,"Duplicate inquiry from others\n");
class = DUP_NBOR;
break;
}
} else {
/* New inquiry */
fprintf(stderr,"Got a new inquiry\n");
class = NEW;
}
}
......@@ -214,7 +255,10 @@ serv_listen(int sockfd, struct sockaddr *pcliaddr, socklen_t clilen)
}
memcpy(inqhead->inqn_inq, mesg, sizeof(struct topd_inqid));
inqhead->inqn_next = save;
forward_request(ifihead, &pktinfo, mesg, n );
ifihead=forward_request(ifihead, &pktinfo, mesg, n );
printf("printing after forward===>\n");
print_tdifinbrs(ifihead);
}
if ( (reply=(char *)malloc(BUFSIZ)) == NULL) {
......@@ -224,8 +268,10 @@ serv_listen(int sockfd, struct sockaddr *pcliaddr, socklen_t clilen)
n = compose_reply(ifihead, reply, BUFSIZ, class == NEW);
fprintf(stderr, "replying: ");
print_tdreply(reply, n);
fprintf(stderr,"done!\n");
free_ifi_info(ifihead);
printf("I am sending the response to: %s\n",sock_ntop(pcliaddr,sizeof(struct sockaddr)));
/* send response back to original sender */
sendto(sockfd, reply, n, 0, pcliaddr, sizeof(struct sockaddr));
}
......
......@@ -18,7 +18,7 @@
*
* ---------------------------
*
* $Id: util.c,v 1.2 2000-07-13 18:52:52 kwright Exp $
* $Id: util.c,v 1.3 2001-06-14 23:19:23 ikumar Exp $
*/
#include "discvr.h"
......@@ -99,6 +99,61 @@ print_tdreply(const char *mesg, size_t nbytes)
}
}
void
print_tdpairs(const char *mesg, size_t nbytes)
{
struct topd_nbor *p;
p = (struct topd_nbor *)mesg;
while( (char *)p < mesg + nbytes ) {
fprintf(stderr, "ROUTE\t\t\t\tDEST\n");
fprintf(stderr, "[");
print_haddr(p->tdnbor_pnode, ETHADDRSIZ);
fprintf(stderr, "-");
print_haddr(p->tdnbor_pif, ETHADDRSIZ);
fprintf(stderr, "] ");
fprintf(stderr, "[");
print_haddr(p->tdnbor_dnode, ETHADDRSIZ);
fprintf(stderr, "-");
print_haddr(p->tdnbor_dif, ETHADDRSIZ);
fprintf(stderr, "]\n\n");
p++;
}
}
void
print_tdnbrlist(struct topd_nborlist * list)
{
printf("Printing the neighbor list:\n");
while(list!=NULL)
{
print_tdpairs(list->tdnbl_nbors,list->tdnbl_n * sizeof(struct topd_nbor));
list = list->tdnbl_next;
}
printf("---\n");
}
void
print_tdifinbrs(struct ifi_info *ifihead)
{
struct ifi_info *ifi;
ifi = ifihead;
for(; ifi != NULL; ifi = ifi->ifi_next) {
if (ifi->ifi_flags & !IFF_UP ||
ifi->ifi_flags & IFF_LOOPBACK || (strcmp(ifi->ifi_name,"fxp4")==0)) {
continue;
}
printf("The neighbor's list of interface \"%s\"==>\n",ifi->ifi_name);
print_tdnbrlist(ifi->ifi_nbors);
printf("------\n");
}
}
/*
* Print a td inquiry packet. They are of the form:
*
......
......@@ -18,7 +18,7 @@
*
* ---------------------------
*
* $Id: util.h,v 1.2 2000-07-13 19:04:28 kwright Exp $
* $Id: util.h,v 1.3 2001-06-14 23:19:23 ikumar Exp $
*/
void
......@@ -35,3 +35,16 @@ print_tdinq(const char *mesg);
void
print_tdreply(const char *mesg, size_t nbytes);
void
print_tdnbrlist(struct topd_nborlist * list);
void
print_tdpairs(const char *mesg, size_t nbytes);
void
print_tdifinbrs(struct ifi_info *ifihead);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment