diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/network.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/firejail/network.c b/src/firejail/network.c index c1adf87cc..19c4b5244 100644 --- a/src/firejail/network.c +++ b/src/firejail/network.c | |||
@@ -89,29 +89,29 @@ int net_get_mtu(const char *ifname) { | |||
89 | return mtu; | 89 | return mtu; |
90 | } | 90 | } |
91 | 91 | ||
92 | void net_set_mtu(const char *ifname, int mtu) { | 92 | //void net_set_mtu(const char *ifname, int mtu) { |
93 | if (strlen(ifname) > IFNAMSIZ) { | 93 | // if (strlen(ifname) > IFNAMSIZ) { |
94 | fprintf(stderr, "Error: invalid network device name %s\n", ifname); | 94 | // fprintf(stderr, "Error: invalid network device name %s\n", ifname); |
95 | exit(1); | 95 | // exit(1); |
96 | } | 96 | // } |
97 | 97 | // | |
98 | if (arg_debug) | 98 | // if (arg_debug) |
99 | printf("set interface %s MTU %d.\n", ifname, mtu); | 99 | // printf("set interface %s MTU %d.\n", ifname, mtu); |
100 | 100 | // | |
101 | int s; | 101 | // int s; |
102 | struct ifreq ifr; | 102 | // struct ifreq ifr; |
103 | 103 | // | |
104 | if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) | 104 | // if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) |
105 | errExit("socket"); | 105 | // errExit("socket"); |
106 | 106 | // | |
107 | memset(&ifr, 0, sizeof(ifr)); | 107 | // memset(&ifr, 0, sizeof(ifr)); |
108 | ifr.ifr_addr.sa_family = AF_INET; | 108 | // ifr.ifr_addr.sa_family = AF_INET; |
109 | strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1); | 109 | // strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1); |
110 | ifr.ifr_mtu = mtu; | 110 | // ifr.ifr_mtu = mtu; |
111 | if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) != 0) | 111 | // if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) != 0) |
112 | fwarning("cannot set mtu for interface %s\n", ifname); | 112 | // fwarning("cannot set mtu for interface %s\n", ifname); |
113 | close(s); | 113 | // close(s); |
114 | } | 114 | //} |
115 | 115 | ||
116 | // return -1 if the interface was not found; if the interface was found retrn 0 and fill in IP address and mask | 116 | // return -1 if the interface was not found; if the interface was found retrn 0 and fill in IP address and mask |
117 | int net_get_if_addr(const char *bridge, uint32_t *ip, uint32_t *mask, uint8_t mac[6], int *mtu) { | 117 | int net_get_if_addr(const char *bridge, uint32_t *ip, uint32_t *mask, uint8_t mac[6], int *mtu) { |