From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 27023 invoked from network); 11 Dec 2023 19:06:31 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 11 Dec 2023 19:06:31 -0000 Received: from mail-pj1-f47.google.com ([209.85.216.47]) by 9front; Mon Dec 11 14:05:32 -0500 2023 Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-27fe16e8e02so910018a91.0 for <9front@9front.org>; Mon, 11 Dec 2023 11:05:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702321530; x=1702926330; darn=9front.org; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=NqB5TgD/K/YDRz5TgsoaWN4NxeIt+LZlaa095d2fMFU=; b=WHCFNOh9b0Ha9FJRD7jckbWrc6Y5sPYkcKDQGYjXTRYnT/kFrO8zoUdwYoVjz6OYGa TXvBfOZaczCVUBGFRe+uMraFJ/b0g3pmLA7pArF+UilCqtxTbi3mjPe03qCIIVNaEtpa 0s4wAdvxbIUSpyDLtco4jzAY0/9lm85TYgSXKG5IhGFLyHIs0HKyMNMMkcWFZaJIkwML duq/bzk0u94ODm9IvxnVvRbGtgkZtPS4vBx86uNdqb84w3bVz7iY2WIegNQ0AJ3EDpNd vrGI7uTX08Cmsv42oG3ChFFwrBbLh97NAeA1RwcLLBb4r947coBfyOVHmgComaIqqNsk r8nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702321530; x=1702926330; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NqB5TgD/K/YDRz5TgsoaWN4NxeIt+LZlaa095d2fMFU=; b=pMbXyEorapN2MbxU1qm+jTzMHJfdHN4cRKOYAl+O/f9x1aJIltJRJWj8aXIWaxgWfN OIqR4u6tKOMganKWosOpc/dZJRvtsyJ9UeQNhBctEffDhXQaIRpJtVwCpKjQYHjcHr2M j3m9cfDN7FdKCqfI1Ep7LO6Ncpfypp8N/s2FKbhYhVT5QQRL2pUAjG1cga8HnrA5qfJy D9nggG9IpoSz74CqSOLrS+U6NJSdWUAzwUN+StVzSpUP4bCtW4h0IYChfWzuwgNfjJ9q o2Xf8s6O8L7ktoLIkm9Gkk187u3dcpqzt7tpN4i4KDXgdTUvHaKIUYsfr+W7dxSxP+yq RLJw== X-Gm-Message-State: AOJu0Ywd+AwKtj97+vFn7vAZFrp+Rci5KQpSEsiYULn3wEC236PqSfUU sjz1+w2isrfJipQm5SY4ec4v6A0jVSEmRx88bhnYn8Y6H0LGcw== X-Google-Smtp-Source: AGHT+IFk2HwPHMArW1qJI+e0WxHJoL+8+NXa8h1L1FKJm0ZJq7d484JQ6R1KboNlbKtwWoSDc0hhm+fiPsBerCItTy8= X-Received: by 2002:a17:90a:7e95:b0:286:6fe0:8a69 with SMTP id j21-20020a17090a7e9500b002866fe08a69mr8295758pjl.2.1702321530613; Mon, 11 Dec 2023 11:05:30 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a05:7300:7315:b0:fb:64f3:3b3d with HTTP; Mon, 11 Dec 2023 11:05:29 -0800 (PST) In-Reply-To: References: <0C0E7B64F2E5A67D8B1525C4B2EF8C7A@smtp.pobox.com> From: hiro <23hiro@gmail.com> Date: Mon, 11 Dec 2023 20:05:29 +0100 Message-ID: To: 9front@9front.org Content-Type: text/plain; charset="UTF-8" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: scale-out package rails event extension Subject: Re: [9front] [PITCH] ip/null Reply-To: 9front@9front.org Precedence: bulk it would be good if it wouldn't need to get all the way to userland before being dropped. On 12/11/23, Jacob Moody wrote: > This as obsoleted by cinap's aux/dial(1). > It functionally works the same here except you would > need an explicit direction to /dev/null. > > ie. > > aux/dial > 'ipmux!ifc=my.external.ip;dst=192.168.0.0&255.255.0.0|10.0.0.0&255.0.0.0' > > /dev/null > > On 12/11/23 12:54, unobe@cpan.org wrote: >> FWIW, I haven't seen anyone else comment on this, but I like it. >> >> Quoth Jacob Moody : >>> As I play around more with 9front as my router, I found myself reaching >>> for some >>> kind of 'firewall'. I find that we already have a pretty good interface >>> in the kernel >>> in the form of ipmux. But there isn't too many ways of making use of it >>> as is. I hacked up >>> something quick to just drop packets matching a filter on to the floor. >>> If others find it >>> useful I can make up a man page and present again with a bit more >>> polish. >>> >>> Some examples: >>> # Drop inbound private range >>> ip/null >>> 'ifc=my.external.ip;dst=192.168.0.0&255.255.0.0|10.0.0.0&255.0.0.0' >>> >>> # google verboden >>> ip/null 'ifc=my.internal.ip;dst=8.8.8.8;src=192.168.0.0&255.255.0.0' >>> >>> thanks, >>> moody >>> >>> --- /dev/null >>> +++ b//sys/src/cmd/ip/null.c >>> @@ -1,0 +1,36 @@ >>> +#include >>> +#include >>> + >>> +void >>> +usage(void) >>> +{ >>> + fprint(2, "usage: %s filter\n", argv0); >>> + exits("usage"); >>> +} >>> + >>> +void >>> +main(int argc, char **argv) >>> +{ >>> + char buf[64 * 1024]; >>> + int fd; >>> + >>> + ARGBEGIN{ >>> + default: >>> + usage(); >>> + break; >>> + }ARGEND >>> + if(argc < 1) >>> + usage(); >>> + >>> + fd = dial(smprint("ipmux!%s", argv[0]), nil, nil, nil); >>> + if(fd < 0) >>> + sysfatal("dial: %r"); >>> + >>> + for(;;) >>> + switch(read(fd, buf, sizeof buf)){ >>> + case -1: >>> + sysfatal("read: %r"); >>> + case 0: >>> + return; >>> + } >>> +} >> > >