MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rt_dumpaddr_ddb

Function rt_dumpaddr_ddb

freebsd/net/route/route_ddb.c:101–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101static void
102rt_dumpaddr_ddb(const char *name, const struct sockaddr *sa)
103{
104 char buf[INET6_ADDRSTRLEN], *res;
105
106 res = NULL;
107 if (sa == NULL)
108 res = "NULL";
109 else if (sa->sa_family == AF_INET) {
110 res = inet_ntop(AF_INET,
111 &((const struct sockaddr_in *)sa)->sin_addr,
112 buf, sizeof(buf));
113 } else if (sa->sa_family == AF_INET6) {
114 res = inet_ntop(AF_INET6,
115 &((const struct sockaddr_in6 *)sa)->sin6_addr,
116 buf, sizeof(buf));
117 } else if (sa->sa_family == AF_LINK) {
118 res = "on link";
119 }
120
121 if (res != NULL) {
122 db_printf("%s <%s> ", name, res);
123 return;
124 }
125
126 db_printf("%s <af:%d> ", name, sa->sa_family);
127}
128
129static int
130rt_dumpentry_ddb(struct radix_node *rn, void *arg __unused)

Callers 1

rt_dumpentry_ddbFunction · 0.85

Calls 2

inet_ntopFunction · 0.85
db_printfFunction · 0.85

Tested by

no test coverage detected