ifconfig: add if_ctx argument to the generic and ifclone callbacks.
This is the continuation of the ifconfig cleanup work. This change is a pre-requsite for the next changes removing some of the global variables. It will also help in implementing functionality via Netlink instead of ioctl. No functional changes intended. * vxlan_cb() was removed as it contained no code * ioctl_ifcreate() was renamed to ifcreate_ioctl() to follow the other netlink/ioctl function naming. Netlink and ioctl provide _different_ interfaces and it's not possible to have a unified interface object that can be filled by either netlink or ioctl implementations. With that in mind, I'm leaning more to the function_<nl|ioctl> postfix pattern, than doing ioctl_ or netlink_ prefix. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D40426 MFC after: 2 weeks
This commit is contained in:
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
static const char *carp_states[] = { CARP_STATES };
|
static const char *carp_states[] = { CARP_STATES };
|
||||||
|
|
||||||
static void setcarp_callback(int, void *);
|
static void setcarp_callback(if_ctx *, void *);
|
||||||
|
|
||||||
static int carpr_vhid = -1;
|
static int carpr_vhid = -1;
|
||||||
static int carpr_advskew = -1;
|
static int carpr_advskew = -1;
|
||||||
@@ -114,7 +114,7 @@ setcarp_vhid(if_ctx *ctx, const char *val, int dummy __unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setcarp_callback(int s __unused, void *arg __unused)
|
setcarp_callback(if_ctx *ctx __unused, void *arg __unused)
|
||||||
{
|
{
|
||||||
struct ifconfig_carp carpr = { };
|
struct ifconfig_carp carpr = { };
|
||||||
|
|
||||||
|
|||||||
@@ -118,13 +118,12 @@ clone_setdefcallback_filter(clone_match_func *filter, clone_callback_func *p)
|
|||||||
* no parameters.
|
* no parameters.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
ifclonecreate(int s, void *arg __unused)
|
ifclonecreate(if_ctx *ctx, void *arg __unused)
|
||||||
{
|
{
|
||||||
struct ifreq ifr;
|
struct ifreq ifr = {};
|
||||||
struct clone_defcb *dcp;
|
struct clone_defcb *dcp;
|
||||||
|
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
|
||||||
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
|
|
||||||
|
|
||||||
/* Try to find a default callback by filter */
|
/* Try to find a default callback by filter */
|
||||||
SLIST_FOREACH(dcp, &clone_defcbh, next) {
|
SLIST_FOREACH(dcp, &clone_defcbh, next) {
|
||||||
@@ -145,9 +144,9 @@ ifclonecreate(int s, void *arg __unused)
|
|||||||
|
|
||||||
if (dcp == NULL || dcp->clone_cb == NULL) {
|
if (dcp == NULL || dcp->clone_cb == NULL) {
|
||||||
/* NB: no parameters */
|
/* NB: no parameters */
|
||||||
ioctl_ifcreate(s, &ifr);
|
ifcreate_ioctl(ctx, &ifr);
|
||||||
} else {
|
} else {
|
||||||
dcp->clone_cb(s, &ifr);
|
dcp->clone_cb(ctx, &ifr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -161,7 +160,7 @@ ifclonecreate(int s, void *arg __unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clone_create(if_ctx *ctx __unused, const char *cmd __unused, int d __unused)
|
clone_create(if_ctx *ctx, const char *cmd __unused, int d __unused)
|
||||||
{
|
{
|
||||||
callback_register(ifclonecreate, NULL);
|
callback_register(ifclonecreate, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,9 +201,9 @@ usage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ioctl_ifcreate(int s, struct ifreq *ifr)
|
ifcreate_ioctl(if_ctx *ctx, struct ifreq *ifr)
|
||||||
{
|
{
|
||||||
if (ioctl(s, SIOCIFCREATE2, ifr) < 0) {
|
if (ioctl(ctx->io_s, SIOCIFCREATE2, ifr) < 0) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EEXIST:
|
case EEXIST:
|
||||||
errx(1, "interface %s already exists", ifr->ifr_name);
|
errx(1, "interface %s already exists", ifr->ifr_name);
|
||||||
@@ -1143,7 +1143,7 @@ ifconfig(if_ctx *orig_ctx, int iscreate, const struct afswtch *uafp)
|
|||||||
if (cb == NULL)
|
if (cb == NULL)
|
||||||
errx(1, "internal error, no callback");
|
errx(1, "internal error, no callback");
|
||||||
callbacks = cb->cb_next;
|
callbacks = cb->cb_next;
|
||||||
cb->cb_func(s, cb->cb_arg);
|
cb->cb_func(ctx, cb->cb_arg);
|
||||||
iscreate = 0;
|
iscreate = 0;
|
||||||
/*
|
/*
|
||||||
* Handle any address family spec that
|
* Handle any address family spec that
|
||||||
@@ -1204,7 +1204,7 @@ ifconfig(if_ctx *orig_ctx, int iscreate, const struct afswtch *uafp)
|
|||||||
* command-line arguments.
|
* command-line arguments.
|
||||||
*/
|
*/
|
||||||
for (cb = callbacks; cb != NULL; cb = cb->cb_next)
|
for (cb = callbacks; cb != NULL; cb = cb->cb_next)
|
||||||
cb->cb_func(s, cb->cb_arg);
|
cb->cb_func(ctx, cb->cb_arg);
|
||||||
/*
|
/*
|
||||||
* Do deferred operations.
|
* Do deferred operations.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+15
-19
@@ -53,13 +53,19 @@
|
|||||||
|
|
||||||
struct afswtch;
|
struct afswtch;
|
||||||
struct cmd;
|
struct cmd;
|
||||||
struct ifconfig_context;
|
struct snl_state;
|
||||||
|
struct ifconfig_args;
|
||||||
|
struct ifconfig_context {
|
||||||
|
struct ifconfig_args *args;
|
||||||
|
const struct afswtch *afp;
|
||||||
|
int io_s; /* fd to use for ioctl() */
|
||||||
|
struct snl_state *io_ss; /* NETLINK_ROUTE socket */
|
||||||
|
};
|
||||||
|
typedef const struct ifconfig_context if_ctx;
|
||||||
|
|
||||||
typedef void c_func(const struct ifconfig_context *ctx, const char *cmd, int arg);
|
typedef void c_func(if_ctx *ctx, const char *cmd, int arg);
|
||||||
typedef void c_func2(const struct ifconfig_context *ctx, const char *arg1,
|
typedef void c_func2(if_ctx *ctx, const char *arg1, const char *arg2);
|
||||||
const char *arg2);
|
typedef void c_func3(if_ctx *ctx, const char *cmd, const char *arg);
|
||||||
typedef void c_func3(const struct ifconfig_context *ctx, const char *cmd,
|
|
||||||
const char *arg);
|
|
||||||
|
|
||||||
struct cmd {
|
struct cmd {
|
||||||
const char *c_name;
|
const char *c_name;
|
||||||
@@ -79,7 +85,7 @@ struct cmd {
|
|||||||
};
|
};
|
||||||
void cmd_register(struct cmd *);
|
void cmd_register(struct cmd *);
|
||||||
|
|
||||||
typedef void callback_func(int s, void *);
|
typedef void callback_func(if_ctx *, void *);
|
||||||
void callback_register(callback_func *, void *);
|
void callback_register(callback_func *, void *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -144,16 +150,6 @@ void callback_register(callback_func *, void *);
|
|||||||
.c_next = NULL, \
|
.c_next = NULL, \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct snl_state;
|
|
||||||
struct ifconfig_args;
|
|
||||||
struct ifconfig_context {
|
|
||||||
struct ifconfig_args *args;
|
|
||||||
const struct afswtch *afp;
|
|
||||||
int io_s; /* fd to use for ioctl() */
|
|
||||||
struct snl_state *io_ss; /* NETLINK_ROUTE socket */
|
|
||||||
};
|
|
||||||
typedef const struct ifconfig_context if_ctx;
|
|
||||||
|
|
||||||
#define ioctl_ctx(ctx, _req, ...) ioctl((ctx)->io_s, _req, ## __VA_ARGS__)
|
#define ioctl_ctx(ctx, _req, ...) ioctl((ctx)->io_s, _req, ## __VA_ARGS__)
|
||||||
|
|
||||||
struct ifaddrs;
|
struct ifaddrs;
|
||||||
@@ -271,7 +267,7 @@ void printb(const char *s, unsigned value, const char *bits);
|
|||||||
void ifmaybeload(struct ifconfig_args *args, const char *name);
|
void ifmaybeload(struct ifconfig_args *args, const char *name);
|
||||||
|
|
||||||
typedef int clone_match_func(const char *);
|
typedef int clone_match_func(const char *);
|
||||||
typedef void clone_callback_func(int, struct ifreq *);
|
typedef void clone_callback_func(if_ctx *, struct ifreq *);
|
||||||
void clone_setdefcallback_prefix(const char *, clone_callback_func *);
|
void clone_setdefcallback_prefix(const char *, clone_callback_func *);
|
||||||
void clone_setdefcallback_filter(clone_match_func *, clone_callback_func *);
|
void clone_setdefcallback_filter(clone_match_func *, clone_callback_func *);
|
||||||
|
|
||||||
@@ -303,7 +299,7 @@ struct ifmediareq *ifmedia_getstate(void);
|
|||||||
|
|
||||||
void print_vhid(const struct ifaddrs *, const char *);
|
void print_vhid(const struct ifaddrs *, const char *);
|
||||||
|
|
||||||
void ioctl_ifcreate(int s, struct ifreq *);
|
void ifcreate_ioctl(if_ctx *ctx, struct ifreq *ifr);
|
||||||
|
|
||||||
/* Helpers */
|
/* Helpers */
|
||||||
struct sockaddr_in;
|
struct sockaddr_in;
|
||||||
|
|||||||
+14
-14
@@ -447,10 +447,10 @@ getroam(int s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setroam_cb(int s, void *arg)
|
setroam_cb(if_ctx *ctx, void *arg)
|
||||||
{
|
{
|
||||||
struct ieee80211_roamparams_req *roam = arg;
|
struct ieee80211_roamparams_req *roam = arg;
|
||||||
set80211(s, IEEE80211_IOC_ROAM, 0, sizeof(*roam), roam);
|
set80211(ctx->io_s, IEEE80211_IOC_ROAM, 0, sizeof(*roam), roam);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -465,10 +465,10 @@ gettxparams(int s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
settxparams_cb(int s, void *arg)
|
settxparams_cb(if_ctx *ctx, void *arg)
|
||||||
{
|
{
|
||||||
struct ieee80211_txparams_req *txp = arg;
|
struct ieee80211_txparams_req *txp = arg;
|
||||||
set80211(s, IEEE80211_IOC_TXPARAMS, 0, sizeof(*txp), txp);
|
set80211(ctx->io_s, IEEE80211_IOC_TXPARAMS, 0, sizeof(*txp), txp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -491,7 +491,7 @@ getdevcaps(int s, struct ieee80211_devcaps_req *dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setregdomain_cb(int s, void *arg)
|
setregdomain_cb(if_ctx *ctx, void *arg)
|
||||||
{
|
{
|
||||||
struct ieee80211_regdomain_req *req;
|
struct ieee80211_regdomain_req *req;
|
||||||
struct ieee80211_regdomain *rd = arg;
|
struct ieee80211_regdomain *rd = arg;
|
||||||
@@ -545,7 +545,7 @@ setregdomain_cb(int s, void *arg)
|
|||||||
if (dc == NULL)
|
if (dc == NULL)
|
||||||
errx(1, "no space for device capabilities");
|
errx(1, "no space for device capabilities");
|
||||||
dc->dc_chaninfo.ic_nchans = MAXCHAN;
|
dc->dc_chaninfo.ic_nchans = MAXCHAN;
|
||||||
getdevcaps(s, dc);
|
getdevcaps(ctx->io_s, dc);
|
||||||
#if 0
|
#if 0
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf("drivercaps: 0x%x\n", dc->dc_drivercaps);
|
printf("drivercaps: 0x%x\n", dc->dc_drivercaps);
|
||||||
@@ -576,11 +576,11 @@ setregdomain_cb(int s, void *arg)
|
|||||||
errx(1, "no space for channel list");
|
errx(1, "no space for channel list");
|
||||||
memcpy(chaninfo, &req->chaninfo,
|
memcpy(chaninfo, &req->chaninfo,
|
||||||
IEEE80211_CHANINFO_SPACE(&req->chaninfo));
|
IEEE80211_CHANINFO_SPACE(&req->chaninfo));
|
||||||
print_channels(s, &req->chaninfo, 1/*allchans*/, 1/*verbose*/);
|
print_channels(ctx->io_s, &req->chaninfo, 1/*allchans*/, 1/*verbose*/);
|
||||||
}
|
}
|
||||||
if (req->chaninfo.ic_nchans == 0)
|
if (req->chaninfo.ic_nchans == 0)
|
||||||
errx(1, "no channels calculated");
|
errx(1, "no channels calculated");
|
||||||
set80211(s, IEEE80211_IOC_REGDOMAIN, 0,
|
set80211(ctx->io_s, IEEE80211_IOC_REGDOMAIN, 0,
|
||||||
IEEE80211_REGDOMAIN_SPACE(req), req);
|
IEEE80211_REGDOMAIN_SPACE(req), req);
|
||||||
free(req);
|
free(req);
|
||||||
free(dc);
|
free(dc);
|
||||||
@@ -5739,7 +5739,7 @@ print_string(const u_int8_t *buf, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setdefregdomain(int s)
|
setdefregdomain(if_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct regdata *rdp = getregdata();
|
struct regdata *rdp = getregdata();
|
||||||
const struct regdomain *rd;
|
const struct regdomain *rd;
|
||||||
@@ -5750,7 +5750,7 @@ setdefregdomain(int s)
|
|||||||
regdomain.country != CTRY_DEFAULT)
|
regdomain.country != CTRY_DEFAULT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getregdomain(s);
|
getregdomain(ctx->io_s);
|
||||||
|
|
||||||
/* Check if it was already set by the driver. */
|
/* Check if it was already set by the driver. */
|
||||||
if (regdomain.regdomain != 0 ||
|
if (regdomain.regdomain != 0 ||
|
||||||
@@ -5767,7 +5767,7 @@ setdefregdomain(int s)
|
|||||||
defaultcountry(rd);
|
defaultcountry(rd);
|
||||||
|
|
||||||
/* Send changes to net80211. */
|
/* Send changes to net80211. */
|
||||||
setregdomain_cb(s, ®domain);
|
setregdomain_cb(ctx, ®domain);
|
||||||
|
|
||||||
/* Cleanup (so it can be overridden by subsequent parameters). */
|
/* Cleanup (so it can be overridden by subsequent parameters). */
|
||||||
regdomain.regdomain = 0;
|
regdomain.regdomain = 0;
|
||||||
@@ -5784,7 +5784,7 @@ static struct ieee80211_clone_params params = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wlan_create(int s, struct ifreq *ifr)
|
wlan_create(if_ctx *ctx, struct ifreq *ifr)
|
||||||
{
|
{
|
||||||
static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
|
static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
|
||||||
char orig_name[IFNAMSIZ];
|
char orig_name[IFNAMSIZ];
|
||||||
@@ -5796,13 +5796,13 @@ wlan_create(int s, struct ifreq *ifr)
|
|||||||
memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0)
|
memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0)
|
||||||
errx(1, "no bssid specified for WDS (use wlanbssid)");
|
errx(1, "no bssid specified for WDS (use wlanbssid)");
|
||||||
ifr->ifr_data = (caddr_t) ¶ms;
|
ifr->ifr_data = (caddr_t) ¶ms;
|
||||||
ioctl_ifcreate(s, ifr);
|
ifcreate_ioctl(ctx, ifr);
|
||||||
|
|
||||||
/* XXX preserve original name for ifclonecreate(). */
|
/* XXX preserve original name for ifclonecreate(). */
|
||||||
strlcpy(orig_name, name, sizeof(orig_name));
|
strlcpy(orig_name, name, sizeof(orig_name));
|
||||||
strlcpy(name, ifr->ifr_name, sizeof(name));
|
strlcpy(name, ifr->ifr_name, sizeof(name));
|
||||||
|
|
||||||
setdefregdomain(s);
|
setdefregdomain(ctx);
|
||||||
|
|
||||||
strlcpy(name, orig_name, sizeof(name));
|
strlcpy(name, orig_name, sizeof(name));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,10 +308,10 @@ setlaggtype(if_ctx *ctx __unused, const char *arg, int dummy __unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lagg_create(int s, struct ifreq *ifr)
|
lagg_create(if_ctx *ctx, struct ifreq *ifr)
|
||||||
{
|
{
|
||||||
ifr->ifr_data = (caddr_t) ¶ms;
|
ifr->ifr_data = (caddr_t) ¶ms;
|
||||||
ioctl_ifcreate(s, ifr);
|
ifcreate_ioctl(ctx, ifr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct cmd lagg_cmds[] = {
|
static struct cmd lagg_cmds[] = {
|
||||||
|
|||||||
+11
-11
@@ -90,7 +90,7 @@
|
|||||||
|
|
||||||
#include "ifconfig.h"
|
#include "ifconfig.h"
|
||||||
|
|
||||||
static void domediaopt(const char *, bool);
|
static void domediaopt(if_ctx *, const char *, bool);
|
||||||
static ifmedia_t get_media_subtype(ifmedia_t, const char *);
|
static ifmedia_t get_media_subtype(ifmedia_t, const char *);
|
||||||
static ifmedia_t get_media_mode(ifmedia_t, const char *);
|
static ifmedia_t get_media_mode(ifmedia_t, const char *);
|
||||||
static ifmedia_t get_media_options(ifmedia_t, const char *);
|
static ifmedia_t get_media_options(ifmedia_t, const char *);
|
||||||
@@ -175,14 +175,14 @@ ifmedia_getstate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setifmediacallback(int s, void *arg)
|
setifmediacallback(if_ctx *ctx, void *arg)
|
||||||
{
|
{
|
||||||
struct ifmediareq *ifmr = (struct ifmediareq *)arg;
|
struct ifmediareq *ifmr = (struct ifmediareq *)arg;
|
||||||
static bool did_it = false;
|
static bool did_it = false;
|
||||||
|
|
||||||
if (!did_it) {
|
if (!did_it) {
|
||||||
ifr.ifr_media = ifmr->ifm_current;
|
ifr.ifr_media = ifmr->ifm_current;
|
||||||
if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0)
|
if (ioctl_ctx(ctx, SIOCSIFMEDIA, (caddr_t)&ifr) < 0)
|
||||||
err(1, "SIOCSIFMEDIA (media)");
|
err(1, "SIOCSIFMEDIA (media)");
|
||||||
free(ifmr);
|
free(ifmr);
|
||||||
did_it = true;
|
did_it = true;
|
||||||
@@ -190,7 +190,7 @@ setifmediacallback(int s, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setmedia(if_ctx *ctx __unused, const char *val, int d __unused)
|
setmedia(if_ctx *ctx, const char *val, int d __unused)
|
||||||
{
|
{
|
||||||
struct ifmediareq *ifmr;
|
struct ifmediareq *ifmr;
|
||||||
int subtype;
|
int subtype;
|
||||||
@@ -217,21 +217,21 @@ setmedia(if_ctx *ctx __unused, const char *val, int d __unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setmediaopt(if_ctx *ctx __unused, const char *val, int d __unused)
|
setmediaopt(if_ctx *ctx, const char *val, int d __unused)
|
||||||
{
|
{
|
||||||
|
|
||||||
domediaopt(val, false);
|
domediaopt(ctx, val, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unsetmediaopt(if_ctx *ctx __unused, const char *val, int d __unused)
|
unsetmediaopt(if_ctx *ctx, const char *val, int d __unused)
|
||||||
{
|
{
|
||||||
|
|
||||||
domediaopt(val, true);
|
domediaopt(ctx, val, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
domediaopt(const char *val, bool clear)
|
domediaopt(if_ctx *ctx, const char *val, bool clear)
|
||||||
{
|
{
|
||||||
struct ifmediareq *ifmr;
|
struct ifmediareq *ifmr;
|
||||||
ifmedia_t options;
|
ifmedia_t options;
|
||||||
@@ -256,7 +256,7 @@ domediaopt(const char *val, bool clear)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setmediainst(if_ctx *ctx __unused, const char *val, int d __unused)
|
setmediainst(if_ctx *ctx, const char *val, int d __unused)
|
||||||
{
|
{
|
||||||
struct ifmediareq *ifmr;
|
struct ifmediareq *ifmr;
|
||||||
int inst;
|
int inst;
|
||||||
@@ -275,7 +275,7 @@ setmediainst(if_ctx *ctx __unused, const char *val, int d __unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setmediamode(if_ctx *ctx __unused, const char *val, int d __unused)
|
setmediamode(if_ctx *ctx, const char *val, int d __unused)
|
||||||
{
|
{
|
||||||
struct ifmediareq *ifmr;
|
struct ifmediareq *ifmr;
|
||||||
int mode;
|
int mode;
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ vlan_parse_ethervid(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vlan_create(int s, struct ifreq *ifr)
|
vlan_create(if_ctx *ctx, struct ifreq *ifr)
|
||||||
{
|
{
|
||||||
vlan_parse_ethervid(ifr->ifr_name);
|
vlan_parse_ethervid(ifr->ifr_name);
|
||||||
|
|
||||||
@@ -172,11 +172,11 @@ vlan_create(int s, struct ifreq *ifr)
|
|||||||
errx(1, "must specify a parent device for vlan create");
|
errx(1, "must specify a parent device for vlan create");
|
||||||
ifr->ifr_data = (caddr_t) ¶ms;
|
ifr->ifr_data = (caddr_t) ¶ms;
|
||||||
}
|
}
|
||||||
ioctl_ifcreate(s, ifr);
|
ifcreate_ioctl(ctx, ifr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vlan_cb(int s __unused, void *arg __unused)
|
vlan_cb(if_ctx *ctx __unused, void *arg __unused)
|
||||||
{
|
{
|
||||||
if ((params.vlr_tag != NOTAG) ^ (params.vlr_parent[0] != '\0'))
|
if ((params.vlr_tag != NOTAG) ^ (params.vlr_parent[0] != '\0'))
|
||||||
errx(1, "both vlan and vlandev must be specified");
|
errx(1, "both vlan and vlandev must be specified");
|
||||||
|
|||||||
@@ -179,19 +179,13 @@ vxlan_check_params(void)
|
|||||||
#undef _REMOTE_ADDR46
|
#undef _REMOTE_ADDR46
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vxlan_cb(int s __unused, void *arg __unused)
|
vxlan_create(if_ctx *ctx, struct ifreq *ifr)
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
vxlan_create(int s, struct ifreq *ifr)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
vxlan_check_params();
|
vxlan_check_params();
|
||||||
|
|
||||||
ifr->ifr_data = (caddr_t) ¶ms;
|
ifr->ifr_data = (caddr_t) ¶ms;
|
||||||
ioctl_ifcreate(s, ifr);
|
ifcreate_ioctl(ctx, ifr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -640,6 +634,5 @@ vxlan_ctor(void)
|
|||||||
for (i = 0; i < nitems(vxlan_cmds); i++)
|
for (i = 0; i < nitems(vxlan_cmds); i++)
|
||||||
cmd_register(&vxlan_cmds[i]);
|
cmd_register(&vxlan_cmds[i]);
|
||||||
af_register(&af_vxlan);
|
af_register(&af_vxlan);
|
||||||
callback_register(vxlan_cb, NULL);
|
|
||||||
clone_setdefcallback_prefix("vxlan", vxlan_create);
|
clone_setdefcallback_prefix("vxlan", vxlan_create);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user