Exemple #1
0
	.af_addr_commit = iso_commit_address
};

struct pinteger parse_snpaoffset = PINTEGER_INITIALIZER1(&snpaoffset,
    "snpaoffset", INT_MIN, INT_MAX, 10, NULL, "snpaoffset",
    &command_root.pb_parser);
struct pinteger parse_nsellength = PINTEGER_INITIALIZER1(&nsellength,
    "nsellength", 0, UINT8_MAX, 10, setnsellength, "nsellength",
    &command_root.pb_parser);

static const struct kwinst isokw[] = {
	  {.k_word = "nsellength", .k_nextparser = &parse_nsellength.pi_parser}
	, {.k_word = "snpaoffset", .k_nextparser = &parse_snpaoffset.pi_parser}
};

struct pkw iso = PKW_INITIALIZER(&iso, "ISO", NULL, NULL,
    isokw, __arraycount(isokw), NULL);

static cmdloop_branch_t branch;

static void
fixnsel(struct sockaddr_iso *siso, uint8_t nsellength)
{
	siso->siso_tlen = nsellength;
}

/* fixup mask */
static int
iso_pre_aifaddr(prop_dictionary_t env, const struct afparam *param)
{
	struct sockaddr_iso *siso;
Exemple #2
0
	  {.k_word = "hidessid", .k_key = "hidessid", .k_neg = true,
	   .k_type = KW_T_BOOL, .k_bool = true, .k_negbool = false,
	   .k_exec = sethidessid}
	, {.k_word = "apbridge", .k_key = "apbridge", .k_neg = true,
	   .k_type = KW_T_BOOL, .k_bool = true, .k_negbool = false,
	   .k_exec = setapbridge}
	, {.k_word = "powersave", .k_key = "powersave", .k_neg = true,
	   .k_type = KW_T_BOOL, .k_bool = true, .k_negbool = false,
	   .k_exec = setifpowersave}
};

static const struct kwinst listskw[] = {
	{.k_word = "scan", .k_exec = scan_exec}
};

static struct pkw lists = PKW_INITIALIZER(&lists, "ieee80211 lists", NULL,
    "list", listskw, __arraycount(listskw), &command_root.pb_parser);

static const struct kwinst kw80211kw[] = {
	  {.k_word = "bssid", .k_nextparser = &parse_bssid.ps_parser}
	, {.k_word = "-bssid", .k_exec = unsetifbssid,
	   .k_nextparser = &command_root.pb_parser}
	, {.k_word = "chan", .k_nextparser = &parse_chan.pi_parser}
	, {.k_word = "-chan", .k_key = "chan", .k_type = KW_T_UINT,
	   .k_uint = IEEE80211_CHAN_ANY, .k_exec = setifchan,
	   .k_nextparser = &command_root.pb_parser}
	, {.k_word = "frag", .k_nextparser = &parse_frag.pi_parser}
	, {.k_word = "-frag", .k_key = "frag", .k_type = KW_T_INT,
	   .k_int = IEEE80211_FRAG_MAX, .k_exec = setiffrag,
	   .k_nextparser = &command_root.pb_parser}
	, {.k_word = "list", .k_nextparser = &lists.pk_parser}
	, {.k_word = "nwid", .k_nextparser = &parse_ssid.ps_parser}
static int deletetunnel(prop_dictionary_t, prop_dictionary_t);
static void tunnel_status(prop_dictionary_t, prop_dictionary_t);

struct paddr tundst = PADDR_INITIALIZER(&tundst, "tundst", settunnel,
    "tundst", NULL, NULL, NULL, &command_root.pb_parser);

struct paddr tunsrc = PADDR_INITIALIZER(&tunsrc, "tunsrc", NULL,
    "tunsrc", NULL, NULL, NULL, &tundst.pa_parser);

static const struct kwinst tunnelkw[] = {
	  {.k_word = "deletetunnel", .k_exec = deletetunnel,
	   .k_nextparser = &command_root.pb_parser}
	, {.k_word = "tunnel", .k_nextparser = &tunsrc.pa_parser}
};

struct pkw tunnel = PKW_INITIALIZER(&tunnel, "tunnel", NULL, NULL,
    tunnelkw, __arraycount(tunnelkw), NULL);

static int
settunnel(prop_dictionary_t env, prop_dictionary_t oenv)
{
	const struct paddr_prefix *srcpfx, *dstpfx;
	struct if_laddrreq req;
	prop_data_t srcdata, dstdata;

	srcdata = (prop_data_t)prop_dictionary_get(env, "tunsrc");
	dstdata = (prop_data_t)prop_dictionary_get(env, "tundst");

	if (srcdata == NULL || dstdata == NULL) {
		warnx("%s.%d", __func__, __LINE__);
		errno = ENOENT;
		return -1;
Exemple #4
0
    {.k_word = "INIT", .k_nextparser = &command_root.pb_parser}
    , {.k_word = "BACKUP", .k_nextparser = &command_root.pb_parser}
    , {.k_word = "MASTER", .k_nextparser = &command_root.pb_parser}
};

struct pinteger parse_advbase = PINTEGER_INITIALIZER1(&parse_advbase, "advbase",
                                0, 255, 10, setcarp_advbase, "advbase", &command_root.pb_parser);

struct pinteger parse_advskew = PINTEGER_INITIALIZER1(&parse_advskew, "advskew",
                                0, 254, 10, setcarp_advskew, "advskew", &command_root.pb_parser);

struct piface carpdev = PIFACE_INITIALIZER(&carpdev, "carpdev", setcarpdev,
                        "carpdev", &command_root.pb_parser);

struct pkw carpstate = PKW_INITIALIZER(&carpstate, "carp state", setcarp_state,
                                       "carp_state", carpstatekw, __arraycount(carpstatekw),
                                       &command_root.pb_parser);

struct pstr pass = PSTR_INITIALIZER(&pass, "pass", setcarp_passwd,
                                    "pass", &command_root.pb_parser);

struct pinteger parse_vhid = PINTEGER_INITIALIZER1(&vhid, "vhid",
                             0, 255, 10, setcarp_vhid, "vhid", &command_root.pb_parser);

static const struct kwinst carpkw[] = {
    {.k_word = "advbase", .k_nextparser = &parse_advbase.pi_parser}
    , {.k_word = "advskew", .k_nextparser = &parse_advskew.pi_parser}
    , {.k_word = "carpdev", .k_nextparser = &carpdev.pif_parser}
    , {
        .k_word = "-carpdev", .k_key = "carpdev", .k_type = KW_T_STR,
        .k_str = "", .k_exec = setcarpdev,
Exemple #5
0
static struct afswtch ataf = {
	.af_name = "atalk", .af_af = AF_APPLETALK, .af_status = at_status,
	.af_addr_commit = at_commit_address
};
struct pinteger phase = PINTEGER_INITIALIZER1(&phase, "phase",
    1, 2, 10, NULL, "phase", &command_root.pb_parser);

struct pstr parse_range = PSTR_INITIALIZER(&range, "range", NULL, "range",
    &command_root.pb_parser);

static const struct kwinst atalkkw[] = {
	  {.k_word = "phase", .k_nextparser = &phase.pi_parser}
	, {.k_word = "range", .k_nextparser = &parse_range.ps_parser}
};

struct pkw atalk = PKW_INITIALIZER(&atalk, "AppleTalk", NULL, NULL,
    atalkkw, __arraycount(atalkkw), NULL);

static cmdloop_branch_t branch;

static void
setatrange_impl(prop_dictionary_t env, prop_dictionary_t oenv,
    struct netrange *nr)
{
	char range[24];
	u_short	first = 123, last = 123;

	if (getargstr(env, "range", range, sizeof(range)) == -1)
		return;

	if (sscanf(range, "%hu-%hu", &first, &last) != 2 ||
	    first == 0 || last == 0 || first > last)