Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
7e52da1d
Commit
7e52da1d
authored
Jun 02, 2002
by
Bernd Eckenfels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple patch from Ajax <ajax@firest0rm.org> (corrected) to print DDP
(AppleTalk) routing table.
parent
b03df1a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
3 deletions
+72
-3
lib/ddp_gr.c
lib/ddp_gr.c
+71
-2
lib/pathnames.h
lib/pathnames.h
+1
-1
No files found.
lib/ddp_gr.c
View file @
7e52da1d
/*
* lib/ddp_gr.c Prinbting of DDP (AppleTalk) routing table
* used by the NET-LIB.
*
* NET-LIB
*
* Version: $Id: ddp_gr.c,v 1.4 2002/06/02 05:25:15 ecki Exp $
*
* Author: Ajax <ajax@firest0rm.org>
*
* Modification:
* 2002-06-02 integrated into main source by Bernd Eckenfels
*
*/
/* TODO: name lookups (/etc/atalk.names? NBP?) */
#include "config.h"
#if HAVE_AFATALK
...
...
@@ -16,9 +33,61 @@
#include "pathnames.h"
#include "intl.h"
/* stolen from inet_gr.c */
#define flags_decode(i,o) do { \
o[0] = '\0'; \
if (i & RTF_UP) strcat(o, "U"); \
if (i & RTF_GATEWAY) strcat(o, "G"); \
if (i & RTF_REJECT) strcat(o, "!"); \
if (i & RTF_HOST) strcat(o, "H"); \
if (i & RTF_REINSTATE) strcat(o, "R"); \
if (i & RTF_DYNAMIC) strcat(o, "D"); \
if (i & RTF_MODIFIED) strcat(o, "M"); \
if (i & RTF_DEFAULT) strcat(o, "d"); \
if (i & RTF_ALLONLINK) strcat(o, "a"); \
if (i & RTF_ADDRCONF) strcat(o, "c"); \
if (i & RTF_NONEXTHOP) strcat(o, "o"); \
if (i & RTF_EXPIRES) strcat(o, "e"); \
if (i & RTF_CACHE) strcat(o, "c"); \
if (i & RTF_FLOW) strcat(o, "f"); \
if (i & RTF_POLICY) strcat(o, "p"); \
if (i & RTF_LOCAL) strcat(o, "l"); \
if (i & RTF_MTU) strcat(o, "u"); \
if (i & RTF_WINDOW) strcat(o, "w"); \
if (i & RTF_IRTT) strcat(o, "i"); \
if (i & RTF_NOTCACHED) strcat(o, "n"); \
} while (0)
int
DDP_rprint
(
int
options
)
{
fprintf
(
stderr
,
_
(
"Routing table for `ddp' not yet supported.
\n
"
));
return
(
1
);
FILE
*
fp
;
char
*
dest
,
*
gw
,
*
dev
,
*
flags
;
char
oflags
[
32
];
char
*
hdr
=
"Destination Gateway Device Flags"
;
fp
=
fopen
(
_PATH_PROCNET_ATALK_ROUTE
,
"r"
);
if
(
!
fp
)
{
perror
(
"Error opening "
_PATH_PROCNET_ATALK_ROUTE
);
fprintf
(
stderr
,
"DDP (AppleTalk) not configured on this system.
\n
"
);
return
1
;
}
fscanf
(
fp
,
"%as %as %as %as
\n
"
,
&
dest
,
&
gw
,
&
flags
,
&
dev
);
free
(
dest
);
free
(
gw
);
free
(
dev
);
free
(
flags
);
printf
(
"%s
\n
"
,
hdr
);
while
(
fscanf
(
fp
,
"%as %as %as %as
\n
"
,
&
dest
,
&
gw
,
&
flags
,
&
dev
)
==
4
)
{
int
iflags
=
atoi
(
flags
);
flags_decode
(
iflags
,
oflags
);
printf
(
"%-16s%-16s%-16s%-s
\n
"
,
dest
,
gw
,
dev
,
oflags
);
free
(
dest
);
free
(
gw
);
free
(
dev
);
free
(
flags
);
}
fclose
(
fp
);
return
0
;
}
#endif
lib/pathnames.h
View file @
7e52da1d
/*
* lib/pathnames.h This file contains the definitions of the path
* names used by the NET-LIB.
...
...
@@ -45,6 +44,7 @@
#define _PATH_PROCNET_X25 "/proc/net/x25"
#define _PATH_PROCNET_X25_ROUTE "/proc/net/x25_routes"
#define _PATH_PROCNET_DEV_MCAST "/proc/net/dev_mcast"
#define _PATH_PROCNET_ATALK_ROUTE "/proc/net/atalk_route"
/* pathname for the netlink device */
#define _PATH_DEV_ROUTE "/dev/route"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment