]>
git.ipfire.org Git - people/ms/rstp.git/blob - brstate.c
2 * brstate.c RTnetlink port state change
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Stephen Hemminger <shemminger@osdl.org>
11 * Modified by Srinivas Aji <Aji_Srinivas@emc.com> for use
12 * in RSTP daemon. - 2006-09-01
20 #include <sys/socket.h>
23 #include <netinet/in.h>
24 #include <linux/if_bridge.h>
27 #include "libnetlink.h"
29 static int br_set_state(struct rtnl_handle
*rth
, unsigned ifindex
, __u8 state
)
37 memset(&req
, 0, sizeof(req
));
39 req
.n
.nlmsg_len
= NLMSG_LENGTH(sizeof(struct ifinfomsg
));
40 req
.n
.nlmsg_flags
= NLM_F_REQUEST
| NLM_F_REPLACE
;
41 req
.n
.nlmsg_type
= RTM_SETLINK
;
42 req
.ifi
.ifi_family
= AF_BRIDGE
;
43 req
.ifi
.ifi_index
= ifindex
;
45 addattr32(&req
.n
, sizeof(req
.buf
), IFLA_PROTINFO
, state
);
47 return rtnl_talk(rth
, &req
.n
, 0, 0, NULL
, NULL
, NULL
);
50 #include "bridge_ctl.h"
52 extern struct rtnl_handle rth_state
;
54 int bridge_set_state(int ifindex
, int brstate
)
56 int err
= br_set_state(&rth_state
, ifindex
, brstate
);
59 "Couldn't set bridge state, ifindex %d, state %d\n",