From decdfc17c1e2fb7d67db1ff9e4efe2d22cfffc9a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 27 Jan 2013 13:47:58 +0000 Subject: [PATCH] found on zealot --- ipif/service.c | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/ipif/service.c b/ipif/service.c index 4c9b524..a1f50cf 100644 --- a/ipif/service.c +++ b/ipif/service.c @@ -32,12 +32,14 @@ * * ,,, * - * As for slattach. The only supported protocol is slip. - * Alternatively, set to `debug' to print debugging info and - * exit. is address of the interface to be created - * on the local system; is the address of the - * point-to-point peer. They must be actual addresses (not - * hostnames). + * The supported protocols are: + * slip transfer IP packets using the SLIP protocol + * debug simply print debugging info and exit + * counted our own "counted packet" protocol, see below + * + * is address of the interface to be created on the + * local system; is the address of the point-to-point + * peer. They must be actual addresses (not hostnames). * * /,/,... * @@ -90,6 +92,33 @@ * * The service program should be run from userv with no-disconnect-hup. */ +/* + * Counted packet protocol: + * + * In each direction a bytestream is sent, containing a series + * of messages. + * + * Messages are: + * 32 bits in network byte order length L + * 8 bits message flags F + * 24 bits in network byte order sub-opcode O + * L bytes payload + * + * Where the flags F are as follows: + * 0x01 first 4 bytes of payload are a command tag + * allocated by caller and to be returned by service in response + * 0x02 response message indicates an error; opcode is an error code + * and remainder of response depends on error code + * + * And the flags and opcode (F | O) combinations are + * 0x00 | 0x000000 message is an IPv4 or IPv6 datagram + * 0x01 | 0x000001 add local address; payload is tag + V4 or V6 address + * 0x01 | 0x000002 remove local address + * command payload: tag + V4 or V6 address + * successful response payload: tag only + * 0x01 | 0x000003 add route + * command payload: tag + 1 byte prefix len + addr + */ /* * Copyright (C) 1999-2000,2003 Ian Jackson * This file is part of ipif, part of userv-utils -- 2.30.2