<<

NAME

pf::vlan::custom

SYNOPSIS

This is a sample custom pf::vlan::custom module. It performs a database lookup on the requests coming from a Cisco WLC to pre-prend a building Id to the returned VLAN. The query on the database is made using the Called-Station-Id to discriminate based on the AP.

This module extends pf::vlan

INSTALLATION

This module requires the presence of a special table in the database:

    mysql> explain aps;
    +-----------------+-------------+------+-----+---------+-------+
    | Field           | Type        | Null | Key | Default | Extra |
    +-----------------+-------------+------+-----+---------+-------+
    | mac             | varchar(17) | NO   | PRI | NULL    |       |
    | building_id     | int(11)     | NO   |     | NULL    |       |
    | building_name   | text        | NO   |     | NULL    |       |
    +-----------------+-------------+------+-----+---------+-------+

Also, the Called-Sation-Id parameter must be added in pf::radius' fetchVlanForNode. Preferably do this in pf::radius::custom.

    $radius_request->{'Called-Station-Id'}

Rename to pf/vlan/custom.pm and change package declaration to:

    package pf::vlan::custom;

SUBROUTINES

custom_db_prepare

Prepares the database statements.

buildingnum_per_called_station_id

Returns the building id matching the provided Called-Station-Id.

METHODS

fetchVlanForNode

Answers the question: What VLAN should a given node be put into?

Overrides pf::vlan's fetchVlanForNode

CUSTOM: pass the Called-Station-Id to violation, registration and normal VLAN resolvers.

getViolationVlan

Returns the violation vlan for a node (if any)

Overrides pf::vlan::getViolationVlan

CUSTOM: handling called_station_id

Return values:

getRegistrationVlan

Returns the registration vlan for a node if registration is enabled and node is unregistered or pending.

Overrides pf::vlan's getRegistrationVlan

CUSTOM: handling called_station_id

Return values:

getNormalVlan

Sample getNormalVlan, see pf::vlan for getNormalVlan interface description

AUTHOR

Inverse inc. <info@inverse.ca>

COPYRIGHT

Copyright (C) 2005-2015 Inverse inc.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

<<