gtp-rtnl: add gtp_dev_destroy
This function allows you to destroy the gtpX device.
This commit is contained in:
parent
10df05902b
commit
41ff538fb4
|
@ -15,6 +15,7 @@ int genl_socket_talk(struct mnl_socket *nl, struct nlmsghdr *nlh, uint32_t seq,
|
|||
int genl_lookup_family(struct mnl_socket *nl, const char *family);
|
||||
|
||||
int gtp_dev_create(const char *ifname);
|
||||
int gtp_dev_destroy(const char *ifname);
|
||||
|
||||
struct gtp_tunnel;
|
||||
|
||||
|
|
|
@ -98,3 +98,21 @@ int gtp_dev_create(const char *ifname)
|
|||
return gtp_dev_talk(nlh, seq);
|
||||
}
|
||||
EXPORT_SYMBOL(gtp_dev_create);
|
||||
|
||||
int gtp_dev_destroy(const char *ifname)
|
||||
{
|
||||
char buf[MNL_SOCKET_BUFFER_SIZE];
|
||||
struct nlmsghdr *nlh;
|
||||
struct ifinfomsg *ifm;
|
||||
unsigned int seq = time(NULL);
|
||||
|
||||
nlh = gtp_put_nlmsg(buf, RTM_DELLINK, NLM_F_ACK, seq);
|
||||
ifm = mnl_nlmsg_put_extra_header(nlh, sizeof(*ifm));
|
||||
ifm->ifi_family = AF_INET;
|
||||
ifm->ifi_change |= IFF_UP;
|
||||
ifm->ifi_flags &= ~IFF_UP;
|
||||
ifm->ifi_index = if_nametoindex(ifname);
|
||||
|
||||
return gtp_dev_talk(nlh, seq);
|
||||
}
|
||||
EXPORT_SYMBOL(gtp_dev_destroy);
|
||||
|
|
|
@ -4,7 +4,10 @@ global:
|
|||
genl_nlmsg_build_hdr;
|
||||
genl_socket_talk;
|
||||
genl_lookup_family;
|
||||
|
||||
gtp_dev_create;
|
||||
gtp_dev_destroy;
|
||||
|
||||
gtp_add_tunnel;
|
||||
gtp_del_tunnel;
|
||||
gtp_list_tunnel;
|
||||
|
|
Loading…
Reference in New Issue