/* $OpenBSD: xf_grp.c,v 1.4 1997/07/02 06:59:38 provos Exp $ */ /* * The author of this code is John Ioannidis, ji@tla.org, * (except when noted otherwise). * * This code was written for BSD/OS in Athens, Greece, in November 1995. * * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996, * by Angelos D. Keromytis, kermit@forthnet.gr. * * Copyright (C) 1995, 1996, 1997 by John Ioannidis and Angelos D. Keromytis. * * Permission to use, copy, and modify this software without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, NEITHER AUTHOR MAKES ANY * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR * PURPOSE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "net/encap.h" #include "netinet/ip_ipsp.h" extern buf[]; int xf_set __P(( struct encap_msghdr *)); int x2i __P((char *)); int xf_grp(argc, argv) int argc; char **argv; { int i; struct encap_msghdr *em; if ((argc < 3) || (argc > 9) || ((argc % 2) != 1)) { fprintf(stderr, "usage: %s dst1 spi1 [ dst2 spi2 [ dst3 spi3 [ dst4 spi4 ] ] ] \n", argv[0]); return 0; } for (i=0; iem_msglen = EMT_GRPSPIS_FLEN; em->em_version = PFENCAP_VERSION_1; em->em_type = EMT_GRPSPIS; em->em_rel_spi = htonl(strtoul(argv[2*i+2], NULL, 16)); em->em_rel_dst.s_addr = inet_addr(argv[2*i+1]); em->em_rel_spi2 = htonl(strtoul(argv[2*i+4], NULL, 16)); em->em_rel_dst2.s_addr = inet_addr(argv[2*i+3]); if (!xf_set(em)) break; } }