Commit Graph

11935 Commits

Author SHA1 Message Date
Philippe Guibert
3bed236338 bgpd: add an icmp flag for flowspec icmp entries
Some values for icmp type/code can not be encoded like port source or
port destination. This is the case of 0 value that is authorized for
icmp.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:59 +02:00
Philippe Guibert
da3fa38394 bgpd: rework icmp enumerate list
As the other enumerate list, icmp type and code are handled as the other
combinations. The icmp type and code options are the last options to be
injected into PBR. If icmp type is present only, all the filtering will
apply to this icmp type. if icmp code is present only, then all the
combination will be done with icmp type ranging from 0 to 255 values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:59 +02:00
Philippe Guibert
e45aea5940 bgpd: fix recursive call combination
The recursive algorithm was taking into account the fact that all the
bpof structures were filled in. Because the dscp value was not given,
the pkt_len parsing could not be achieved. Now the iteration takes into
account each type according to the previous one, thus guaranting all
parameters to be parsed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:59 +02:00
Philippe Guibert
5ac5b7cc7e zebra: handle policy routing fragment handling
incoming iptable entries with fragment parameter is handled.
An iptable context is created for each fragment value received from BGP.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
6f5617d877 bgpd: support for flowspec fragment list into policy routing
The flowspec fragment attribute is taken into account to be pushed in
BGP policy routing entries. Valid values are enumerate list of 1, 2, 4,
or 8 values. no combined value is supported yet.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
588ec356d0 bgpd: align fragment flowspec decoding with tcpflags
As fragment bitmask and tcpflags bitmask in flowspec protocol is encoded
in the same way, it is not necessary to differentiate those two fields.
Moreover, it overrides the initial fragment limit set to 1. It is now
possible to handle multiple framgent values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
cfaf18ce52 bgpd: support for enumerate pkt len
The packet length can be injected from fs entry with an enumerate list;
the negation of the value is also taken into account.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
56707a36d0 bgpd: introduce recursive operations for or flowspec operations
So as to add or remove entries with flowspec or operations like tcp
flags or dscp enum list, a mechanism is put in place that adds
recursivity.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
3570399857 bgpd: enumerate support for dscp values
If one dscp value or an enumerate list of or values of dscp are
provided, then the bgp pbr entries created will take into account the
dscp values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
69214c57c3 zebra: add show pbr iptable dscp information
The iptable configured with dscp displays the dscp value configured.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
4977bd6c19 *: add flowspec dscp handling
Only one dscp value is accepted as filtering option.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:55 +02:00
Philippe Guibert
9bba145596 bgpd: add a parameter to handle param or combinations
Before adding/removing to zebra, flowspec entries parses the list of
combinations or avaialble and creates contexts in order to be injected
to zebra.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
c5ee26cccb bgpd: use a bgp_pbr_or_filter structure to host tcpflags combinations
tcp flags combinations ( or enumerates)  are hosted in a structure that
will be analysed later, when wanting to inject that information to
zebra.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
f7b2e630e4 bgpd: extend enumerate API to handle or operations
The flowspec enumerate list can either be and values or or values.
In the latter case, a list is created that will be used later.
Also, the API supports the check for both and or or operations. This API
does not permit to handle both and and or operations at the same time.
The list will have to be either and or or. An other API retrieves the
operator unary value that is used: and or or. or 0 is the two operators
are used at the same time.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
1a1f4a4c69 bgpd: do not add default route for flowspec for each FS entry
Because the Flowspec entries are parsed first, then injected to Zebra,
there are cases where the install feedback from zebra is not received.
This leads to unnecessary add route events, whereas one should be
enough.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
2e1f721e65 bgpd, lib: share flags values for iptable configuration
Those flags can be shared between BGP and Zebra. That is why
those flags are moved to common pbr.h header file.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
dc993e76e3 zebra: handling of policy routing iptable tcpflags
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
2da7d62e94 bgpd: support for flowspec tcp flags
Ability to handle flowspec tcp flags.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
01ffd28b8d bgpd: fix display with flowspec tcp flags option
When displaying RIB FS summary, the TCP option is not displayed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
0e867886a7 bgpd: simplify API in BGP policy-routing to handle Flowspec
To handle FS params between FS RIB and BGP PBR entities, a structure
intermediate named bgp_pbr_filter is used, and contains all filtering
information that was before passed as a parameter.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
e7f7dad4a8 zebra: add packet length into pbr support
The packet length is added to iptable zapi message.
Then the iptable structure is taking into account the pkt_len field.
The show pbr iptable command displays the packet length used if any.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
538f0137f1 bgpd: add debug routine to display which PBR entry is handled
To know which entry is set/unset, a debug handler is present, that
displays which entry is injected/removed to/from zebra.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
83360720df bgpd: add support of bgp flowspec filtering per packet length
It is possible to do filtering based on packet length value or a range
of packet-length.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
3b0c3697a3 bgpd: add comment to inform that icmp can be stored in that struct
Generic ipset entry structure will be reused to host icmp information.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
932404b7b0 bgpd: handle ICMP type and code from flowspec
It is possible for flowspec entries containing ICMP rule to insert PBR
entries based on ICMP type and ICMP code.
Flowspec ICMP filtering can either have icmp type or icmp code or both.
Not all combinations are permitted:
- if icmp code is provided, then it is not possible to derive the
  correct icmp value. This will not be installed
- range of ICMP is authorised or list of ICMP, but not both.
- on receiving a list of ICMPtype/code, each ICMP type is attempted to
  be associated to ICMP code. If not found, then ICMPtype is combined
  with all known ICMP code values associated to that ICMP type.
- if a specific ICMP type/code is needed, despite the ICMP code/type
  combination does not exist, then it is possible to do it by forging a
  FS ICMP type/code specific for that.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
be729dd7a5 zebra: improve show zebra ipset output for icmp
The icmp type/code is displayed.
Also, the flags are correctly set in case ICMP protocol is elected.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
5b0d92b8d5 zebra: pbr ipset_type2_str command is externalised
The API of that function that converts ipset types is externalised.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Donald Sharp
87270023eb pimd: Remove redistribution request
pim does not pay attention to redistribution events
from zebra so let's not request them.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-27 20:01:22 -04:00
Donald Sharp
03ed85a6c0 lib, zebra: Add a bit of code to look at fifo
When in a dev build add a bit of code to track max
depth of a fifo and to allow zebra to report on it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-27 20:01:22 -04:00
Donald Sharp
34fa087036 zebra: Re-add tracking of redistribution events
Somewhere along the way we lost the tracking of
redistribution events.  Put them back in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-27 19:49:55 -04:00
Quentin Young
62a9c814e1
Merge pull request #2563 from pacovn/Coverity_1465494_String_not_null_terminated_2
lib zebra: str-z check (2) (Coverity 1465494)
2018-06-27 15:15:22 -04:00
Quentin Young
7f3ad069d7
Merge pull request #2570 from pacovn/Coverity_1448386_Untrusted_value_as_argument
lib: untrusted argument (Coverity 1448386)
2018-06-27 15:09:34 -04:00
Jafar Al-Gharaibeh
904124c1ec
Merge pull request #2569 from pacovn/Coverity_1451361_Dereference_before_null_check_2
lib: null check (2) (Coverity 1451361)
2018-06-27 13:51:48 -04:00
Jafar Al-Gharaibeh
e3660a21a4
Merge pull request #2566 from pacovn/Coverity_23024_Dereference_null_return
ospf6d: null check (Coverity 23024)
2018-06-27 13:49:08 -04:00
Jafar Al-Gharaibeh
8bd98c6b15
Merge pull request #2564 from pacovn/Coverity_23110_Dereference_after_null_check
ospfd: null check (Coverity 23110)
2018-06-27 13:47:47 -04:00
paco
45ec351df2
lib: untrusted argument (Coverity 1448386)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-27 15:50:04 +02:00
paco
4872511153
ospf6d: null check (Coverity 23024)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-27 15:31:05 +02:00
paco
64268e1a12
lib: null check (2) (Coverity 1451361)
Additional correction to fa3016309b

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-27 15:24:45 +02:00
paco
4adf00f765
ospfd: null check (Coverity 23110)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-27 14:41:50 +02:00
paco
b6312ad185
lib zebra: str-z check (2) (Coverity 1465494)
This is an additional correction after  45981fda06 / PR #2462. I hope
this fixes the Coverity warning (I've added an additional check for ensuring
the string provided by the inotify read is zero-terminated).

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-27 14:22:01 +02:00
Donald Sharp
71a7b1f82f
Merge pull request #2556 from pacovn/Coverity_1465491_Untrusted_value_as_argument_3
pimd: untrusted argument (3) (Coverity 1465491)
2018-06-26 19:59:27 -04:00
Quentin Young
81ef2361a3
Merge pull request #2559 from pacovn/Coverity_1302503_Logically_dead_code
lib ospfd: dead code (Coverity 1302503 1302502)
2018-06-26 16:48:54 -04:00
paco
39050c7e0d
lib ospfd: dead code (Coverity 1302503 1302502)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-26 21:39:56 +02:00
Quentin Young
045a178c13
Merge pull request #2560 from pacovn/Coverity_1302500_Constant_variable_guards_dead_code
ospfd: dead code (Coverity 1302500)
2018-06-26 15:05:53 -04:00
Quentin Young
cccb13bff1
Merge pull request #2557 from pacovn/Coverity_1465490_Unchecked_return_value
pimd: return check (Coverity 1465490)
2018-06-26 14:42:30 -04:00
paco
9df48e81ee
ospfd: dead code (Coverity 1302500)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-26 20:33:47 +02:00
paco
d1b21b9616
pimd: return check (Coverity 1465490)
Unless someone intentionally changes MCAST_ALL_ROUTERS ("224.0.0.2") with a
wrong IP, this should never fail, so the fix is using "(void)" at the left
of the function call, as an explicit way of indicating we discard the
return value on purpose.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-26 19:34:04 +02:00
Quentin Young
cf6bc77d28
Merge pull request #2503 from pacovn/Coverity_1469898_Uninitialized_scalar_variable
lib: uninitialized variable (2) (Coverity 1469898)
2018-06-26 11:35:58 -04:00
Quentin Young
c1802707e0
Merge pull request #2463 from pacovn/Coverity_1452539_Out-of-bounds_access
lib: out-of-bounds access (Coverity 1452539)
2018-06-26 11:34:31 -04:00
Russ White
8394a34484
Merge pull request #2534 from pacovn/Coverity_1470113_Untrusted_array_index_write
zebra: untrusted array index (2) (Coverity 1470113)
2018-06-26 11:18:38 -04:00