\doxysection{Netdev}
\label{group__netdev}\index{Netdev@{Netdev}}


network device (interface) convenience functions  


\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ netdev.\+c}
\begin{DoxyCompactList}\small\item\em Example lifecycle use of the API\+: \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ netdev\+\_\+netns\+\_\+ctx}
\item 
struct \textbf{ osmo\+\_\+netdev}
\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ IFINDEX\+\_\+\+UNUSED}~0
\item 
\#define \textbf{ LOGNETDEV}(netdev,  lvl,  fmt,  args ...)
\item 
\#define \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+ENTER}(netdev,  switch\+\_\+state,  str\+\_\+prefix)
\item 
\#define \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+EXIT}(netdev,  switch\+\_\+state,  str\+\_\+prefix)
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$ \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+alloc} (void $\ast$ctx, const char $\ast$netns\+\_\+name)
\item 
static void \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+free} (struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$netns\+\_\+ctx)
\item 
static int \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+init} (struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$netns\+\_\+ctx)
\item 
static struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$ \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+find\+\_\+by\+\_\+netns\+\_\+name} (const char $\ast$netns\+\_\+name)
\item 
static struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$ \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+get} (const char $\ast$netns\+\_\+name)
\item 
static void \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+put} (struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$netns\+\_\+ctx)
\item 
struct \textbf{ osmo\+\_\+netdev} $\ast$ \textbf{ osmo\+\_\+netdev\+\_\+alloc} (void $\ast$ctx, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Allocate a new netdev object. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+netdev\+\_\+free} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Free an allocated netdev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+netdev\+\_\+register} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Start managing the network device referenced by the netdev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+netdev\+\_\+unregister} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Unregister the netdev object (stop managing /moniutoring the interface) \end{DoxyCompactList}\item 
bool \textbf{ osmo\+\_\+netdev\+\_\+is\+\_\+registered} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Retrieve whether the netdev object is in \char`\"{}registered\char`\"{} state. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+netdev\+\_\+set\+\_\+priv\+\_\+data} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, void $\ast$priv\+\_\+data)
\begin{DoxyCompactList}\small\item\em Set private user data pointer on the netdev object. \end{DoxyCompactList}\item 
void $\ast$ \textbf{ osmo\+\_\+netdev\+\_\+get\+\_\+priv\+\_\+data} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Get private user data pointer from the netdev object. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+netdev\+\_\+set\+\_\+ifupdown\+\_\+ind\+\_\+cb} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, \textbf{ osmo\+\_\+netdev\+\_\+ifupdown\+\_\+ind\+\_\+cb\+\_\+t} ifupdown\+\_\+ind\+\_\+cb)
\begin{DoxyCompactList}\small\item\em Set ifupdown\+\_\+ind\+\_\+cb callback, called when the link status (UP/\+DOWN) changes. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+netdev\+\_\+set\+\_\+dev\+\_\+name\+\_\+chg\+\_\+cb} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, \textbf{ osmo\+\_\+netdev\+\_\+dev\+\_\+name\+\_\+chg\+\_\+cb\+\_\+t} dev\+\_\+name\+\_\+chg\+\_\+cb)
\begin{DoxyCompactList}\small\item\em Set dev\+\_\+name\+\_\+chg\+\_\+cb callback, called when a change in the network name is detected. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+netdev\+\_\+set\+\_\+mtu\+\_\+chg\+\_\+cb} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, \textbf{ osmo\+\_\+netdev\+\_\+mtu\+\_\+chg\+\_\+cb\+\_\+t} mtu\+\_\+chg\+\_\+cb)
\begin{DoxyCompactList}\small\item\em Set mtu\+\_\+chg\+\_\+cb callback, called when a change in the network name is detected. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+netdev\+\_\+get\+\_\+name} (const struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Get name used to identify the netdev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+netdev\+\_\+set\+\_\+ifindex} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, unsigned int ifindex)
\begin{DoxyCompactList}\small\item\em Set (specify) interface index identifying the network interface to manage. \end{DoxyCompactList}\item 
unsigned int \textbf{ osmo\+\_\+netdev\+\_\+get\+\_\+ifindex} (const struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Get interface index identifying the interface managed by netdev. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+netdev\+\_\+set\+\_\+netns\+\_\+name} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, const char $\ast$netns\+\_\+name)
\begin{DoxyCompactList}\small\item\em Set (specify) name of the network namespace where the network interface to manage is located. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+netdev\+\_\+get\+\_\+netns\+\_\+name} (const struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Get name of network namespace used when opening the netdev interface. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+netdev\+\_\+get\+\_\+dev\+\_\+name} (const struct \textbf{ osmo\+\_\+netdev} $\ast$netdev)
\begin{DoxyCompactList}\small\item\em Get name used to name the network interface created by the netdev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+netdev\+\_\+set\+\_\+mtu} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, uint32\+\_\+t mtu)
\begin{DoxyCompactList}\small\item\em Set the MTU of the network interface. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+netdev\+\_\+ifupdown} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, bool ifupdown)
\begin{DoxyCompactList}\small\item\em Bring netdev interface UP or DOWN. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+netdev\+\_\+add\+\_\+addr} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, const struct \textbf{ osmo\+\_\+sockaddr} $\ast$addr, uint8\+\_\+t prefixlen)
\begin{DoxyCompactList}\small\item\em Add IP address to netdev interface. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+netdev\+\_\+add\+\_\+route} (struct \textbf{ osmo\+\_\+netdev} $\ast$netdev, const struct \textbf{ osmo\+\_\+sockaddr} $\ast$dst\+\_\+addr, uint8\+\_\+t dst\+\_\+prefixlen, const struct \textbf{ osmo\+\_\+sockaddr} $\ast$gw\+\_\+addr)
\begin{DoxyCompactList}\small\item\em Add IP route to netdev interface. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static struct \textbf{ llist\+\_\+head} \textbf{ g\+\_\+netdev\+\_\+netns\+\_\+ctx\+\_\+list} = \textbf{ LLIST\+\_\+\+HEAD\+\_\+\+INIT}(g\+\_\+netdev\+\_\+netns\+\_\+ctx\+\_\+list)
\item 
static struct \textbf{ llist\+\_\+head} \textbf{ g\+\_\+netdev\+\_\+list} = \textbf{ LLIST\+\_\+\+HEAD\+\_\+\+INIT}(g\+\_\+netdev\+\_\+list)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
network device (interface) convenience functions 



\doxysubsection{Macro Definition Documentation}
\mbox{\label{group__netdev_ga4ada97f372aa49d80609df05f03cf22d}} 
\index{Netdev@{Netdev}!IFINDEX\_UNUSED@{IFINDEX\_UNUSED}}
\index{IFINDEX\_UNUSED@{IFINDEX\_UNUSED}!Netdev@{Netdev}}
\doxysubsubsection{IFINDEX\_UNUSED}
{\footnotesize\ttfamily \#define IFINDEX\+\_\+\+UNUSED~0}

\mbox{\label{group__netdev_gab5dc692ce52be4e4fceac01d7d7f37a7}} 
\index{Netdev@{Netdev}!LOGNETDEV@{LOGNETDEV}}
\index{LOGNETDEV@{LOGNETDEV}!Netdev@{Netdev}}
\doxysubsubsection{LOGNETDEV}
{\footnotesize\ttfamily \#define LOGNETDEV(\begin{DoxyParamCaption}\item[{}]{netdev,  }\item[{}]{lvl,  }\item[{}]{fmt,  }\item[{}]{args ... }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{        LOGP(DLGLOBAL, lvl, \textcolor{stringliteral}{"{}NETDEV(\%s,if=\%s/\%u,ns=\%s): "{}} fmt, \(\backslash\)}
\DoxyCodeLine{             (netdev)-\/>name, osmo\_netdev\_get\_dev\_name(netdev) ? : \textcolor{stringliteral}{"{}"{}}, \(\backslash\)}
\DoxyCodeLine{             (netdev)-\/>ifindex, (netdev)-\/>netns\_name ? : \textcolor{stringliteral}{"{}"{}}, \#\# args)}

\end{DoxyCode}
\mbox{\label{group__netdev_ga969600e117b60bbf37373c285429b6b9}} 
\index{Netdev@{Netdev}!NETDEV\_NETNS\_ENTER@{NETDEV\_NETNS\_ENTER}}
\index{NETDEV\_NETNS\_ENTER@{NETDEV\_NETNS\_ENTER}!Netdev@{Netdev}}
\doxysubsubsection{NETDEV\_NETNS\_ENTER}
{\footnotesize\ttfamily \#define NETDEV\+\_\+\+NETNS\+\_\+\+ENTER(\begin{DoxyParamCaption}\item[{}]{netdev,  }\item[{}]{switch\+\_\+state,  }\item[{}]{str\+\_\+prefix }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{        \textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{                if ((netdev)-\/>netns\_name) \{ \(\backslash\)}
\DoxyCodeLine{                        LOGNETDEV(netdev, LOGL\_DEBUG, str\_prefix \textcolor{stringliteral}{"{}: Switch to netns '\%s'\(\backslash\)n"{}}, \(\backslash\)}
\DoxyCodeLine{                               (netdev)-\/>netns\_name); \(\backslash\)}
\DoxyCodeLine{                        int rc2 = osmo\_netns\_switch\_enter((netdev)-\/>netns\_ctx-\/>netns\_fd, switch\_state); \(\backslash\)}
\DoxyCodeLine{                        if (rc2 < 0) \{ \(\backslash\)}
\DoxyCodeLine{                                LOGNETDEV(netdev, LOGL\_ERROR, str\_prefix \textcolor{stringliteral}{"{}: Cannot switch to netns '\%s': \%s (\%d)\(\backslash\)n"{}}, \(\backslash\)}
\DoxyCodeLine{                                       (netdev)-\/>netns\_name, strerror(errno), errno); \(\backslash\)}
\DoxyCodeLine{                                return -\/EACCES; \(\backslash\)}
\DoxyCodeLine{                        \} \(\backslash\)}
\DoxyCodeLine{                \} \(\backslash\)}
\DoxyCodeLine{        \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
\mbox{\label{group__netdev_ga22138414127e915e3de3588e11ded38c}} 
\index{Netdev@{Netdev}!NETDEV\_NETNS\_EXIT@{NETDEV\_NETNS\_EXIT}}
\index{NETDEV\_NETNS\_EXIT@{NETDEV\_NETNS\_EXIT}!Netdev@{Netdev}}
\doxysubsubsection{NETDEV\_NETNS\_EXIT}
{\footnotesize\ttfamily \#define NETDEV\+\_\+\+NETNS\+\_\+\+EXIT(\begin{DoxyParamCaption}\item[{}]{netdev,  }\item[{}]{switch\+\_\+state,  }\item[{}]{str\+\_\+prefix }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{        \textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{                if ((netdev)-\/>netns\_name) \{ \(\backslash\)}
\DoxyCodeLine{                        int rc2 = osmo\_netns\_switch\_exit(switch\_state); \(\backslash\)}
\DoxyCodeLine{                        if (rc2 < 0) \{ \(\backslash\)}
\DoxyCodeLine{                                LOGNETDEV(netdev, LOGL\_ERROR, str\_prefix \textcolor{stringliteral}{"{}: Cannot switch back from netns '\%s': \%s\(\backslash\)n"{}}, \(\backslash\)}
\DoxyCodeLine{                                       (netdev)-\/>netns\_name, strerror(errno)); \(\backslash\)}
\DoxyCodeLine{                                return rc2; \(\backslash\)}
\DoxyCodeLine{                        \} \(\backslash\)}
\DoxyCodeLine{                        LOGNETDEV(netdev, LOGL\_DEBUG, str\_prefix \textcolor{stringliteral}{"{}: Back from netns '\%s'\(\backslash\)n"{}}, \(\backslash\)}
\DoxyCodeLine{                               (netdev)-\/>netns\_name); \(\backslash\)}
\DoxyCodeLine{                \} \(\backslash\)}
\DoxyCodeLine{        \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}


\doxysubsection{Function Documentation}
\mbox{\label{group__netdev_gae3898d5fb30e050bf7af51c3d03f9d84}} 
\index{Netdev@{Netdev}!netdev\_netns\_ctx\_alloc@{netdev\_netns\_ctx\_alloc}}
\index{netdev\_netns\_ctx\_alloc@{netdev\_netns\_ctx\_alloc}!Netdev@{Netdev}}
\doxysubsubsection{netdev\_netns\_ctx\_alloc()}
{\footnotesize\ttfamily static struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$ netdev\+\_\+netns\+\_\+ctx\+\_\+alloc (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{const char $\ast$}]{netns\+\_\+name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ netdev\+\_\+netns\+\_\+ctx\+::entry}, \textbf{ g\+\_\+netdev\+\_\+netns\+\_\+ctx\+\_\+list}, \textbf{ llist\+\_\+add\+\_\+tail()}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+::netns\+\_\+fd}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+::netns\+\_\+name}, and \textbf{ OSMO\+\_\+\+ASSERT}.



Referenced by \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+get()}.

\mbox{\label{group__netdev_gacf3819f21848a90b2d993dc108554cb7}} 
\index{Netdev@{Netdev}!netdev\_netns\_ctx\_find\_by\_netns\_name@{netdev\_netns\_ctx\_find\_by\_netns\_name}}
\index{netdev\_netns\_ctx\_find\_by\_netns\_name@{netdev\_netns\_ctx\_find\_by\_netns\_name}!Netdev@{Netdev}}
\doxysubsubsection{netdev\_netns\_ctx\_find\_by\_netns\_name()}
{\footnotesize\ttfamily static struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$ netdev\+\_\+netns\+\_\+ctx\+\_\+find\+\_\+by\+\_\+netns\+\_\+name (\begin{DoxyParamCaption}\item[{const char $\ast$}]{netns\+\_\+name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ netdev\+\_\+netns\+\_\+ctx\+::entry}, \textbf{ g\+\_\+netdev\+\_\+netns\+\_\+ctx\+\_\+list}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, and \textbf{ netdev\+\_\+netns\+\_\+ctx\+::netns\+\_\+name}.



Referenced by \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+get()}.

\mbox{\label{group__netdev_ga9169d1aa2ca7fb9bd07026357f243b83}} 
\index{Netdev@{Netdev}!netdev\_netns\_ctx\_free@{netdev\_netns\_ctx\_free}}
\index{netdev\_netns\_ctx\_free@{netdev\_netns\_ctx\_free}!Netdev@{Netdev}}
\doxysubsubsection{netdev\_netns\_ctx\_free()}
{\footnotesize\ttfamily static void netdev\+\_\+netns\+\_\+ctx\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$}]{netns\+\_\+ctx }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ netdev\+\_\+netns\+\_\+ctx\+::entry}, \textbf{ llist\+\_\+del()}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+::netns\+\_\+fd}, and \textbf{ osmo\+\_\+mnl\+\_\+destroy()}.



Referenced by \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+get()}, and \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+put()}.

\mbox{\label{group__netdev_ga9c55df043ea41970ed82d1c492a4b2dd}} 
\index{Netdev@{Netdev}!netdev\_netns\_ctx\_get@{netdev\_netns\_ctx\_get}}
\index{netdev\_netns\_ctx\_get@{netdev\_netns\_ctx\_get}!Netdev@{Netdev}}
\doxysubsubsection{netdev\_netns\_ctx\_get()}
{\footnotesize\ttfamily static struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$ netdev\+\_\+netns\+\_\+ctx\+\_\+get (\begin{DoxyParamCaption}\item[{const char $\ast$}]{netns\+\_\+name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+alloc()}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+find\+\_\+by\+\_\+netns\+\_\+name()}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+free()}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+init()}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+::netns\+\_\+name}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ netdev\+\_\+netns\+\_\+ctx\+::refcount}.



Referenced by \textbf{ osmo\+\_\+netdev\+\_\+register()}.

\mbox{\label{group__netdev_ga3b65d35445cb42434ebc36f5b6790c98}} 
\index{Netdev@{Netdev}!netdev\_netns\_ctx\_init@{netdev\_netns\_ctx\_init}}
\index{netdev\_netns\_ctx\_init@{netdev\_netns\_ctx\_init}!Netdev@{Netdev}}
\doxysubsubsection{netdev\_netns\_ctx\_init()}
{\footnotesize\ttfamily static int netdev\+\_\+netns\+\_\+ctx\+\_\+init (\begin{DoxyParamCaption}\item[{struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$}]{netns\+\_\+ctx }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ DLGLOBAL}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGL\+\_\+\+INFO}, \textbf{ LOGP}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+::netns\+\_\+fd}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+::netns\+\_\+name}, and \textbf{ osmo\+\_\+mnl\+\_\+init()}.



Referenced by \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+get()}.

\mbox{\label{group__netdev_gab396629a3b50261d6a5984c706ce298a}} 
\index{Netdev@{Netdev}!netdev\_netns\_ctx\_put@{netdev\_netns\_ctx\_put}}
\index{netdev\_netns\_ctx\_put@{netdev\_netns\_ctx\_put}!Netdev@{Netdev}}
\doxysubsubsection{netdev\_netns\_ctx\_put()}
{\footnotesize\ttfamily static void netdev\+\_\+netns\+\_\+ctx\+\_\+put (\begin{DoxyParamCaption}\item[{struct \textbf{ netdev\+\_\+netns\+\_\+ctx} $\ast$}]{netns\+\_\+ctx }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+free()}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ netdev\+\_\+netns\+\_\+ctx\+::refcount}.



Referenced by \textbf{ osmo\+\_\+netdev\+\_\+register()}, and \textbf{ osmo\+\_\+netdev\+\_\+unregister()}.

\mbox{\label{group__netdev_ga825bf951a8c5fc3792c2f8e038b6f623}} 
\index{Netdev@{Netdev}!osmo\_netdev\_add\_addr@{osmo\_netdev\_add\_addr}}
\index{osmo\_netdev\_add\_addr@{osmo\_netdev\_add\_addr}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_add\_addr()}
{\footnotesize\ttfamily int osmo\+\_\+netdev\+\_\+add\+\_\+addr (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{const struct \textbf{ osmo\+\_\+sockaddr} $\ast$}]{addr,  }\item[{uint8\+\_\+t}]{prefixlen }\end{DoxyParamCaption})}



Add IP address to netdev interface. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object managing the netdev interface \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & The local address to set on the interface \\
\hline
\mbox{\texttt{ in}}  & {\em prefixlen} & The network prefix of addr \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on succes; negative on error. 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::dev\+\_\+name}, \textbf{ ENOTSUP}, \textbf{ osmo\+\_\+netdev\+::ifindex}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGL\+\_\+\+NOTICE}, \textbf{ LOGNETDEV}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+ENTER}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+EXIT}, \textbf{ osmo\+\_\+netdev\+::netns\+\_\+ctx}, \textbf{ osmo\+\_\+sockaddr\+\_\+ntop()}, \textbf{ osmo\+\_\+netdev\+::registered}, \textbf{ osmo\+\_\+sockaddr\+::sa}, and \textbf{ osmo\+\_\+sockaddr\+::u}.

\mbox{\label{group__netdev_ga780d0f6069c596a41383b619e3ce0bb9}} 
\index{Netdev@{Netdev}!osmo\_netdev\_add\_route@{osmo\_netdev\_add\_route}}
\index{osmo\_netdev\_add\_route@{osmo\_netdev\_add\_route}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_add\_route()}
{\footnotesize\ttfamily int osmo\+\_\+netdev\+\_\+add\+\_\+route (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{const struct \textbf{ osmo\+\_\+sockaddr} $\ast$}]{dst\+\_\+addr,  }\item[{uint8\+\_\+t}]{dst\+\_\+prefixlen,  }\item[{const struct \textbf{ osmo\+\_\+sockaddr} $\ast$}]{gw\+\_\+addr }\end{DoxyParamCaption})}



Add IP route to netdev interface. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object managing the netdev interface \\
\hline
\mbox{\texttt{ in}}  & {\em dst\+\_\+addr} & The destination address of the route \\
\hline
\mbox{\texttt{ in}}  & {\em dst\+\_\+prefixlen} & The network prefix of dst\+\_\+addr \\
\hline
\mbox{\texttt{ in}}  & {\em gw\+\_\+addr} & The gateway address. Optional, can be NULL. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on succes; negative on error. 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::dev\+\_\+name}, \textbf{ ENOTSUP}, \textbf{ osmo\+\_\+netdev\+::ifindex}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGL\+\_\+\+NOTICE}, \textbf{ LOGNETDEV}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+ENTER}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+EXIT}, \textbf{ osmo\+\_\+netdev\+::netns\+\_\+ctx}, \textbf{ osmo\+\_\+sockaddr\+\_\+ntop()}, \textbf{ osmo\+\_\+netdev\+::registered}, \textbf{ osmo\+\_\+sockaddr\+::sa}, and \textbf{ osmo\+\_\+sockaddr\+::u}.

\mbox{\label{group__netdev_ga32e80af9f73ffa365aa4f29d2b2f4694}} 
\index{Netdev@{Netdev}!osmo\_netdev\_alloc@{osmo\_netdev\_alloc}}
\index{osmo\_netdev\_alloc@{osmo\_netdev\_alloc}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_alloc()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+netdev} $\ast$ osmo\+\_\+netdev\+\_\+alloc (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Allocate a new netdev object. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context to use as a parent when allocating the netdev object \\
\hline
\mbox{\texttt{ in}}  & {\em name} & A name providen to identify the netdev object \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
newly allocated netdev object on success; NULL on error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::entry}, \textbf{ g\+\_\+netdev\+\_\+list}, \textbf{ llist\+\_\+add\+\_\+tail()}, \textbf{ name}, and \textbf{ osmo\+\_\+netdev\+::name}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+alloc()}.

\mbox{\label{group__netdev_gaecbec5417790f43d80d16183f17e42ec}} 
\index{Netdev@{Netdev}!osmo\_netdev\_free@{osmo\_netdev\_free}}
\index{osmo\_netdev\_free@{osmo\_netdev\_free}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_free()}
{\footnotesize\ttfamily void osmo\+\_\+netdev\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Free an allocated netdev object. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object to free \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+netdev\+::entry}, \textbf{ llist\+\_\+del()}, \textbf{ osmo\+\_\+netdev\+\_\+is\+\_\+registered()}, and \textbf{ osmo\+\_\+netdev\+\_\+unregister()}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+free()}.

\mbox{\label{group__netdev_ga7dcaccdf71b69fabc3314f6572e376b5}} 
\index{Netdev@{Netdev}!osmo\_netdev\_get\_dev\_name@{osmo\_netdev\_get\_dev\_name}}
\index{osmo\_netdev\_get\_dev\_name@{osmo\_netdev\_get\_dev\_name}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_get\_dev\_name()}
{\footnotesize\ttfamily const char $\ast$ osmo\+\_\+netdev\+\_\+get\+\_\+dev\+\_\+name (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Get name used to name the network interface created by the netdev object. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object from where to retrieve the field \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The interface name (or NULL if unknown)
\end{DoxyReturn}
This information is retrieved internally once the netdev object enters the \char`\"{}registered\char`\"{} state. Hence, when not registered NULL can be returned. 

References \textbf{ osmo\+\_\+netdev\+::dev\+\_\+name}.



Referenced by \textbf{ tundev\+\_\+dev\+\_\+name\+\_\+chg\+\_\+cb()}.

\mbox{\label{group__netdev_ga2b39c6854bc31bd9f249cf6573122b45}} 
\index{Netdev@{Netdev}!osmo\_netdev\_get\_ifindex@{osmo\_netdev\_get\_ifindex}}
\index{osmo\_netdev\_get\_ifindex@{osmo\_netdev\_get\_ifindex}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_get\_ifindex()}
{\footnotesize\ttfamily unsigned int osmo\+\_\+netdev\+\_\+get\+\_\+ifindex (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Get interface index identifying the interface managed by netdev. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object from where to retrieve the field \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The current value of the configured netdev interface ifindex to use (0 = unset) 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::ifindex}.

\mbox{\label{group__netdev_gad9fc6b9f309dcd3870ee2b5ac6156558}} 
\index{Netdev@{Netdev}!osmo\_netdev\_get\_name@{osmo\_netdev\_get\_name}}
\index{osmo\_netdev\_get\_name@{osmo\_netdev\_get\_name}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_get\_name()}
{\footnotesize\ttfamily const char $\ast$ osmo\+\_\+netdev\+\_\+get\+\_\+name (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Get name used to identify the netdev object. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object from where to retrieve the field \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The current value of the name used to identify the netdev object 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::name}.

\mbox{\label{group__netdev_gac398f4cda6c1be1ed1a9f4891e2ef27e}} 
\index{Netdev@{Netdev}!osmo\_netdev\_get\_netns\_name@{osmo\_netdev\_get\_netns\_name}}
\index{osmo\_netdev\_get\_netns\_name@{osmo\_netdev\_get\_netns\_name}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_get\_netns\_name()}
{\footnotesize\ttfamily const char $\ast$ osmo\+\_\+netdev\+\_\+get\+\_\+netns\+\_\+name (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Get name of network namespace used when opening the netdev interface. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object from where to retrieve the field \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The current value of the configured network namespace 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::netns\+\_\+name}.

\mbox{\label{group__netdev_ga739ed172d1ab973677f45d1ec1e84fe1}} 
\index{Netdev@{Netdev}!osmo\_netdev\_get\_priv\_data@{osmo\_netdev\_get\_priv\_data}}
\index{osmo\_netdev\_get\_priv\_data@{osmo\_netdev\_get\_priv\_data}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_get\_priv\_data()}
{\footnotesize\ttfamily void $\ast$ osmo\+\_\+netdev\+\_\+get\+\_\+priv\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Get private user data pointer from the netdev object. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object from where to retrieve the field \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The current value of the priv\+\_\+data field. 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::priv\+\_\+data}.



Referenced by \textbf{ tundev\+\_\+dev\+\_\+name\+\_\+chg\+\_\+cb()}, \textbf{ tundev\+\_\+ifupdown\+\_\+ind\+\_\+cb()}, and \textbf{ tundev\+\_\+mtu\+\_\+chg\+\_\+cb()}.

\mbox{\label{group__netdev_gaf9cb007a767215b58bbac2912ad8b7b6}} 
\index{Netdev@{Netdev}!osmo\_netdev\_ifupdown@{osmo\_netdev\_ifupdown}}
\index{osmo\_netdev\_ifupdown@{osmo\_netdev\_ifupdown}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_ifupdown()}
{\footnotesize\ttfamily int osmo\+\_\+netdev\+\_\+ifupdown (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{bool}]{ifupdown }\end{DoxyParamCaption})}



Bring netdev interface UP or DOWN. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object managing the netdev interface \\
\hline
\mbox{\texttt{ in}}  & {\em ifupdown} & true to set the interface UP, false to set it DOWN \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on succes; negative on error. 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::dev\+\_\+name}, \textbf{ ENOTSUP}, \textbf{ osmo\+\_\+netdev\+::ifindex}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGL\+\_\+\+NOTICE}, \textbf{ LOGNETDEV}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+ENTER}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+EXIT}, \textbf{ osmo\+\_\+netdev\+::netns\+\_\+ctx}, and \textbf{ osmo\+\_\+netdev\+::registered}.

\mbox{\label{group__netdev_ga337c7b72b1ae03b12fc450b40ae35dad}} 
\index{Netdev@{Netdev}!osmo\_netdev\_is\_registered@{osmo\_netdev\_is\_registered}}
\index{osmo\_netdev\_is\_registered@{osmo\_netdev\_is\_registered}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_is\_registered()}
{\footnotesize\ttfamily bool osmo\+\_\+netdev\+\_\+is\+\_\+registered (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Retrieve whether the netdev object is in \char`\"{}registered\char`\"{} state. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object to check \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if in state \char`\"{}registered\char`\"{}; false otherwise 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::registered}.



Referenced by \textbf{ osmo\+\_\+netdev\+\_\+free()}.

\mbox{\label{group__netdev_gaec0126c21739421bb5e662a97a75b7e1}} 
\index{Netdev@{Netdev}!osmo\_netdev\_register@{osmo\_netdev\_register}}
\index{osmo\_netdev\_register@{osmo\_netdev\_register}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_register()}
{\footnotesize\ttfamily int osmo\+\_\+netdev\+\_\+register (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Start managing the network device referenced by the netdev object. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object to open \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::dev\+\_\+name}, \textbf{ osmo\+\_\+netdev\+::ifindex}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+get()}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+put()}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+ENTER}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+EXIT}, \textbf{ osmo\+\_\+netdev\+::netns\+\_\+ctx}, \textbf{ osmo\+\_\+netdev\+::netns\+\_\+name}, \textbf{ osmo\+\_\+talloc\+\_\+replace\+\_\+string()}, and \textbf{ osmo\+\_\+netdev\+::registered}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+open()}.

\mbox{\label{group__netdev_gac844662701678dd871da96dc0087ae52}} 
\index{Netdev@{Netdev}!osmo\_netdev\_set\_dev\_name\_chg\_cb@{osmo\_netdev\_set\_dev\_name\_chg\_cb}}
\index{osmo\_netdev\_set\_dev\_name\_chg\_cb@{osmo\_netdev\_set\_dev\_name\_chg\_cb}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_set\_dev\_name\_chg\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+netdev\+\_\+set\+\_\+dev\+\_\+name\+\_\+chg\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{\textbf{ osmo\+\_\+netdev\+\_\+dev\+\_\+name\+\_\+chg\+\_\+cb\+\_\+t}}]{dev\+\_\+name\+\_\+chg\+\_\+cb }\end{DoxyParamCaption})}



Set dev\+\_\+name\+\_\+chg\+\_\+cb callback, called when a change in the network name is detected. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object where the field is set \\
\hline
\mbox{\texttt{ in}}  & {\em dev\+\_\+name\+\_\+chg\+\_\+cb} & the user provided function to be called when a the interface is renamed \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+netdev\+::dev\+\_\+name\+\_\+chg\+\_\+cb}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+alloc()}.

\mbox{\label{group__netdev_ga7281946d49b12d0a7c4eb4c16f558de7}} 
\index{Netdev@{Netdev}!osmo\_netdev\_set\_ifindex@{osmo\_netdev\_set\_ifindex}}
\index{osmo\_netdev\_set\_ifindex@{osmo\_netdev\_set\_ifindex}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_set\_ifindex()}
{\footnotesize\ttfamily int osmo\+\_\+netdev\+\_\+set\+\_\+ifindex (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{unsigned int}]{ifindex }\end{DoxyParamCaption})}



Set (specify) interface index identifying the network interface to manage. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object where the field is set \\
\hline
\mbox{\texttt{ in}}  & {\em ifindex} & The interface index identifying the interface \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error
\end{DoxyReturn}
The ifindex, together with the netns\+\_\+name (see osmo\+\_\+netdev\+\_\+netns\+\_\+name\+\_\+set()), form together the key identifiers of a network interface to manage. This field is used during \doxyref{osmo\+\_\+netdev\+\_\+register()}{p.}{group__netdev_gaec0126c21739421bb5e662a97a75b7e1} time, and hence must be set before calling that API, and cannot be changed when the netdev object is in \char`\"{}registered\char`\"{} state. 

References \textbf{ osmo\+\_\+netdev\+::ifindex}, and \textbf{ osmo\+\_\+netdev\+::registered}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+open()}.

\mbox{\label{group__netdev_gababee4a5d0c92a512a2341cda69f39b9}} 
\index{Netdev@{Netdev}!osmo\_netdev\_set\_ifupdown\_ind\_cb@{osmo\_netdev\_set\_ifupdown\_ind\_cb}}
\index{osmo\_netdev\_set\_ifupdown\_ind\_cb@{osmo\_netdev\_set\_ifupdown\_ind\_cb}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_set\_ifupdown\_ind\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+netdev\+\_\+set\+\_\+ifupdown\+\_\+ind\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{\textbf{ osmo\+\_\+netdev\+\_\+ifupdown\+\_\+ind\+\_\+cb\+\_\+t}}]{ifupdown\+\_\+ind\+\_\+cb }\end{DoxyParamCaption})}



Set ifupdown\+\_\+ind\+\_\+cb callback, called when the link status (UP/\+DOWN) changes. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object where the field is set \\
\hline
\mbox{\texttt{ in}}  & {\em ifupdown\+\_\+ind\+\_\+cb} & the user provided function to be called when the link status (UP/\+DOWN) changes \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+netdev\+::ifupdown\+\_\+ind\+\_\+cb}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+alloc()}.

\mbox{\label{group__netdev_gad11e6788b3fb89bd8bcd810018aadbbd}} 
\index{Netdev@{Netdev}!osmo\_netdev\_set\_mtu@{osmo\_netdev\_set\_mtu}}
\index{osmo\_netdev\_set\_mtu@{osmo\_netdev\_set\_mtu}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_set\_mtu()}
{\footnotesize\ttfamily int osmo\+\_\+netdev\+\_\+set\+\_\+mtu (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{uint32\+\_\+t}]{mtu }\end{DoxyParamCaption})}



Set the MTU of the network interface. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object where the field is set \\
\hline
\mbox{\texttt{ in}}  & {\em mtu} & The MTU to be set on the network interface \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::dev\+\_\+name}, \textbf{ ENOTSUP}, \textbf{ osmo\+\_\+netdev\+::ifindex}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGL\+\_\+\+NOTICE}, \textbf{ LOGNETDEV}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+ENTER}, \textbf{ NETDEV\+\_\+\+NETNS\+\_\+\+EXIT}, \textbf{ osmo\+\_\+netdev\+::netns\+\_\+ctx}, and \textbf{ osmo\+\_\+netdev\+::registered}.

\mbox{\label{group__netdev_ga7bd8f74ebaa249c39ebb763ce75d3fba}} 
\index{Netdev@{Netdev}!osmo\_netdev\_set\_mtu\_chg\_cb@{osmo\_netdev\_set\_mtu\_chg\_cb}}
\index{osmo\_netdev\_set\_mtu\_chg\_cb@{osmo\_netdev\_set\_mtu\_chg\_cb}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_set\_mtu\_chg\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+netdev\+\_\+set\+\_\+mtu\+\_\+chg\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{\textbf{ osmo\+\_\+netdev\+\_\+mtu\+\_\+chg\+\_\+cb\+\_\+t}}]{mtu\+\_\+chg\+\_\+cb }\end{DoxyParamCaption})}



Set mtu\+\_\+chg\+\_\+cb callback, called when a change in the network name is detected. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object where the field is set \\
\hline
\mbox{\texttt{ in}}  & {\em mtu\+\_\+chg\+\_\+cb} & the user provided function to be called when the configured MTU at the interface changes \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+netdev\+::mtu\+\_\+chg\+\_\+cb}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+alloc()}.

\mbox{\label{group__netdev_ga0dd272ca87047c551d30df56353af378}} 
\index{Netdev@{Netdev}!osmo\_netdev\_set\_netns\_name@{osmo\_netdev\_set\_netns\_name}}
\index{osmo\_netdev\_set\_netns\_name@{osmo\_netdev\_set\_netns\_name}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_set\_netns\_name()}
{\footnotesize\ttfamily int osmo\+\_\+netdev\+\_\+set\+\_\+netns\+\_\+name (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{const char $\ast$}]{netns\+\_\+name }\end{DoxyParamCaption})}



Set (specify) name of the network namespace where the network interface to manage is located. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object where the field is set \\
\hline
\mbox{\texttt{ in}}  & {\em netns\+\_\+name} & The network namespace where the network interface is located \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error
\end{DoxyReturn}
The netns\+\_\+name, together with the ifindex (see osmo\+\_\+netdev\+\_\+ifindex\+\_\+set()), form together the key identifiers of a network interface to manage. This field is used during \doxyref{osmo\+\_\+netdev\+\_\+register()}{p.}{group__netdev_gaec0126c21739421bb5e662a97a75b7e1} time, and hence must be set before calling that API, and cannot be changed when the netdev object is in \char`\"{}registered\char`\"{} state. If left as NULL (default), the management will be done in the current network namespace. 

References \textbf{ osmo\+\_\+netdev\+::netns\+\_\+name}, \textbf{ osmo\+\_\+talloc\+\_\+replace\+\_\+string()}, and \textbf{ osmo\+\_\+netdev\+::registered}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+open()}.

\mbox{\label{group__netdev_ga4866aa0d1f95e3d029fc3dc6d4902d97}} 
\index{Netdev@{Netdev}!osmo\_netdev\_set\_priv\_data@{osmo\_netdev\_set\_priv\_data}}
\index{osmo\_netdev\_set\_priv\_data@{osmo\_netdev\_set\_priv\_data}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_set\_priv\_data()}
{\footnotesize\ttfamily void osmo\+\_\+netdev\+\_\+set\+\_\+priv\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev,  }\item[{void $\ast$}]{priv\+\_\+data }\end{DoxyParamCaption})}



Set private user data pointer on the netdev object. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object where the field is set \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+netdev\+::priv\+\_\+data}.



Referenced by \textbf{ osmo\+\_\+tundev\+\_\+alloc()}.

\mbox{\label{group__netdev_ga8a7a3ebc822eec1042214c3f21e6ff1f}} 
\index{Netdev@{Netdev}!osmo\_netdev\_unregister@{osmo\_netdev\_unregister}}
\index{osmo\_netdev\_unregister@{osmo\_netdev\_unregister}!Netdev@{Netdev}}
\doxysubsubsection{osmo\_netdev\_unregister()}
{\footnotesize\ttfamily int osmo\+\_\+netdev\+\_\+unregister (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+netdev} $\ast$}]{netdev }\end{DoxyParamCaption})}



Unregister the netdev object (stop managing /moniutoring the interface) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em netdev} & The netdev object to close \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+netdev\+::if\+\_\+mtu\+\_\+known}, \textbf{ osmo\+\_\+netdev\+::if\+\_\+up\+\_\+known}, \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+put()}, \textbf{ osmo\+\_\+netdev\+::netns\+\_\+ctx}, and \textbf{ osmo\+\_\+netdev\+::registered}.



Referenced by \textbf{ osmo\+\_\+netdev\+\_\+free()}, \textbf{ osmo\+\_\+tundev\+\_\+close()}, and \textbf{ osmo\+\_\+tundev\+\_\+open()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__netdev_ga0293c3a48fcf58db0d868841e7e411c4}} 
\index{Netdev@{Netdev}!g\_netdev\_list@{g\_netdev\_list}}
\index{g\_netdev\_list@{g\_netdev\_list}!Netdev@{Netdev}}
\doxysubsubsection{g\_netdev\_list}
{\footnotesize\ttfamily struct \textbf{ llist\+\_\+head} g\+\_\+netdev\+\_\+list = \textbf{ LLIST\+\_\+\+HEAD\+\_\+\+INIT}(g\+\_\+netdev\+\_\+list)\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ osmo\+\_\+netdev\+\_\+alloc()}.

\mbox{\label{group__netdev_ga65309d7955fccd5c1d97b1b0bfccced9}} 
\index{Netdev@{Netdev}!g\_netdev\_netns\_ctx\_list@{g\_netdev\_netns\_ctx\_list}}
\index{g\_netdev\_netns\_ctx\_list@{g\_netdev\_netns\_ctx\_list}!Netdev@{Netdev}}
\doxysubsubsection{g\_netdev\_netns\_ctx\_list}
{\footnotesize\ttfamily struct \textbf{ llist\+\_\+head} g\+\_\+netdev\+\_\+netns\+\_\+ctx\+\_\+list = \textbf{ LLIST\+\_\+\+HEAD\+\_\+\+INIT}(g\+\_\+netdev\+\_\+netns\+\_\+ctx\+\_\+list)\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+alloc()}, and \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+find\+\_\+by\+\_\+netns\+\_\+name()}.

