summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1999-08-07 19:25:20 +0000
committerErik Troan <ewt@redhat.com>1999-08-07 19:25:20 +0000
commit413cf4439566642c7c3811db5a94dd8e6ef2b2c2 (patch)
tree35d21a4eb1eb60ce3cebf7d4d867c2969789060e /isys
parent7963950fccc64cb4e50505a967df0b05f7f2950a (diff)
downloadanaconda-413cf4439566642c7c3811db5a94dd8e6ef2b2c2.tar.gz
anaconda-413cf4439566642c7c3811db5a94dd8e6ef2b2c2.tar.xz
anaconda-413cf4439566642c7c3811db5a94dd8e6ef2b2c2.zip
updated to use pump for net configuration
Diffstat (limited to 'isys')
-rw-r--r--isys/Makefile2
-rw-r--r--isys/inet.c146
-rw-r--r--isys/inet.h22
-rw-r--r--isys/isys.c16
4 files changed, 8 insertions, 178 deletions
diff --git a/isys/Makefile b/isys/Makefile
index 91934e1f7..84596c327 100644
--- a/isys/Makefile
+++ b/isys/Makefile
@@ -2,7 +2,7 @@ DESTDIR = $(TOPDIR)/RedHat/instimage/usr/lib/python1.5/site-packages
CFLAGS = -I/usr/include/python1.5 -g
OBJECTS = isys.o nfsmount.o dns.o mount_clnt.o mount_xdr.o imount.o \
- inet.o smp.o moduleinfo.o devnodes.o otherinsmod.o cpio.o probe.o
+ smp.o moduleinfo.o devnodes.o otherinsmod.o cpio.o probe.o
STATICLIBS = pci/libpciprobe.a modutils/insmod/libmodutils.a \
modutils/obj/libobj.a modutils/util/libutil.a
LOADLIBES = -lrpm -lresolv -lz -lpci
diff --git a/isys/inet.c b/isys/inet.c
deleted file mode 100644
index 03dd92147..000000000
--- a/isys/inet.c
+++ /dev/null
@@ -1,146 +0,0 @@
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <net/route.h>
-#include <sys/ioctl.h>
-
-#include "inet.h"
-
-int configureNetDevice(struct intfInfo * intf) {
- struct ifreq req;
- int s;
- struct sockaddr_in addr;
- struct in_addr ia;
- char ip[20], nm[20], nw[20], bc[20];
-#if 0 /* 2.0 kernels only */
- struct rtentry route;
-#endif
-
- addr.sin_family = AF_INET;
- addr.sin_port = 0;
-
- memcpy(&ia, &intf->ip, sizeof(intf->ip));
- strcpy(ip, inet_ntoa(ia));
-
- memcpy(&ia, &intf->netmask, sizeof(intf->netmask));
- strcpy(nm, inet_ntoa(ia));
-
- memcpy(&ia, &intf->broadcast, sizeof(intf->broadcast));
- strcpy(bc, inet_ntoa(ia));
-
- memcpy(&ia, &intf->network, sizeof(intf->network));
- strcpy(nw, inet_ntoa(ia));
-
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s < 0) {
- perror("socket");
- return 1;
- }
-
- strcpy(req.ifr_name, intf->device);
- req.ifr_flags &= ~(IFF_UP | IFF_RUNNING); /* Take down iface */
- if (ioctl(s, SIOCSIFFLAGS, &req)) {
- perror("SIOCSIFFLAGS");
- close(s);
- return 1;
- }
-
- addr.sin_port = 0;
- memcpy(&addr.sin_addr, &intf->ip, sizeof(intf->ip));
- memcpy(&req.ifr_addr, &addr, sizeof(addr));
- if (ioctl(s, SIOCSIFADDR, &req)) {
- perror("SIOCSIFADDR");
- close(s);
- return 1;
- }
-
- memcpy(&addr.sin_addr, &intf->broadcast, sizeof(intf->broadcast));
- memcpy(&req.ifr_broadaddr, &addr, sizeof(addr));
- if (ioctl(s, SIOCSIFBRDADDR, &req)) {
- perror("SIOCSIFNETMASK");
- close(s);
- return 1;
- }
-
- memcpy(&addr.sin_addr, &intf->netmask, sizeof(intf->netmask));
- memcpy(&req.ifr_netmask, &addr, sizeof(addr));
- if (ioctl(s, SIOCSIFNETMASK, &req)) {
- perror("SIOCSIFNETMASK\n");
- close(s);
- return 1;
- }
-
- if (intf->isPtp)
- req.ifr_flags = IFF_UP | IFF_RUNNING | IFF_POINTOPOINT | IFF_NOARP;
- else
- req.ifr_flags = IFF_UP | IFF_RUNNING | IFF_BROADCAST;
-
- if (ioctl(s, SIOCSIFFLAGS, &req)) {
- perror("SIOCSIFFLAGS");
- close(s);
- return 1;
- }
-
-#if 0 /* kernel 2.0 only */
- memset(&route, 0, sizeof(route));
- route.rt_dev = intf->device;
- route.rt_flags = RTF_UP;
-
- memcpy(&addr.sin_addr, &intf->network, sizeof(intf->netmask));
- memcpy(&route.rt_dst, &addr, sizeof(addr));
-
- memcpy(&addr.sin_addr, &intf->netmask, sizeof(intf->netmask));
- memcpy(&route.rt_genmask, &addr, sizeof(addr));
-
- if (ioctl(s, SIOCADDRT, &route)) {
- perror("SIOCADDRT");
- close(s);
- return 1;
-
- }
-#endif
-
- intf->isUp = 1;
-
- return 0;
-}
-
-int addDefaultRoute(struct intfInfo * net) {
- int s;
- struct rtentry route;
- struct sockaddr_in addr;
-
- /* It should be okay to try and setup a machine w/o a default gateway */
- /* XXX
- if (!(net->set & NETINFO_HAS_GATEWAY)) return 0;
- */
-
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s < 0) {
- close(s);
- perror("socket:");
- return 1;
- }
-
- memset(&route, 0, sizeof(route));
-
- addr.sin_family = AF_INET;
- addr.sin_port = 0;
- addr.sin_addr = net->gateway;
- memcpy(&route.rt_gateway, &addr, sizeof(addr));
-
- addr.sin_addr.s_addr = INADDR_ANY;
- memcpy(&route.rt_dst, &addr, sizeof(addr));
- memcpy(&route.rt_genmask, &addr, sizeof(addr));
-
- route.rt_flags = RTF_UP | RTF_GATEWAY;
- route.rt_metric = 0;
-
- if (ioctl(s, SIOCADDRT, &route)) {
- close(s);
- perror("SIOCADDRT");
- return 1;
- }
-
- return 0;
-}
diff --git a/isys/inet.h b/isys/inet.h
deleted file mode 100644
index 7c065c6f2..000000000
--- a/isys/inet.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _INET_H_
-#define _INET_H_
-
-#include <netinet/in.h>
-
-#define INET_ERR_ERRNO 1
-#define INET_ERR_OTHER 2
-
-struct intfInfo {
- char device[10];
- int isPtp, isUp;
- int set, manuallySet;
- struct in_addr ip, netmask, broadcast, network;
- struct in_addr bootServer, gateway;
- char * bootFile;
- int bootProto;
-};
-
-int configureNetDevice(struct intfInfo * intf);
-int addDefaultRoute(struct intfInfo * net);
-
-#endif /* _INET_H_ */
diff --git a/isys/isys.c b/isys/isys.c
index e9bdd33cc..7cce1b406 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -7,7 +7,7 @@
#include "Python.h"
#include "imount.h"
-#include "inet.h"
+#include "../pump/pump.h"
#include "isys.h"
#include "pci/pciprobe.h"
#include "probe.h"
@@ -341,7 +341,7 @@ static void emptyDestructor(PyObject * s) {
static PyObject * doConfigNetDevice(PyObject * s, PyObject * args) {
char * dev, * ip, * netmask, * broadcast, * network;
int * isPtp, rc;
- struct intfInfo device;
+ struct pumpNetIntf device;
if (!PyArg_ParseTuple(args, "sssssd", &dev, &ip, &netmask, &broadcast,
&network, &isPtp)) return NULL;
@@ -351,15 +351,13 @@ static PyObject * doConfigNetDevice(PyObject * s, PyObject * args) {
device.netmask.s_addr = inet_addr(netmask);
device.broadcast.s_addr = inet_addr(broadcast);
device.network.s_addr = inet_addr(network);
- device.isPtp = 0;
- device.isUp = 0;
+ device.set = PUMP_INTFINFO_HAS_IP | PUMP_INTFINFO_HAS_NETMASK |
+ PUMP_INTFINFO_HAS_BROADCAST | PUMP_INTFINFO_HAS_NETWORK;
- rc = configureNetDevice(&device);
-
- if (rc == INET_ERR_ERRNO)
+ if (pumpSetupInterface(&device)) {
PyErr_SetFromErrno(PyExc_SystemError);
- else if (rc)
- PyErr_SetString(PyExc_SystemError, "net configure failed");
+ return NULL;
+ }
Py_INCREF(Py_None);
return Py_None;