X-Git-Url: https://git.distorted.org.uk/~mdw/userv-utils/blobdiff_plain/baba109968b1fb5331e24a543ec009bab62c09f5..12ecfeababafbe0949a3587a29364058a7bdad41:/ipif/service.c diff --git a/ipif/service.c b/ipif/service.c index ad55e30..ebfd61b 100644 --- a/ipif/service.c +++ b/ipif/service.c @@ -15,7 +15,7 @@ * is the address of the point-to-point peer. * /,/,... * List of additional routes to add for this interface. - * May be the empty argument. + * May be the empty argument, or `-' if this is problematic. * * is either * ,/[,] @@ -31,6 +31,25 @@ * * Should be run from userv with no-disconnect-hup. */ +/* + * Copyright (C) 1999 Ian Jackson + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with userv-utils; if not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: service.c,v 1.10 1999/11/09 22:35:41 ian Exp $ + */ #include #include @@ -49,7 +68,7 @@ #define NARGS 4 #define MAXEXROUTES 5 -#define ATXTLEN 12 +#define ATXTLEN 16 static const unsigned long gidmaxval= (unsigned long)((gid_t)-2); static const char *const protos_ok[]= { "slip", "cslip", "adaptive", 0 }; @@ -276,6 +295,7 @@ static void permit(unsigned long pprefix, unsigned long pmask) { int i, any; assert(!(pprefix & ~pmask)); + any= 0; if (!proto) fputs("permits",stdout); if (addrnet_isin(localaddr,~0UL, pprefix,pmask)) { @@ -293,7 +313,7 @@ static void permit(unsigned long pprefix, unsigned long pmask) { } } if (!proto) { - if (!any) fputs(" nothing!",stderr); + if (!any) fputs(" nothing",stdout); putchar('\n'); } } @@ -431,29 +451,32 @@ static void parseargs(int argc, const char *const *argv) { addrnet_mustdiffer("local-addr",localaddr,~0UL, "peer-addr",peeraddr,~0UL); carg= *++argv; - for (nexroutes=0; - carg && *carg; - nexroutes++) { - if (nexroutes == MAXEXROUTES) - fatal("too many extra routes (only %d allowed)",MAXEXROUTES); - sprintf(erwhatbuf,"route#%d",nexroutes); + if (strcmp(carg,"-")) { + for (nexroutes=0; + carg && *carg; + nexroutes++) { + if (nexroutes == MAXEXROUTES) + fatal("too many extra routes (only %d allowed)",MAXEXROUTES); + sprintf(erwhatbuf,"route#%d",nexroutes); - eat_prefixmask(&carg,erwhatbuf, ",",0, &routeaddr,&routemask,0); - if (routemask == ~0UL) { - addrnet_mustdiffer(erwhatbuf,routeaddr,routemask, "local-addr",localaddr,~0UL); - addrnet_mustdiffer(erwhatbuf,routeaddr,routemask, "peer-addr",peeraddr,~0UL); - } - for (i=0; i0 && ifnbuf[k-1]!=' '; k--); ifname= ifnbuf+k;