mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jim Fleming" <jfleming@anet.com>
To: <linux-kernel@vger.kernel.org>
Subject: CONFIG_IPv8_TOS for 2.4
Date: Wed, 28 Nov 2001 19:47:16 -0600	[thread overview]
Message-ID: <02d901c17877$c730f3c0$a300a8c0@ipv16> (raw)
In-Reply-To: <20011128163810.C2512@kroah.com> <E169FUY-0006k8-00@the-village.bc.nu> <20011128170748.A2762@kroah.com>

It seems that the "kernel" should be open and free of policy, with
respect to the IPv4 TOS field.
http://www.dot-biz.com/IPv4/Tutorial/

These commands illustrate that not all TOS values can be easily set.
ping -Q 34 192.168.0.1
ping -Q 35 192.168.0.1

Below are the changes I made to make the kernel more open.

Jim Fleming
http://www.IPv8.info
IPv16....One Better !!

------------

/*
 * Networking options
 */
#define CONFIG_PACKET 1
#undef  CONFIG_PACKET_MMAP
#undef  CONFIG_NETLINK
#define CONFIG_NETFILTER 1
#undef  CONFIG_NETFILTER_DEBUG
#undef  CONFIG_FILTER
#define CONFIG_UNIX 1
#define CONFIG_INET 1
#undef  CONFIG_TUX
#define CONFIG_IPv8_TOS 1
#define CONFIG_IP_MULTICAST 1
#undef  CONFIG_IP_ADVANCED_ROUTER
#undef  CONFIG_IP_PNP
#undef  CONFIG_NET_IPIP
#undef  CONFIG_NET_IPGRE
#undef  CONFIG_IP_MROUTE
#undef  CONFIG_INET_ECN
#undef  CONFIG_SYN_COOKIES

#ifndef _LINUX_IP_H
#define _LINUX_IP_H
#include <asm/byteorder.h>

/* SOL_IP socket options */

#ifdef CONFIG_IPv8_TOS
#define IPTOS_TOS_MASK  0xFF
#define IPTOS_TOS(tos)  (tos)
#else
#define IPTOS_TOS_MASK  0x1E
#define IPTOS_TOS(tos)  ((tos)&IPTOS_TOS_MASK)
#define IPTOS_LOWDELAY  0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
#define IPTOS_MINCOST  0x02

#define IPTOS_PREC_MASK  0xE0
#define IPTOS_PREC(tos)  ((tos)&IPTOS_PREC_MASK)
#define IPTOS_PREC_NETCONTROL           0xe0
#define IPTOS_PREC_INTERNETCONTROL      0xc0
#define IPTOS_PREC_CRITIC_ECP           0xa0
#define IPTOS_PREC_FLASHOVERRIDE        0x80
#define IPTOS_PREC_FLASH                0x60
#define IPTOS_PREC_IMMEDIATE            0x40
#define IPTOS_PREC_PRIORITY             0x20
#define IPTOS_PREC_ROUTINE              0x00
#endif

Config.in:bool '  IP: IPv8 TOS' CONFIG_IPv8_TOS

---------------------------------------------------------------------
icmp.c:

#ifdef CONFIG_IPv8_TOS
 tos = iph->tos;
#else
 tos = icmp_pointers[type].error ?
  ((iph->tos & IPTOS_TOS_MASK) | IPTOS_PREC_INTERNETCONTROL) :
   iph->tos;
#endif

---------------------------------------------------------------------
ip_sockglue.c:

  case IP_TOS: /* This sets both TOS and Precedence */

#ifndef CONFIG_IPv8_TOS
     /* Reject setting of unused bits */
#ifndef CONFIG_INET_ECN
   if (val & ~(IPTOS_TOS_MASK|IPTOS_PREC_MASK))
    goto e_inval;
#else
   if (sk->type == SOCK_STREAM) {
    val &= ~3;
    val |= sk->protinfo.af_inet.tos & 3;
   }
#endif
   if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP && 
       !capable(CAP_NET_ADMIN)) {
    err = -EPERM;
    break;
   }
#endif
   if (sk->protinfo.af_inet.tos != val) {
    sk->protinfo.af_inet.tos=val;
    sk->priority = rt_tos2priority(val);
    sk_dst_reset(sk); 
   }
   break;
  case IP_TTL:
---------------------------------------------------------------------



  reply	other threads:[~2001-11-29  1:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-29  0:38 [PATCH] fix for drivers/char/pc_keyb.c in 2.5.1-pre3 Greg KH
2001-11-29  0:55 ` Alan Cox
2001-11-29  1:07   ` Greg KH
2001-11-29  1:47     ` Jim Fleming [this message]
2001-11-29  7:40   ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='02d901c17877$c730f3c0$a300a8c0@ipv16' \
    --to=jfleming@anet.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®