Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133585993
D33717.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D33717.id.diff
View Options
diff --git a/sbin/route/route.c b/sbin/route/route.c
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -117,7 +117,7 @@
static void printb(int, const char *);
static void flushroutes(int argc, char *argv[]);
static int flushroutes_fib(int);
-static int getaddr(int, char *, struct hostent **, int);
+static int getaddr(int, char *, int);
static int keyword(const char *);
#ifdef INET
static void inet_makemask(struct sockaddr_in *, u_long);
@@ -790,7 +790,6 @@
newroute(int argc, char **argv)
{
struct sigaction sa;
- struct hostent *hp;
struct fibl *fl;
char *cmd;
const char *dest, *gateway, *errmsg;
@@ -802,7 +801,6 @@
gateway = NULL;
flags = RTF_STATIC;
nrflags = 0;
- hp = NULL;
TAILQ_INIT(&fibl_head);
sigemptyset(&sa.sa_mask);
@@ -893,35 +891,35 @@
case K_IFA:
if (!--argc)
usage(NULL);
- getaddr(RTAX_IFA, *++argv, NULL, nrflags);
+ getaddr(RTAX_IFA, *++argv, nrflags);
break;
case K_IFP:
if (!--argc)
usage(NULL);
- getaddr(RTAX_IFP, *++argv, NULL, nrflags);
+ getaddr(RTAX_IFP, *++argv, nrflags);
break;
case K_GENMASK:
if (!--argc)
usage(NULL);
- getaddr(RTAX_GENMASK, *++argv, NULL, nrflags);
+ getaddr(RTAX_GENMASK, *++argv, nrflags);
break;
case K_GATEWAY:
if (!--argc)
usage(NULL);
- getaddr(RTAX_GATEWAY, *++argv, NULL, nrflags);
+ getaddr(RTAX_GATEWAY, *++argv, nrflags);
gateway = *argv;
break;
case K_DST:
if (!--argc)
usage(NULL);
- if (getaddr(RTAX_DST, *++argv, &hp, nrflags))
+ if (getaddr(RTAX_DST, *++argv, nrflags))
nrflags |= F_ISHOST;
dest = *argv;
break;
case K_NETMASK:
if (!--argc)
usage(NULL);
- getaddr(RTAX_NETMASK, *++argv, NULL, nrflags);
+ getaddr(RTAX_NETMASK, *++argv, nrflags);
/* FALLTHROUGH */
case K_NET:
nrflags |= F_FORCENET;
@@ -956,13 +954,13 @@
} else {
if ((rtm_addrs & RTA_DST) == 0) {
dest = *argv;
- if (getaddr(RTAX_DST, *argv, &hp, nrflags))
+ if (getaddr(RTAX_DST, *argv, nrflags))
nrflags |= F_ISHOST;
} else if ((rtm_addrs & RTA_GATEWAY) == 0) {
gateway = *argv;
- getaddr(RTAX_GATEWAY, *argv, &hp, nrflags);
+ getaddr(RTAX_GATEWAY, *argv, nrflags);
} else {
- getaddr(RTAX_NETMASK, *argv, NULL, nrflags);
+ getaddr(RTAX_NETMASK, *argv, nrflags);
nrflags |= F_FORCENET;
}
}
@@ -1154,7 +1152,7 @@
* returning 1 if a host address, 0 if a network address.
*/
static int
-getaddr(int idx, char *str, struct hostent **hpp, int nrflags)
+getaddr(int idx, char *str, int nrflags)
{
struct sockaddr *sa;
#if defined(INET)
@@ -1179,9 +1177,6 @@
aflen = sizeof(struct sockaddr_dl);
#endif
}
-#ifndef INET
- hpp = NULL;
-#endif
rtm_addrs |= (1 << idx);
sa = (struct sockaddr *)&so[idx];
sa->sa_family = af;
@@ -1233,7 +1228,7 @@
switch (idx) {
case RTAX_DST:
nrflags |= F_FORCENET;
- getaddr(RTAX_NETMASK, str, NULL, nrflags);
+ getaddr(RTAX_NETMASK, str, nrflags);
break;
}
return (0);
@@ -1280,9 +1275,6 @@
#ifdef INET
sin = (struct sockaddr_in *)(void *)sa;
- if (hpp == NULL)
- hpp = &hp;
- *hpp = NULL;
q = strchr(str,'/');
if (q != NULL && idx == RTAX_DST) {
@@ -1303,7 +1295,6 @@
hp = gethostbyname(str);
if (hp != NULL) {
- *hpp = hp;
sin->sin_family = hp->h_addrtype;
memmove((char *)&sin->sin_addr, hp->h_addr,
MIN((size_t)hp->h_length, sizeof(sin->sin_addr)));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 27, 8:25 PM (3 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24314158
Default Alt Text
D33717.id.diff (3 KB)
Attached To
Mode
D33717: route: remove write-only struct hostent from getaddr()
Attached
Detach File
Event Timeline
Log In to Comment