Netdev List
 help / color / mirror / Atom feed
From: Toerless Eckert <Toerless.Eckert@Informatik.Uni-Erlangen.de>
To: netdev@vger.kernel.org
Cc: Toerless Eckert <Toerless.Eckert@Informatik.Uni-Erlangen.de>
Subject: Re: netdev: fwmarks questions
Date: Thu, 10 Nov 2011 20:22:53 +0100	[thread overview]
Message-ID: <20111110192253.GL14734@faui40p.informatik.uni-erlangen.de> (raw)
In-Reply-To: <20111110191255.GK14734@faui40p.informatik.uni-erlangen.de>

Typo in config below fixed

[ Sorry if this is the wron mailing list. Please let me know if so, and
  recommend a better list for these questions]

a) What APIs exist to set fwmarks for sockets. SO far i could only find:
   setsockopt(,SO_MARK,). But is there for example any system call to
   set the fwmark for all sockets of a process - and which is inherited
   across forks ? If not that, then anything else ?

b) Assume i have two physical ethernet interfaces,
   eth0 ip-address 10.1.1.1/24
   eth1 ip-address 10.10.10.1/24

   I do create a new routing table foobar. I populate it only with routes
   for eth1 (eg: interface route and maybe default route).

   ip route add 10.10.10.0/24 eth1 src 10.10.10.1  table foobar
   ip route add default via 10.10.10.254           table foobar

   I do map this routing table to some fwmark 1234 via eg:

   ip rule add fwmark 1234 table foobar

   Now i have an app with a socket like this:

     s = socket( ...ipv4...)
     setsockopt(s, ... SO_MARK, 1234)
     listen(s, 10)
   
   Question: Would s also accept incoming connections that came in over
   eth0, eg: to eth0, 10.1.1.1 ?

   Logically i think the socket should not accept such connections, but
   only those to eth1, or whatever else i have in my routing table foobar,
   but i have found no documentation that explains how listen() actually
   works when you use fwmarks.

Cheers
    Toerless

      reply	other threads:[~2011-11-10 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 19:12 netdev: fwmarks questions Toerless Eckert
2011-11-10 19:22 ` Toerless Eckert [this message]

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=20111110192253.GL14734@faui40p.informatik.uni-erlangen.de \
    --to=toerless.eckert@informatik.uni-erlangen.de \
    --cc=netdev@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