teach fiche about binding to a specific address

Add the -L <listen_addr> option which permits fiche to bind to a
specific local address rather than INADDR_ANY.
This commit is contained in:
Lars Kellogg-Stedman
2018-02-27 11:24:58 -05:00
parent 9206dce65f
commit 441debc4c7
4 changed files with 21 additions and 6 deletions

13
main.c
View File

@@ -44,7 +44,7 @@ int main(int argc, char **argv) {
// Parse input arguments
int c;
while ((c = getopt(argc, argv, "D6eSp:b:s:d:o:l:B:u:w:")) != -1) {
while ((c = getopt(argc, argv, "D6eSL:p:b:s:d:o:l:B:u:w:")) != -1) {
switch (c) {
// domain
@@ -61,6 +61,13 @@ int main(int argc, char **argv) {
}
break;
// listen_addr
case 'L':
{
fs.listen_addr = optarg;
}
break;
// slug size
case 's':
{
@@ -120,8 +127,8 @@ int main(int argc, char **argv) {
// Display help in case of any unsupported argument
default:
{
printf("usage: fiche [-dpsSoBulbw].\n");
printf(" [-d domain] [-p port] [-s slug size]\n");
printf("usage: fiche [-dLpsSoBulbw].\n");
printf(" [-d domain] [-L listen_addr] [-p port] [-s slug size]\n");
printf(" [-o output directory] [-B buffer size] [-u user name]\n");
printf(" [-l log file] [-b banlist] [-w whitelist] [-S]\n");
return 0;