1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
/*
* Copyright (C) 2017-2026 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under LGPL-2.0+
*/
#ifndef __NOZZLE_INTERNALS_H__
#define __NOZZLE_INTERNALS_H__
#include "config.h"
#ifdef KNET_LINUX
#include <netlink/netlink.h>
#endif
#ifdef KNET_SOLARIS
#include <sys/sockio.h>
#endif
#include <net/if.h>
#include "libnozzle.h"
struct nozzle_lib_config {
struct nozzle_iface *head;
int ioctlfd;
#ifdef KNET_LINUX
struct nl_sock *nlsock;
#endif
};
#define MACADDR_CHAR_MAX 18
/*
* 11 = post-down.d
* 1 = /
*/
#define UPDOWN_PATH_MAX PATH_MAX - 11 - 1 - IFNAMSIZ
struct nozzle_iface {
char name[IFNAMSIZ]; /* interface name */
int fd; /* interface fd */
int up; /* interface status 0 is down, 1 is up */
/*
* extra data
*/
struct nozzle_ip *ip; /* configured ip addresses */
/*
* default MAC address assigned by the kernel at creation time
*/
char default_mac[MACADDR_CHAR_MAX + 1];
int default_mtu; /* MTU assigned by the kernel at creation time */
int current_mtu; /* MTU configured by libnozzle user */
int hasupdown; /* interface has up/down path to scripts configured */
char updownpath[UPDOWN_PATH_MAX]; /* path to up/down scripts if configured */
struct nozzle_iface *next;
#ifdef KNET_SOLARIS
int ip_fd;
int ip6_fd;
#endif
};
#ifdef KNET_SOLARIS
#define ifname ifr.lifr_name
#define ifmtu ifr.lifr_mtu
#define ifflags ifr.lifr_flags
#else
#define ifname ifr.ifr_name
#define ifmtu ifr.ifr_mtu
#define ifflags ifr.ifr_flags
#endif
int execute_bin_sh_command(const char *command, char **error_string);
int find_ip(nozzle_t nozzle,
const char *ipaddr, const char *prefix,
struct nozzle_ip **ip, struct nozzle_ip **ip_prev);
char *generate_v4_broadcast(const char *ipaddr, const char *prefix);
#endif
|