Skip to content

Commit

Permalink
Add ff_ipc_exit() to clean temp files in /var/ while run F-Stack tool…
Browse files Browse the repository at this point in the history
…s arp/ifconfig/route/ipfw.
  • Loading branch information
zjwsoft authored and root committed Jun 18, 2020
1 parent c27efec commit e10b9b9
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 2 deletions.
7 changes: 7 additions & 0 deletions tools/arp/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ main(int argc, char *argv[])
if (ifnameindex != NULL)
if_freenameindex(ifnameindex);

#ifdef FSTACK
ff_ipc_exit();
#endif

return (rtn);
}

Expand Down Expand Up @@ -735,6 +739,9 @@ usage(void)
" arp -p <f-stack proc_id> -s hostname ether_addr [temp] [reject | blackhole] [pub [only]]",
" arp -p <f-stack proc_id> -S hostname ether_addr [temp] [reject | blackhole] [pub [only]]",
" arp -p <f-stack proc_id> -f filename");
#endif
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion tools/compat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ifneq (${MK_INET6_SUPPORT},"no")
CFLAGS+= -DINET6
endif

DPDK_CFLAGS= -g -Wall -Werror -include ${FF_DPDK}/include/rte_config.h
DPDK_CFLAGS= -g -Wall -Werror -Wno-deprecated-declarations -include ${FF_DPDK}/include/rte_config.h
DPDK_CFLAGS+= -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
DPDK_CFLAGS+= -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2
DPDK_CFLAGS+= -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2
Expand Down
7 changes: 7 additions & 0 deletions tools/compat/ff_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ ff_ipc_init(void)
return 0;
}

void
ff_ipc_exit(void)
{
rte_eal_cleanup();
return;
}

struct ff_msg *
ff_ipc_msg_alloc(void)
{
Expand Down
1 change: 1 addition & 0 deletions tools/compat/ff_ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
void ff_set_proc_id(int pid);

int ff_ipc_init(void);
void ff_ipc_exit(void);
struct ff_msg *ff_ipc_msg_alloc(void);
int ff_ipc_msg_free(struct ff_msg *msg);

Expand Down
20 changes: 20 additions & 0 deletions tools/ifconfig/ifconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ usage(void)
" ifconfig -p <f-stack proc_id> %s[-d] [-m] [-u] [-v]\n",
#endif
options, options, options);

#ifdef FSTACK
ff_ipc_exit();
#endif
exit(1);
}

Expand Down Expand Up @@ -555,6 +559,9 @@ main(int argc, char *argv[])
errx(1, "%s: cloning name too long",
ifname);
ifconfig(argc, argv, 1, NULL);
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(0);
}
#ifdef JAIL
Expand All @@ -569,6 +576,9 @@ main(int argc, char *argv[])
errx(1, "%s: interface name too long",
ifname);
ifconfig(argc, argv, 0, NULL);
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(0);
}
#endif
Expand Down Expand Up @@ -667,6 +677,10 @@ main(int argc, char *argv[])
freeifaddrs(ifap);

freeformat();

#ifdef FSTACK
ff_ipc_exit();
#endif
exit(0);
}

Expand Down Expand Up @@ -1103,6 +1117,9 @@ setifflags(const char *vname, int value, int s, const struct afswtch *afp)

if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&my_ifr) < 0) {
Perror("ioctl (SIOCGIFFLAGS)");
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(1);
}
flags = (my_ifr.ifr_flags & 0xffff) | (my_ifr.ifr_flagshigh << 16);
Expand All @@ -1125,6 +1142,9 @@ setifcap(const char *vname, int value, int s, const struct afswtch *afp)

if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) < 0) {
Perror("ioctl (SIOCGIFCAP)");
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(1);
}
flags = ifr.ifr_curcap;
Expand Down
18 changes: 17 additions & 1 deletion tools/route/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,16 @@ main(int argc, char **argv)

case K_FLUSH:
flushroutes(argc, argv);
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(0);
/* NOTREACHED */
}
usage(*argv);
#ifdef FSTACK
ff_ipc_exit();
#endif
/* NOTREACHED */
}

Expand Down Expand Up @@ -1072,8 +1078,12 @@ newroute(int argc, char **argv)
fl->fl_errno = errno;
error += fl->fl_error;
}
if (*cmd == 'g' || *cmd == 's')
if (*cmd == 'g' || *cmd == 's'){
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(error);
}

error = 0;
if (!qflag) {
Expand Down Expand Up @@ -1147,6 +1157,9 @@ newroute(int argc, char **argv)
}
}
}
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(error);
}

Expand Down Expand Up @@ -1553,6 +1566,9 @@ monitor(int argc, char *argv[])
verbose = 1;
if (debugonly) {
interfaces();
#ifdef FSTACK
ff_ipc_exit();
#endif
exit(0);
}
for (;;) {
Expand Down

0 comments on commit e10b9b9

Please sign in to comment.