X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=ipif%2Fservice.c;h=97351e6c09dfca4074dca6a0de2ba9b6d3f2c017;hb=5edd18879555ca5e6c7017703f777fd7c9f1300b;hp=ad55e30c29407341527235865208591233f18d6b;hpb=baba109968b1fb5331e24a543ec009bab62c09f5;p=userv-utils.git diff --git a/ipif/service.c b/ipif/service.c index ad55e30..97351e6 100644 --- a/ipif/service.c +++ b/ipif/service.c @@ -11,16 +11,18 @@ * ,,, * As for slattach. Supported protocols are slip, cslip, and * adaptive. Alternatively, set to `debug' to print debugging - * info. is address of the interface on chiark; - * is the address of the point-to-point peer. + * info. is address of the interface on the local + * system; 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 - * ,/[,] + * ,[=]/[,] * indicating that that gid may allocate addresses in * the relevant subspace ( is ignored) + * if `=' is specified then it's only allowed for the local + * endpoint address * or #... * which is a comment * or / or ./ or ../ @@ -31,6 +33,25 @@ * * Should be run from userv with no-disconnect-hup. */ +/* + * Copyright (C) 1999-2000 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$ + */ #include #include @@ -49,7 +70,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 }; @@ -272,28 +293,31 @@ static int addrnet_isin(unsigned long prefix, unsigned long mask, } -static void permit(unsigned long pprefix, unsigned long pmask) { +static void permit(unsigned long pprefix, unsigned long pmask, int localonly) { int i, any; assert(!(pprefix & ~pmask)); + any= 0; - if (!proto) fputs("permits",stdout); + if (!proto) fputs(localonly ? "permits-l" : "permits",stdout); if (addrnet_isin(localaddr,~0UL, pprefix,pmask)) { if (!proto) fputs(" local-addr",stdout); any= localallow= 1; } - if (addrnet_isin(peeraddr,~0UL, pprefix,pmask)) { - if (!proto) fputs(" peer-addr",stdout); - any= peerallow= 1; - } - for (i=0; i0 && ifnbuf[k-1]!=' '; k--); ifname= ifnbuf+k;